feat: Adopt existing K8s resources as Helm release on install (#746)
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
This commit is contained in:
		
							parent
							
								
									408bf7b8bf
								
							
						
					
					
						commit
						4166b418c9
					
				| 
						 | 
					@ -19,6 +19,10 @@ func (st *HelmState) appendHelmXFlags(flags []string, release *ReleaseSpec) ([]s
 | 
				
			||||||
		flags = append(flags, "--dependency", dep)
 | 
							flags = append(flags, "--dependency", dep)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for _, adopt := range release.Adopt {
 | 
				
			||||||
 | 
							flags = append(flags, "--adopt", adopt)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	jsonPatches := release.JSONPatches
 | 
						jsonPatches := release.JSONPatches
 | 
				
			||||||
	if len(jsonPatches) > 0 {
 | 
						if len(jsonPatches) > 0 {
 | 
				
			||||||
		generatedFiles, err := st.generateTemporaryValuesFiles(jsonPatches, release.MissingFileHandler)
 | 
							generatedFiles, err := st.generateTemporaryValuesFiles(jsonPatches, release.MissingFileHandler)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -168,6 +168,7 @@ type ReleaseSpec struct {
 | 
				
			||||||
	Dependencies          []Dependency  `yaml:"dependencies"`
 | 
						Dependencies          []Dependency  `yaml:"dependencies"`
 | 
				
			||||||
	JSONPatches           []interface{} `yaml:"jsonPatches"`
 | 
						JSONPatches           []interface{} `yaml:"jsonPatches"`
 | 
				
			||||||
	StrategicMergePatches []interface{} `yaml:"strategicMergePatches"`
 | 
						StrategicMergePatches []interface{} `yaml:"strategicMergePatches"`
 | 
				
			||||||
 | 
						Adopt                 []string      `yaml:"adopt"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// generatedValues are values that need cleaned up on exit
 | 
						// generatedValues are values that need cleaned up on exit
 | 
				
			||||||
	generatedValues []string
 | 
						generatedValues []string
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue