This commit is contained in:
parent
b3e27db8b3
commit
b41b44c313
6
main.go
6
main.go
|
|
@ -970,11 +970,11 @@ func (a *app) loadDesiredStateFromYaml(yaml []byte, file string, namespace strin
|
||||||
}
|
}
|
||||||
|
|
||||||
if a.kubeContext != "" {
|
if a.kubeContext != "" {
|
||||||
if st.Context != "" {
|
if st.HelmDefaults.KubeContext != "" {
|
||||||
log.Printf("err: Cannot use option --kube-context and set attribute context.")
|
log.Printf("err: Cannot use option --kube-context and set attribute helmDefaults.kubeContext.")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
st.Context = a.kubeContext
|
st.HelmDefaults.KubeContext = a.kubeContext
|
||||||
}
|
}
|
||||||
if namespace != "" {
|
if namespace != "" {
|
||||||
if st.Namespace != "" {
|
if st.Namespace != "" {
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,10 @@ func (c *creator) CreateFromYaml(content []byte, file string, env string) (*Helm
|
||||||
state.DeprecatedReleases = []ReleaseSpec{}
|
state.DeprecatedReleases = []ReleaseSpec{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if state.DeprecatedContext != "" && state.HelmDefaults.KubeContext == "" {
|
||||||
|
state.HelmDefaults.KubeContext = state.DeprecatedContext
|
||||||
|
}
|
||||||
|
|
||||||
state.logger = c.logger
|
state.logger = c.logger
|
||||||
|
|
||||||
e, err := state.loadEnv(env, c.readFile)
|
e, err := state.loadEnv(env, c.readFile)
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ type HelmState struct {
|
||||||
FilePath string
|
FilePath string
|
||||||
HelmDefaults HelmSpec `yaml:"helmDefaults"`
|
HelmDefaults HelmSpec `yaml:"helmDefaults"`
|
||||||
Helmfiles []string `yaml:"helmfiles"`
|
Helmfiles []string `yaml:"helmfiles"`
|
||||||
Context string `yaml:"context"`
|
DeprecatedContext string `yaml:"context"`
|
||||||
DeprecatedReleases []ReleaseSpec `yaml:"charts"`
|
DeprecatedReleases []ReleaseSpec `yaml:"charts"`
|
||||||
Namespace string `yaml:"namespace"`
|
Namespace string `yaml:"namespace"`
|
||||||
Repositories []RepositorySpec `yaml:"repositories"`
|
Repositories []RepositorySpec `yaml:"repositories"`
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ func TestHelmState_applyDefaultsTo(t *testing.T) {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
state := &HelmState{
|
state := &HelmState{
|
||||||
basePath: tt.fields.BaseChartPath,
|
basePath: tt.fields.BaseChartPath,
|
||||||
Context: tt.fields.Context,
|
DeprecatedContext: tt.fields.Context,
|
||||||
DeprecatedReleases: tt.fields.DeprecatedReleases,
|
DeprecatedReleases: tt.fields.DeprecatedReleases,
|
||||||
Namespace: tt.fields.Namespace,
|
Namespace: tt.fields.Namespace,
|
||||||
Repositories: tt.fields.Repositories,
|
Repositories: tt.fields.Repositories,
|
||||||
|
|
@ -381,7 +381,7 @@ func TestHelmState_flagsForUpgrade(t *testing.T) {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
state := &HelmState{
|
state := &HelmState{
|
||||||
basePath: "./",
|
basePath: "./",
|
||||||
Context: "default",
|
DeprecatedContext: "default",
|
||||||
Releases: []ReleaseSpec{*tt.release},
|
Releases: []ReleaseSpec{*tt.release},
|
||||||
HelmDefaults: tt.defaults,
|
HelmDefaults: tt.defaults,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue