Skip to content

Commit 05da914

Browse files
authored
CR-18322-validate-values (#697)
## What added more helm validations (support platform and git certificates, allow ingress sklip, etc) ## Why going to add as a pre-install step to helm-install ## Notes changes will also be effective as stand-alone helm validation checks
1 parent 7e5ecfe commit 05da914

22 files changed

+910
-433
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,5 @@ site
9595

9696
# codecov
9797
codecov*
98+
99+
values.yaml

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.1.47
1+
VERSION=v0.1.48
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

cmd/commands/common.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ func getKubeContextName(context, kubeconfig *pflag.Flag) (string, error) {
486486

487487
return contextName, context.Value.Set(contextName)
488488
}
489+
489490
type SelectItem struct {
490491
Value string
491492
Label string

cmd/commands/config.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ import (
3030
)
3131

3232
type (
33+
createContextOpts struct {
34+
apiKey string
35+
caCert string
36+
name string
37+
url string
38+
}
39+
3340
updateGitOpsSettingsOpts struct {
3441
gitProvider cfgit.ProviderType
3542
gitApiURL string
@@ -74,10 +81,7 @@ commands, respectively:
7481
}
7582

7683
func newConfigCreateContextCommand() *cobra.Command {
77-
var (
78-
apiKey string
79-
url string
80-
)
84+
opts := &createContextOpts{}
8185

8286
cmd := &cobra.Command{
8387
Use: "create-context NAME",
@@ -92,24 +96,26 @@ func newConfigCreateContextCommand() *cobra.Command {
9296
return fmt.Errorf("must provide context name to use")
9397
}
9498

95-
return runConfigCreateContext(cmd.Context(), args[0], apiKey, url)
99+
opts.name = args[0]
100+
return runConfigCreateContext(cmd.Context(), opts)
96101
},
97102
}
98103

99-
cmd.Flags().StringVar(&apiKey, "api-key", "", "API key")
100-
cmd.Flags().StringVar(&url, "url", store.Get().DefaultAPI, "Codefresh system custom url ")
104+
cmd.Flags().StringVar(&opts.apiKey, "api-key", "", "API key")
105+
cmd.Flags().StringVar(&opts.caCert, "ca-cert", "", "Codefresh Platform certificate file (for on-prem)")
106+
cmd.Flags().StringVar(&opts.url, "url", store.Get().DefaultAPI, "Codefresh system custom url ")
101107
die(cmd.MarkFlagRequired("api-key"))
102108

103109
return cmd
104110
}
105111

106-
func runConfigCreateContext(ctx context.Context, context, apiKey, url string) error {
107-
if err := cfConfig.CreateContext(ctx, context, apiKey, url); err != nil {
112+
func runConfigCreateContext(ctx context.Context, opts *createContextOpts) error {
113+
if err := cfConfig.CreateContext(ctx, opts.name, opts.apiKey, opts.url, opts.caCert); err != nil {
108114
return err
109115
}
110116

111-
log.G().Infof("New context created: \"%s\"", context)
112-
return runConfigUseContext(ctx, context)
117+
log.G().Infof("New context created: \"%s\"", opts.name)
118+
return runConfigUseContext(ctx, opts.name)
113119
}
114120

115121
func newConfigGetContextsCommand() *cobra.Command {

0 commit comments

Comments
 (0)