MCPcopy
hub / github.com/helm/helm / newInstallCmd

Function newInstallCmd

pkg/cmd/install.go:132–184  ·  view source on GitHub ↗
(cfg *action.Configuration, out io.Writer)

Source from the content-addressed store, hash-verified

130`
131
132func newInstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
133 client := action.NewInstall(cfg)
134 valueOpts := &values.Options{}
135 var outfmt output.Format
136
137 cmd := &cobra.Command{
138 Use: "install [NAME] [CHART]",
139 Short: "install a chart",
140 Long: installDesc,
141 Args: require.MinimumNArgs(1),
142 ValidArgsFunction: func(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
143 return compInstall(args, toComplete, client)
144 },
145 RunE: func(cmd *cobra.Command, args []string) error {
146 registryClient, err := newRegistryClient(out, client.CertFile, client.KeyFile, client.CaFile,
147 client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password)
148 if err != nil {
149 return fmt.Errorf("missing registry client: %w", err)
150 }
151 client.SetRegistryClient(registryClient)
152
153 dryRunStrategy, err := cmdGetDryRunFlagStrategy(cmd, false)
154 if err != nil {
155 return err
156 }
157 client.DryRunStrategy = dryRunStrategy
158
159 rel, err := runInstall(args, client, valueOpts, out)
160 if err != nil {
161 return fmt.Errorf("INSTALLATION FAILED: %w", err)
162 }
163
164 return outfmt.Write(out, &statusPrinter{
165 release: rel,
166 debug: settings.Debug,
167 showMetadata: false,
168 hideNotes: client.HideNotes,
169 noColor: settings.ShouldDisableColor(),
170 })
171 },
172 }
173
174 f := cmd.Flags()
175 addInstallFlags(cmd, f, client, valueOpts)
176 // hide-secret is not available in all places the install flags are used so
177 // it is added separately
178 f.BoolVar(&client.HideSecret, "hide-secret", false, "hide Kubernetes Secrets when also using the --dry-run flag")
179 addDryRunFlag(cmd)
180 bindOutputFlag(cmd, &outfmt)
181 bindPostRenderFlag(cmd, &client.PostRenderer, settings)
182
183 return cmd
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")

Callers 1

newRootCmdWithConfigFunction · 0.85

Calls 13

SetRegistryClientMethod · 0.95
WriteMethod · 0.95
NewInstallFunction · 0.92
MinimumNArgsFunction · 0.92
compInstallFunction · 0.85
newRegistryClientFunction · 0.85
cmdGetDryRunFlagStrategyFunction · 0.85
runInstallFunction · 0.85
addInstallFlagsFunction · 0.85
addDryRunFlagFunction · 0.85
bindOutputFlagFunction · 0.85
bindPostRenderFlagFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…