Skip to content

Commit

Permalink
feat: Adopt existing K8s resources as Helm release on install (#746)
Browse files Browse the repository at this point in the history
Use with the helm-x support(#673)

This enhances config syntax to accept adopt: [NS/KIND/RESOURCE_NAME] at the release level so that helmfile calls helm-x to transparently import existing resources at the installation time.

Resolves #84
  • Loading branch information
msutter authored and mumoshu committed Jul 11, 2019
1 parent 408bf7b commit 4166b41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/state/helmx.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ func (st *HelmState) appendHelmXFlags(flags []string, release *ReleaseSpec) ([]s
flags = append(flags, "--dependency", dep)
}

for _, adopt := range release.Adopt {
flags = append(flags, "--adopt", adopt)
}

jsonPatches := release.JSONPatches
if len(jsonPatches) > 0 {
generatedFiles, err := st.generateTemporaryValuesFiles(jsonPatches, release.MissingFileHandler)
Expand Down
1 change: 1 addition & 0 deletions pkg/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ type ReleaseSpec struct {
Dependencies []Dependency `yaml:"dependencies"`
JSONPatches []interface{} `yaml:"jsonPatches"`
StrategicMergePatches []interface{} `yaml:"strategicMergePatches"`
Adopt []string `yaml:"adopt"`

// generatedValues are values that need cleaned up on exit
generatedValues []string
Expand Down

0 comments on commit 4166b41

Please sign in to comment.