INNER CODE UNIT · Go
init
FairwindsOps/goldilocks · cmd/create.go:30
func init() {
rootCmd.AddCommand(createCmd)
createCmd.PersistentFlags().BoolVarP(&dryrun, "dry-run", "", false, "Don't actually create the VPAs, just list which ones would get created.")
createCmd.PersistentFlags().StringVarP(&nsName, "namespace", "n", "default", "Namespace to install the VPA objects in.")
}
var createCmd = &cobra.Command{
Use: "create-vpas",
Short: "Create VPAs",
Long: `Create a VPA for every workload in the specified namespace.`,
Run: func(cmd *cobra.Command, args []string) {
klog.V(4).Infof("Starting to create the VPA objects in namespace: %s", nsName)
kubeClient := kube.GetInstance()
namespace, err := kube.GetNamespace(kubeClient, nsName)
if err != nil {
fmt.Println("Error getting namespace. Exiting.")
os.Exit(1)
}