MCPcopy
hub / github.com/helm/helm / addInstallFlags

Function addInstallFlags

pkg/cmd/install.go:186–252  ·  view source on GitHub ↗
(cmd *cobra.Command, f *pflag.FlagSet, client *action.Install, valueOpts *values.Options)

Source from the content-addressed store, hash-verified

184}
185
186func addInstallFlags(cmd *cobra.Command, f *pflag.FlagSet, client *action.Install, valueOpts *values.Options) {
187 f.BoolVar(&client.CreateNamespace, "create-namespace", false, "create the release namespace if not present")
188 f.BoolVar(&client.ForceReplace, "force-replace", false, "force resource updates by replacement")
189 f.BoolVar(&client.ForceReplace, "force", false, "deprecated")
190 f.MarkDeprecated("force", "use --force-replace instead")
191 f.BoolVar(&client.ForceConflicts, "force-conflicts", false, "if set server-side apply will force changes against conflicts")
192 f.BoolVar(&client.ServerSideApply, "server-side", true, "object updates run in the server instead of the client")
193 f.BoolVar(&client.DisableHooks, "no-hooks", false, "prevent hooks from running during install")
194 f.BoolVar(&client.Replace, "replace", false, "reuse the given name, only if that name is a deleted release which remains in the history. This is unsafe in production")
195 f.DurationVar(&client.Timeout, "timeout", 300*time.Second, "time to wait for any individual Kubernetes operation (like Jobs for hooks)")
196 f.BoolVar(&client.WaitForJobs, "wait-for-jobs", false, "if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout")
197 f.BoolVarP(&client.GenerateName, "generate-name", "g", false, "generate the name (and omit the NAME parameter)")
198 f.StringVar(&client.NameTemplate, "name-template", "", "specify template used to name the release")
199 f.StringVar(&client.Description, "description", "", "add a custom description")
200 f.BoolVar(&client.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored")
201 f.BoolVar(&client.DependencyUpdate, "dependency-update", false, "update dependencies if they are missing before installing the chart")
202 f.BoolVar(&client.DisableOpenAPIValidation, "disable-openapi-validation", false, "if set, the installation process will not validate rendered templates against the Kubernetes OpenAPI Schema")
203 f.BoolVar(&client.RollbackOnFailure, "rollback-on-failure", false, "if set, Helm will rollback (uninstall) the installation upon failure. The --wait flag will be default to \"watcher\" if --rollback-on-failure is set")
204 f.BoolVar(&client.RollbackOnFailure, "atomic", false, "deprecated")
205 f.MarkDeprecated("atomic", "use --rollback-on-failure instead")
206 f.BoolVar(&client.SkipCRDs, "skip-crds", false, "if set, no CRDs will be installed. By default, CRDs are installed if not already present")
207 f.BoolVar(&client.SubNotes, "render-subchart-notes", false, "if set, render subchart notes along with the parent")
208 f.BoolVar(&client.SkipSchemaValidation, "skip-schema-validation", false, "if set, disables JSON schema validation")
209 f.StringToStringVarP(&client.Labels, "labels", "l", nil, "Labels that would be added to release metadata. Should be divided by comma.")
210 f.BoolVar(&client.EnableDNS, "enable-dns", false, "enable DNS lookups when rendering templates")
211 f.BoolVar(&client.HideNotes, "hide-notes", false, "if set, do not show notes in install output. Does not affect presence in chart metadata")
212 f.BoolVar(&client.TakeOwnership, "take-ownership", false, "if set, install will ignore the check for helm annotations and take ownership of the existing resources")
213
214 // For `helm template`, these notes flags are legacy, unused, and should not show in help, but
215 // must remain accepted for backwards compatibility in Helm 4. Deprecate and hide them for now
216 // TODO remove these from template command in Helm 5
217 if cmd.Name() == "template" {
218 if err := cmd.Flags().MarkDeprecated("hide-notes", "this flag has no effect for 'helm template' and will be removed in Helm 5"); err != nil {
219 log.Fatal(err)
220 }
221 if err := cmd.Flags().MarkHidden("hide-notes"); err != nil {
222 log.Fatal(err)
223 }
224
225 if err := cmd.Flags().MarkDeprecated("render-subchart-notes", "this flag has no effect for 'helm template' and will be removed in Helm 5"); err != nil {
226 log.Fatal(err)
227 }
228 if err := cmd.Flags().MarkHidden("render-subchart-notes"); err != nil {
229 log.Fatal(err)
230 }
231 }
232
233 addValueOptionsFlags(f, valueOpts)
234 addChartPathOptionsFlags(f, &client.ChartPathOptions)
235 AddWaitFlag(cmd, &client.WaitStrategy)
236 cmd.MarkFlagsMutuallyExclusive("force-replace", "force-conflicts")
237 cmd.MarkFlagsMutuallyExclusive("force", "force-conflicts")
238
239 err := cmd.RegisterFlagCompletionFunc("version", func(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
240 requiredArgs := 2
241 if client.GenerateName {
242 requiredArgs = 1
243 }

Callers 2

newInstallCmdFunction · 0.85
newTemplateCmdFunction · 0.85

Calls 6

addValueOptionsFlagsFunction · 0.85
addChartPathOptionsFlagsFunction · 0.85
AddWaitFlagFunction · 0.85
compVersionFlagFunction · 0.85
FatalMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…