Add a parameter "create_namespace"
This commit is contained in:
parent
03b066bfd7
commit
70b2a2d0b4
|
@ -48,6 +48,7 @@ Installations are triggered when the `mode` setting is "upgrade." They can also
|
||||||
| values_files | list\<string\> | | | Values to use as `--values` arguments to `helm upgrade`. |
|
| values_files | list\<string\> | | | Values to use as `--values` arguments to `helm upgrade`. |
|
||||||
| reuse_values | boolean | | | Reuse the values from a previous release. |
|
| reuse_values | boolean | | | Reuse the values from a previous release. |
|
||||||
| skip_tls_verify | boolean | | | Connect to the Kubernetes cluster without checking for a valid TLS certificate. Not recommended in production. |
|
| skip_tls_verify | boolean | | | Connect to the Kubernetes cluster without checking for a valid TLS certificate. Not recommended in production. |
|
||||||
|
| create_namespace | boolean | | | Pass --create-namespace to `helm upgrade`. |
|
||||||
|
|
||||||
## Uninstallation
|
## Uninstallation
|
||||||
|
|
||||||
|
|
1
internal/env/config.go
vendored
1
internal/env/config.go
vendored
|
@ -33,6 +33,7 @@ type Config struct {
|
||||||
StringValues string `split_words:"true"` // Argument to pass to --set-string in applicable helm commands
|
StringValues string `split_words:"true"` // Argument to pass to --set-string in applicable helm commands
|
||||||
ValuesFiles []string `split_words:"true"` // Arguments to pass to --values in applicable helm commands
|
ValuesFiles []string `split_words:"true"` // Arguments to pass to --values in applicable helm commands
|
||||||
Namespace string `` // Kubernetes namespace for all helm commands
|
Namespace string `` // Kubernetes namespace for all helm commands
|
||||||
|
CreateNamespace bool `split_words:"true"` // Pass --create-namespace to `helm upgrade`
|
||||||
KubeToken string `split_words:"true"` // Kubernetes authentication token to put in .kube/config
|
KubeToken string `split_words:"true"` // Kubernetes authentication token to put in .kube/config
|
||||||
SkipTLSVerify bool `envconfig:"skip_tls_verify"` // Put insecure-skip-tls-verify in .kube/config
|
SkipTLSVerify bool `envconfig:"skip_tls_verify"` // Put insecure-skip-tls-verify in .kube/config
|
||||||
Certificate string `envconfig:"kube_certificate"` // The Kubernetes cluster CA's self-signed certificate (must be base64-encoded)
|
Certificate string `envconfig:"kube_certificate"` // The Kubernetes cluster CA's self-signed certificate (must be base64-encoded)
|
||||||
|
|
|
@ -11,18 +11,19 @@ type Upgrade struct {
|
||||||
chart string
|
chart string
|
||||||
release string
|
release string
|
||||||
|
|
||||||
chartVersion string
|
chartVersion string
|
||||||
dryRun bool
|
dryRun bool
|
||||||
wait bool
|
wait bool
|
||||||
values string
|
values string
|
||||||
stringValues string
|
stringValues string
|
||||||
valuesFiles []string
|
valuesFiles []string
|
||||||
reuseValues bool
|
reuseValues bool
|
||||||
timeout string
|
timeout string
|
||||||
force bool
|
force bool
|
||||||
atomic bool
|
atomic bool
|
||||||
cleanupOnFail bool
|
cleanupOnFail bool
|
||||||
certs *repoCerts
|
certs *repoCerts
|
||||||
|
createNamespace bool
|
||||||
|
|
||||||
cmd cmd
|
cmd cmd
|
||||||
}
|
}
|
||||||
|
@ -30,21 +31,22 @@ type Upgrade struct {
|
||||||
// NewUpgrade creates an Upgrade using fields from the given Config. No validation is performed at this time.
|
// NewUpgrade creates an Upgrade using fields from the given Config. No validation is performed at this time.
|
||||||
func NewUpgrade(cfg env.Config) *Upgrade {
|
func NewUpgrade(cfg env.Config) *Upgrade {
|
||||||
return &Upgrade{
|
return &Upgrade{
|
||||||
config: newConfig(cfg),
|
config: newConfig(cfg),
|
||||||
chart: cfg.Chart,
|
chart: cfg.Chart,
|
||||||
release: cfg.Release,
|
release: cfg.Release,
|
||||||
chartVersion: cfg.ChartVersion,
|
chartVersion: cfg.ChartVersion,
|
||||||
dryRun: cfg.DryRun,
|
dryRun: cfg.DryRun,
|
||||||
wait: cfg.Wait,
|
wait: cfg.Wait,
|
||||||
values: cfg.Values,
|
values: cfg.Values,
|
||||||
stringValues: cfg.StringValues,
|
stringValues: cfg.StringValues,
|
||||||
valuesFiles: cfg.ValuesFiles,
|
valuesFiles: cfg.ValuesFiles,
|
||||||
reuseValues: cfg.ReuseValues,
|
reuseValues: cfg.ReuseValues,
|
||||||
timeout: cfg.Timeout,
|
timeout: cfg.Timeout,
|
||||||
force: cfg.Force,
|
force: cfg.Force,
|
||||||
atomic: cfg.AtomicUpgrade,
|
atomic: cfg.AtomicUpgrade,
|
||||||
cleanupOnFail: cfg.CleanupOnFail,
|
cleanupOnFail: cfg.CleanupOnFail,
|
||||||
certs: newRepoCerts(cfg),
|
certs: newRepoCerts(cfg),
|
||||||
|
createNamespace: cfg.CreateNamespace,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +97,9 @@ func (u *Upgrade) Prepare() error {
|
||||||
if u.stringValues != "" {
|
if u.stringValues != "" {
|
||||||
args = append(args, "--set-string", u.stringValues)
|
args = append(args, "--set-string", u.stringValues)
|
||||||
}
|
}
|
||||||
|
if u.createNamespace {
|
||||||
|
args = append(args, "--create-namespace")
|
||||||
|
}
|
||||||
for _, vFile := range u.valuesFiles {
|
for _, vFile := range u.valuesFiles {
|
||||||
args = append(args, "--values", vFile)
|
args = append(args, "--values", vFile)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue