Merge pull request #104 from georgekaz/add-skip-crds
add skip-crds flag support
This commit is contained in:
commit
7c033a8b0a
|
@ -1,4 +1,4 @@
|
||||||
FROM alpine/helm:3.2.4
|
FROM alpine/helm:3.6.2
|
||||||
MAINTAINER Erin Call <erin@liffft.com>
|
MAINTAINER Erin Call <erin@liffft.com>
|
||||||
|
|
||||||
COPY build/drone-helm /bin/drone-helm
|
COPY build/drone-helm /bin/drone-helm
|
||||||
|
|
|
@ -50,6 +50,7 @@ Installations are triggered when the `mode` setting is "upgrade." They can also
|
||||||
| 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. This is ignored if `skip_kubeconfig` is `true`. |
|
| skip_tls_verify | boolean | | | Connect to the Kubernetes cluster without checking for a valid TLS certificate. Not recommended in production. This is ignored if `skip_kubeconfig` is `true`. |
|
||||||
| create_namespace | boolean | | | Pass --create-namespace to `helm upgrade`. |
|
| create_namespace | boolean | | | Pass --create-namespace to `helm upgrade`. |
|
||||||
|
| skip_crds | boolean | | | Pass --skip-crds to `helm upgrade`. |
|
||||||
|
|
||||||
## Uninstallation
|
## Uninstallation
|
||||||
|
|
||||||
|
|
1
internal/env/config.go
vendored
1
internal/env/config.go
vendored
|
@ -52,6 +52,7 @@ type Config struct {
|
||||||
AtomicUpgrade bool `split_words:"true"` // Pass --atomic to `helm upgrade`
|
AtomicUpgrade bool `split_words:"true"` // Pass --atomic to `helm upgrade`
|
||||||
CleanupOnFail bool `envconfig:"cleanup_failed_upgrade"` // Pass --cleanup-on-fail to `helm upgrade`
|
CleanupOnFail bool `envconfig:"cleanup_failed_upgrade"` // Pass --cleanup-on-fail to `helm upgrade`
|
||||||
LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint`
|
LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint`
|
||||||
|
SkipCrds bool `split_words:"true"` // Pass --skip-crds to `helm upgrade`
|
||||||
|
|
||||||
Stdout io.Writer `ignored:"true"`
|
Stdout io.Writer `ignored:"true"`
|
||||||
Stderr io.Writer `ignored:"true"`
|
Stderr io.Writer `ignored:"true"`
|
||||||
|
|
|
@ -24,6 +24,7 @@ type Upgrade struct {
|
||||||
cleanupOnFail bool
|
cleanupOnFail bool
|
||||||
certs *repoCerts
|
certs *repoCerts
|
||||||
createNamespace bool
|
createNamespace bool
|
||||||
|
skipCrds bool
|
||||||
|
|
||||||
cmd cmd
|
cmd cmd
|
||||||
}
|
}
|
||||||
|
@ -47,6 +48,7 @@ func NewUpgrade(cfg env.Config) *Upgrade {
|
||||||
cleanupOnFail: cfg.CleanupOnFail,
|
cleanupOnFail: cfg.CleanupOnFail,
|
||||||
certs: newRepoCerts(cfg),
|
certs: newRepoCerts(cfg),
|
||||||
createNamespace: cfg.CreateNamespace,
|
createNamespace: cfg.CreateNamespace,
|
||||||
|
skipCrds: cfg.SkipCrds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +102,9 @@ func (u *Upgrade) Prepare() error {
|
||||||
if u.createNamespace {
|
if u.createNamespace {
|
||||||
args = append(args, "--create-namespace")
|
args = append(args, "--create-namespace")
|
||||||
}
|
}
|
||||||
|
if u.skipCrds {
|
||||||
|
args = append(args, "--skip-crds")
|
||||||
|
}
|
||||||
for _, vFile := range u.valuesFiles {
|
for _, vFile := range u.valuesFiles {
|
||||||
args = append(args, "--values", vFile)
|
args = append(args, "--values", vFile)
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,3 +220,27 @@ func (suite *UpgradeTestSuite) TestPrepareDebugFlag() {
|
||||||
suite.Equal(want, stderr.String())
|
suite.Equal(want, stderr.String())
|
||||||
suite.Equal("", stdout.String())
|
suite.Equal("", stdout.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *UpgradeTestSuite) TestPrepareSkipCrdsFlag() {
|
||||||
|
defer suite.ctrl.Finish()
|
||||||
|
|
||||||
|
cfg := env.Config{
|
||||||
|
Chart: "at40",
|
||||||
|
Release: "cabbages_smell_great",
|
||||||
|
SkipCrds: true,
|
||||||
|
}
|
||||||
|
u := NewUpgrade(cfg)
|
||||||
|
|
||||||
|
command = func(path string, args ...string) cmd {
|
||||||
|
suite.Equal(helmBin, path)
|
||||||
|
suite.Equal([]string{"upgrade", "--install", "--skip-crds", "cabbages_smell_great", "at40"}, args)
|
||||||
|
|
||||||
|
return suite.mockCmd
|
||||||
|
}
|
||||||
|
|
||||||
|
suite.mockCmd.EXPECT().Stdout(gomock.Any())
|
||||||
|
suite.mockCmd.EXPECT().Stderr(gomock.Any())
|
||||||
|
|
||||||
|
err := u.Prepare()
|
||||||
|
suite.Require().Nil(err)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue