(cfg *action.Configuration, out io.Writer)
| 130 | ` |
| 131 | |
| 132 | func 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 | |
| 186 | func 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") |
no test coverage detected
searching dependent graphs…