diff --git a/pkg/ctl/cmdutils/cmd.go b/pkg/ctl/cmdutils/cmd.go index c45b657cbe..5eb4841145 100644 --- a/pkg/ctl/cmdutils/cmd.go +++ b/pkg/ctl/cmdutils/cmd.go @@ -20,7 +20,7 @@ type Cmd struct { ClusterConfigFile string - ProviderConfig *api.ProviderConfig + ProviderConfig api.ProviderConfig ClusterConfig *api.ClusterConfig Include, Exclude []string @@ -58,10 +58,10 @@ func (c *Cmd) NewCtl() (*eks.ClusterProvider, error) { } } - ctl := eks.New(c.ProviderConfig, c.ClusterConfig) + ctl := eks.New(&c.ProviderConfig, c.ClusterConfig) if !ctl.IsSupportedRegion() { - return nil, ErrUnsupportedRegion(c.ProviderConfig) + return nil, ErrUnsupportedRegion(&c.ProviderConfig) } return ctl, nil @@ -71,7 +71,7 @@ func (c *Cmd) NewCtl() (*eks.ClusterProvider, error) { func AddResourceCmd(flagGrouping *FlagGrouping, parentVerbCmd *cobra.Command, newCmd func(*Cmd)) { c := &Cmd{ CobraCommand: &cobra.Command{}, - ProviderConfig: &api.ProviderConfig{}, + ProviderConfig: api.ProviderConfig{}, Plan: true, // always on by default Wait: false, // varies in some commands diff --git a/pkg/ctl/cmdutils/configfile.go b/pkg/ctl/cmdutils/configfile.go index e9d888483d..156036dc76 100644 --- a/pkg/ctl/cmdutils/configfile.go +++ b/pkg/ctl/cmdutils/configfile.go @@ -32,23 +32,22 @@ type commonClusterConfigLoader struct { flagsIncompatibleWithoutConfigFile sets.String validateWithConfigFile func() error validateWithoutConfigFile func() error - nameArgumentAllowed bool } var ( - defaultFlagsIncompatibleWithConfigFile = sets.NewString( + defaultFlagsIncompatibleWithConfigFile = [...]string{ "name", "region", "version", "cluster", "namepace", - ) - defaultFlagsIncompatibleWithoutConfigFile = sets.NewString( + } + defaultFlagsIncompatibleWithoutConfigFile = [...]string{ "only", "include", "exclude", "only-missing", - ) + } ) func newCommonClusterConfigLoader(cmd *Cmd) *commonClusterConfigLoader { @@ -58,9 +57,9 @@ func newCommonClusterConfigLoader(cmd *Cmd) *commonClusterConfigLoader { Cmd: cmd, validateWithConfigFile: nilValidatorFunc, - flagsIncompatibleWithConfigFile: defaultFlagsIncompatibleWithConfigFile, + flagsIncompatibleWithConfigFile: sets.NewString(defaultFlagsIncompatibleWithConfigFile[:]...), validateWithoutConfigFile: nilValidatorFunc, - flagsIncompatibleWithoutConfigFile: defaultFlagsIncompatibleWithoutConfigFile, + flagsIncompatibleWithoutConfigFile: sets.NewString(defaultFlagsIncompatibleWithoutConfigFile[:]...), } } @@ -99,10 +98,8 @@ func (l *commonClusterConfigLoader) Load() error { } } - if !l.nameArgumentAllowed { - if l.NameArg != "" { - return ErrCannotUseWithConfigFile(fmt.Sprintf("name argument %q", l.NameArg)) - } + if l.flagsIncompatibleWithConfigFile.Has("name") && l.NameArg != "" { + return ErrCannotUseWithConfigFile("name argument") } if meta.Name == "" { diff --git a/pkg/ctl/cmdutils/configfile_test.go b/pkg/ctl/cmdutils/configfile_test.go index ecc8a74f30..6fb5dcb916 100644 --- a/pkg/ctl/cmdutils/configfile_test.go +++ b/pkg/ctl/cmdutils/configfile_test.go @@ -1,4 +1,4 @@ -package cmdutils_test +package cmdutils import ( "path/filepath" @@ -8,7 +8,6 @@ import ( "github.com/spf13/cobra" api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5" - . "github.com/weaveworks/eksctl/pkg/ctl/cmdutils" "github.com/weaveworks/eksctl/pkg/ctl/cmdutils/filter" ) @@ -63,7 +62,7 @@ var _ = Describe("cmdutils configfile", func() { err := NewMetadataLoader(cmd).Load() Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(Equal(ErrCannotUseWithConfigFile(`name argument "foo-3"`).Error())) + Expect(err.Error()).To(Equal(ErrCannotUseWithConfigFile(`name argument`).Error())) fs := cmd.CobraCommand.Flags() @@ -79,6 +78,47 @@ var _ = Describe("cmdutils configfile", func() { } }) + Describe("name argument", func() { + When("given as --name switch", func() { + It("succeeds", func() { + cfg := api.NewClusterConfig() + cobraCmd := newCmd() + name := "foo-2" + cobraCmd.SetArgs([]string{"--name", name}) + + cmd := &Cmd{ + ClusterConfig: cfg, + NameArg: name, + CobraCommand: cobraCmd, + ClusterConfigFile: examplesDir + "01-simple-cluster.yaml", + ProviderConfig: api.ProviderConfig{}, + } + l := newCommonClusterConfigLoader(cmd) + l.flagsIncompatibleWithConfigFile.Delete("name") + + err := l.Load() + Expect(err).ToNot(HaveOccurred()) + }) + }) + When("given as positional argument", func() { + It("succeeds", func() { + cfg := api.NewClusterConfig() + cmd := &Cmd{ + ClusterConfig: cfg, + NameArg: "foo-2", + CobraCommand: newCmd(), + ClusterConfigFile: examplesDir + "01-simple-cluster.yaml", + ProviderConfig: api.ProviderConfig{}, + } + l := newCommonClusterConfigLoader(cmd) + l.flagsIncompatibleWithConfigFile.Delete("name") + + err := l.Load() + Expect(err).ToNot(HaveOccurred()) + }) + }) + }) + It("load all of example file", func() { examples, err := filepath.Glob(examplesDir + "*.yaml") Expect(err).ToNot(HaveOccurred()) @@ -89,7 +129,7 @@ var _ = Describe("cmdutils configfile", func() { CobraCommand: newCmd(), ClusterConfigFile: example, ClusterConfig: api.NewClusterConfig(), - ProviderConfig: &api.ProviderConfig{}, + ProviderConfig: api.ProviderConfig{}, } err := NewMetadataLoader(cmd).Load() @@ -122,7 +162,7 @@ var _ = Describe("cmdutils configfile", func() { CobraCommand: newCmd(), ClusterConfigFile: filepath.Join(examplesDir, natTest.configFile), ClusterConfig: api.NewClusterConfig(), - ProviderConfig: &api.ProviderConfig{}, + ProviderConfig: api.ProviderConfig{}, } params := &CreateClusterCmdParams{WithoutNodeGroup: true, Managed: false} @@ -172,7 +212,7 @@ var _ = Describe("cmdutils configfile", func() { cmd := &Cmd{ CobraCommand: newCmd(), ClusterConfig: api.NewClusterConfig(), - ProviderConfig: &api.ProviderConfig{}, + ProviderConfig: api.ProviderConfig{}, } ngFilter := filter.NewNodeGroupFilter() @@ -236,7 +276,7 @@ var _ = Describe("cmdutils configfile", func() { CobraCommand: newCmd(), ClusterConfigFile: filepath.Join(examplesDir, loaderTest.configFile), ClusterConfig: api.NewClusterConfig(), - ProviderConfig: &api.ProviderConfig{}, + ProviderConfig: api.ProviderConfig{}, } ngFilter := filter.NewNodeGroupFilter() @@ -270,7 +310,7 @@ var _ = Describe("cmdutils configfile", func() { CobraCommand: newCmd(), ClusterConfigFile: configFilePath, ClusterConfig: api.NewClusterConfig(), - ProviderConfig: &api.ProviderConfig{}, + ProviderConfig: api.ProviderConfig{}, } params := &CreateClusterCmdParams{ diff --git a/pkg/ctl/cmdutils/fargate.go b/pkg/ctl/cmdutils/fargate.go index 4a2117d5d8..8a8161ee97 100644 --- a/pkg/ctl/cmdutils/fargate.go +++ b/pkg/ctl/cmdutils/fargate.go @@ -116,7 +116,7 @@ func NewGetFargateProfileLoader(cmd *Cmd, options *fargate.Options) ClusterConfi func flagsIncompatibleWithConfigFileExcept(items ...string) sets.String { set := sets.NewString(fargateProfileFlagsIncompatibleWithConfigFile...) - set = set.Union(defaultFlagsIncompatibleWithConfigFile) + set = set.Union(sets.NewString(defaultFlagsIncompatibleWithConfigFile[:]...)) set.Delete(items...) return set } diff --git a/pkg/ctl/cmdutils/scale.go b/pkg/ctl/cmdutils/scale.go index 7e3da477bd..f204b4dcc0 100644 --- a/pkg/ctl/cmdutils/scale.go +++ b/pkg/ctl/cmdutils/scale.go @@ -9,13 +9,13 @@ import ( // NewScaleNodeGroupLoader will load config or use flags for 'eksctl scale nodegroup' func NewScaleNodeGroupLoader(cmd *Cmd, ng *api.NodeGroup) ClusterConfigLoader { l := newCommonClusterConfigLoader(cmd) - l.nameArgumentAllowed = true l.flagsIncompatibleWithConfigFile.Insert( "nodes", "nodes-min", "nodes-max", ) + l.flagsIncompatibleWithConfigFile.Delete("name") l.validateWithConfigFile = func() error { if err := validateNameArgument(cmd, ng); err != nil { diff --git a/pkg/ctl/cmdutils/scale_test.go b/pkg/ctl/cmdutils/scale_test.go index ed865b1b62..b02cc6cf71 100644 --- a/pkg/ctl/cmdutils/scale_test.go +++ b/pkg/ctl/cmdutils/scale_test.go @@ -31,7 +31,7 @@ var _ = Describe("scale node group config file loader", func() { CobraCommand: newCmd(), ClusterConfigFile: "test_data/scale-ng-test.yaml", ClusterConfig: api.NewClusterConfig(), - ProviderConfig: &api.ProviderConfig{}, + ProviderConfig: api.ProviderConfig{}, NameArg: params.name, } diff --git a/pkg/ctl/create/cluster.go b/pkg/ctl/create/cluster.go index 43d7facaa1..86e642a61b 100644 --- a/pkg/ctl/create/cluster.go +++ b/pkg/ctl/create/cluster.go @@ -51,7 +51,7 @@ func createClusterCmdWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd *cmdutils.C cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVarP(&cfg.Metadata.Name, "name", "n", "", fmt.Sprintf("EKS cluster name (generated if unspecified, e.g. %q)", exampleClusterName)) cmdutils.AddStringToStringVarPFlag(fs, &cfg.Metadata.Tags, "tags", "", map[string]string{}, "Used to tag the AWS resources") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) fs.StringSliceVar(¶ms.AvailabilityZones, "zones", nil, "(auto-select if unspecified)") cmdutils.AddVersionFlag(fs, cfg.Metadata, "") cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) @@ -82,7 +82,7 @@ func createClusterCmdWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd *cmdutils.C fs.StringVar(cfg.VPC.NAT.Gateway, "vpc-nat-mode", api.ClusterSingleNAT, "VPC NAT mode, valid options: HighlyAvailable, Single, Disable") }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, true) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, true) cmd.FlagSetGroup.InFlagSet("Output kubeconfig", func(fs *pflag.FlagSet) { cmdutils.AddCommonFlagsForKubeconfig(fs, ¶ms.KubeconfigPath, ¶ms.AuthenticatorRoleARN, ¶ms.SetContext, ¶ms.AutoKubeconfigPath, exampleClusterName) diff --git a/pkg/ctl/create/fargate.go b/pkg/ctl/create/fargate.go index 76663ffc4b..67a31ca765 100644 --- a/pkg/ctl/create/fargate.go +++ b/pkg/ctl/create/fargate.go @@ -41,11 +41,11 @@ func configureCreateFargateProfileCmd(cmd *cmdutils.Cmd) *fargate.CreateOptions }) cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlag(fs, cmd.ClusterConfig.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) return &options } diff --git a/pkg/ctl/create/iamidentitymapping.go b/pkg/ctl/create/iamidentitymapping.go index ef3fac75f3..721ea01409 100644 --- a/pkg/ctl/create/iamidentitymapping.go +++ b/pkg/ctl/create/iamidentitymapping.go @@ -39,12 +39,12 @@ func createIAMIdentityMappingCmd(cmd *cmdutils.Cmd) { fs.StringArrayVar(&groups, "group", []string{}, "Group within Kubernetes to which IAM role is mapped") cmdutils.AddIAMIdentityMappingARNFlags(fs, cmd, &arn) cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doCreateIAMIdentityMapping(cmd *cmdutils.Cmd, arn string, username string, groups []string) error { diff --git a/pkg/ctl/create/iamserviceaccount.go b/pkg/ctl/create/iamserviceaccount.go index e817953a0d..3c7e1ca808 100644 --- a/pkg/ctl/create/iamserviceaccount.go +++ b/pkg/ctl/create/iamserviceaccount.go @@ -52,12 +52,12 @@ func createIAMServiceAccountCmdWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd * cmdutils.AddIAMServiceAccountFilterFlags(fs, &cmd.Include, &cmd.Exclude) cmdutils.AddApproveFlag(fs, cmd) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, true) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, true) } func doCreateIAMServiceAccount(cmd *cmdutils.Cmd, overrideExistingServiceAccounts bool) error { diff --git a/pkg/ctl/create/nodegroup.go b/pkg/ctl/create/nodegroup.go index 41686077f6..93f18ab268 100644 --- a/pkg/ctl/create/nodegroup.go +++ b/pkg/ctl/create/nodegroup.go @@ -53,7 +53,7 @@ func createNodeGroupCmdWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd *cmdutils cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVar(&cfg.Metadata.Name, "cluster", "", "name of the EKS cluster to add the nodegroup to") cmdutils.AddStringToStringVarPFlag(fs, &cfg.Metadata.Tags, "tags", "", map[string]string{}, "Used to tag the AWS resources") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddVersionFlag(fs, cfg.Metadata, `for nodegroups "auto" and "latest" can be used to automatically inherit version from the control plane or force latest`) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddNodeGroupFilterFlags(fs, &cmd.Include, &cmd.Exclude) @@ -72,7 +72,7 @@ func createNodeGroupCmdWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd *cmdutils fs.BoolVarP(¶ms.installNeuronDevicePlugin, "install-neuron-plugin", "", true, "Install Neuron plugin for Inferentia nodes") }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, true) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, true) } func doCreateNodeGroups(cmd *cmdutils.Cmd, ng *api.NodeGroup, params createNodeGroupParams) error { diff --git a/pkg/ctl/delete/cluster.go b/pkg/ctl/delete/cluster.go index 3e73a61298..ab7e6bee72 100644 --- a/pkg/ctl/delete/cluster.go +++ b/pkg/ctl/delete/cluster.go @@ -38,7 +38,7 @@ func deleteClusterCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVarP(&cfg.Metadata.Name, "name", "n", "", "EKS cluster name") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmd.Wait = false cmdutils.AddWaitFlag(fs, &cmd.Wait, "deletion of all resources") @@ -47,7 +47,7 @@ func deleteClusterCmd(cmd *cmdutils.Cmd) { cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, true) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, true) } func handleErrors(errs []error, subject string) error { diff --git a/pkg/ctl/delete/fargate.go b/pkg/ctl/delete/fargate.go index b56a952801..187be7f970 100644 --- a/pkg/ctl/delete/fargate.go +++ b/pkg/ctl/delete/fargate.go @@ -41,12 +41,12 @@ func configureDeleteFargateProfileCmd(cmd *cmdutils.Cmd) *fargate.Options { }) cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlag(fs, cmd.ClusterConfig.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddWaitFlag(fs, &cmd.Wait, "wait for the deletion of the Fargate profile, which may take from a couple seconds to a couple minutes.") cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) return &opts } diff --git a/pkg/ctl/delete/iamidentitymapping.go b/pkg/ctl/delete/iamidentitymapping.go index df139fb7eb..dc727874af 100644 --- a/pkg/ctl/delete/iamidentitymapping.go +++ b/pkg/ctl/delete/iamidentitymapping.go @@ -29,12 +29,12 @@ func deleteIAMIdentityMappingCmd(cmd *cmdutils.Cmd) { fs.BoolVar(&all, "all", false, "Delete all matching mappings instead of just one") cmdutils.AddIAMIdentityMappingARNFlags(fs, cmd, &arn) cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doDeleteIAMIdentityMapping(cmd *cmdutils.Cmd, arn string, all bool) error { diff --git a/pkg/ctl/delete/iamserviceaccount.go b/pkg/ctl/delete/iamserviceaccount.go index 257f3c6723..36e96e84e3 100644 --- a/pkg/ctl/delete/iamserviceaccount.go +++ b/pkg/ctl/delete/iamserviceaccount.go @@ -47,7 +47,7 @@ func deleteIAMServiceAccountCmdWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd * cmdutils.AddIAMServiceAccountFilterFlags(fs, &cmd.Include, &cmd.Exclude) fs.BoolVar(&onlyMissing, "only-missing", false, "Only delete nodegroups that are not defined in the given config file") cmdutils.AddApproveFlag(fs, cmd) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmd.Wait = false @@ -55,7 +55,7 @@ func deleteIAMServiceAccountCmdWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd * cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, true) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, true) } func doDeleteIAMServiceAccount(cmd *cmdutils.Cmd, serviceAccount *api.ClusterIAMServiceAccount, onlyMissing bool) error { diff --git a/pkg/ctl/delete/nodegroup.go b/pkg/ctl/delete/nodegroup.go index 5067819607..9e071cd4f3 100644 --- a/pkg/ctl/delete/nodegroup.go +++ b/pkg/ctl/delete/nodegroup.go @@ -34,7 +34,7 @@ func deleteNodeGroupWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd *cmdutils.Cm cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVar(&cfg.Metadata.Name, "cluster", "", "EKS cluster name") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) fs.StringVarP(&ng.Name, "name", "n", "", "Name of the nodegroup to delete") cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddApproveFlag(fs, cmd) @@ -48,7 +48,7 @@ func deleteNodeGroupWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd *cmdutils.Cm cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, true) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, true) } func doDeleteNodeGroup(cmd *cmdutils.Cmd, ng *api.NodeGroup, updateAuthConfigMap, deleteNodeGroupDrain, onlyMissing bool) error { diff --git a/pkg/ctl/drain/nodegroup.go b/pkg/ctl/drain/nodegroup.go index ad3c5ff6f2..1d2af1a2b4 100644 --- a/pkg/ctl/drain/nodegroup.go +++ b/pkg/ctl/drain/nodegroup.go @@ -34,7 +34,7 @@ func drainNodeGroupWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd *cmdutils.Cmd cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVar(&cfg.Metadata.Name, "cluster", "", "EKS cluster name") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) fs.StringVarP(&ng.Name, "name", "n", "", "Name of the nodegroup to delete") cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddApproveFlag(fs, cmd) @@ -44,7 +44,7 @@ func drainNodeGroupWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd *cmdutils.Cmd cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, true) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, true) } func doDrainNodeGroup(cmd *cmdutils.Cmd, ng *api.NodeGroup, undo, onlyMissing bool) error { diff --git a/pkg/ctl/enable/profile.go b/pkg/ctl/enable/profile.go index 2d0dd36a4e..f461c5f732 100644 --- a/pkg/ctl/enable/profile.go +++ b/pkg/ctl/enable/profile.go @@ -49,11 +49,11 @@ func configureProfileCmd(cmd *cmdutils.Cmd) *api.Git { }) cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVar(&cmd.ClusterConfig.Metadata.Name, "cluster", "", "name of the EKS cluster to enable this Quick Start profile on") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddTimeoutFlagWithValue(fs, &cmd.ProviderConfig.WaitTimeout, 20*time.Second) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) return opts } diff --git a/pkg/ctl/enable/repo.go b/pkg/ctl/enable/repo.go index 3795c16991..587ee1d9ca 100644 --- a/pkg/ctl/enable/repo.go +++ b/pkg/ctl/enable/repo.go @@ -58,11 +58,11 @@ func configureRepositoryCmd(cmd *cmdutils.Cmd) *options { }) cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVar(&cmd.ClusterConfig.Metadata.Name, "cluster", "", "name of the EKS cluster to enable gitops on") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddTimeoutFlagWithValue(fs, &opts.timeout, gitops.DefaultPodReadyTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) return &opts } diff --git a/pkg/ctl/generate/profile.go b/pkg/ctl/generate/profile.go index 835f846342..5798a0b4e2 100644 --- a/pkg/ctl/generate/profile.go +++ b/pkg/ctl/generate/profile.go @@ -46,11 +46,11 @@ func configureGenerateProfileCmd(cmd *cmdutils.Cmd) *api.Git { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVar(&cmd.ClusterConfig.Metadata.Name, "cluster", "", "name of the EKS cluster to enable gitops on") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) return opts } diff --git a/pkg/ctl/get/cluster.go b/pkg/ctl/get/cluster.go index 02e47dd92f..a228485413 100644 --- a/pkg/ctl/get/cluster.go +++ b/pkg/ctl/get/cluster.go @@ -28,12 +28,12 @@ func getClusterCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVarP(&cfg.Metadata.Name, "name", "n", "", "EKS cluster name") fs.BoolVarP(&listAllRegions, "all-regions", "A", false, "List clusters across all supported regions") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddCommonFlagsForGetCmd(fs, ¶ms.chunkSize, ¶ms.output) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doGetCluster(cmd *cmdutils.Cmd, params *getCmdParams, listAllRegions bool) error { diff --git a/pkg/ctl/get/fargate.go b/pkg/ctl/get/fargate.go index aa9a4a03e5..1825467333 100644 --- a/pkg/ctl/get/fargate.go +++ b/pkg/ctl/get/fargate.go @@ -47,12 +47,12 @@ func configureGetFargateProfileCmd(cmd *cmdutils.Cmd) *options { }) cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlag(fs, cmd.ClusterConfig.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) cmdutils.AddCommonFlagsForGetCmd(fs, &options.chunkSize, &options.output) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) return &options } diff --git a/pkg/ctl/get/iamidentitymapping.go b/pkg/ctl/get/iamidentitymapping.go index 8b295acfa1..9b0c0b2ac7 100644 --- a/pkg/ctl/get/iamidentitymapping.go +++ b/pkg/ctl/get/iamidentitymapping.go @@ -33,13 +33,13 @@ func getIAMIdentityMappingCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddIAMIdentityMappingARNFlags(fs, cmd, &arn) cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddCommonFlagsForGetCmd(fs, ¶ms.chunkSize, ¶ms.output) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doGetIAMIdentityMapping(cmd *cmdutils.Cmd, params *getCmdParams, arn string) error { diff --git a/pkg/ctl/get/iamserviceaccount.go b/pkg/ctl/get/iamserviceaccount.go index 0a7a5f8a21..cf59251308 100644 --- a/pkg/ctl/get/iamserviceaccount.go +++ b/pkg/ctl/get/iamserviceaccount.go @@ -39,14 +39,14 @@ func getIAMServiceAccountCmd(cmd *cmdutils.Cmd) { fs.StringVar(&serviceAccount.Name, "name", "", "name of the iamserviceaccount to delete") fs.StringVar(&serviceAccount.Namespace, "namespace", "default", "namespace where to delete the iamserviceaccount") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddCommonFlagsForGetCmd(fs, ¶ms.chunkSize, ¶ms.output) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doGetIAMServiceAccount(cmd *cmdutils.Cmd, serviceAccount *api.ClusterIAMServiceAccount, params *getCmdParams) error { diff --git a/pkg/ctl/get/labels.go b/pkg/ctl/get/labels.go index 8ab5c013ad..da1be67237 100644 --- a/pkg/ctl/get/labels.go +++ b/pkg/ctl/get/labels.go @@ -31,11 +31,11 @@ func getLabelsCmd(cmd *cmdutils.Cmd) { fs.StringVar(&cfg.Metadata.Name, "cluster", "", "EKS cluster name") fs.StringVarP(&nodeGroupName, "nodegroup", "n", "", "Nodegroup name") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } @@ -55,7 +55,7 @@ func getLabels(cmd *cmdutils.Cmd, nodeGroupName string) error { return cmdutils.ErrUnsupportedNameArg() } - ctl := eks.New(cmd.ProviderConfig, cmd.ClusterConfig) + ctl := eks.New(&cmd.ProviderConfig, cmd.ClusterConfig) if err := ctl.CheckAuth(); err != nil { return err diff --git a/pkg/ctl/get/nodegroup.go b/pkg/ctl/get/nodegroup.go index fe29b0408b..69afc624cf 100644 --- a/pkg/ctl/get/nodegroup.go +++ b/pkg/ctl/get/nodegroup.go @@ -32,12 +32,12 @@ func getNodeGroupCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVar(&cfg.Metadata.Name, "cluster", "", "EKS cluster name") fs.StringVarP(&ng.Name, "name", "n", "", "Name of the nodegroup") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddCommonFlagsForGetCmd(fs, ¶ms.chunkSize, ¶ms.output) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doGetNodeGroup(cmd *cmdutils.Cmd, ng *api.NodeGroup, params *getCmdParams) error { diff --git a/pkg/ctl/scale/nodegroup.go b/pkg/ctl/scale/nodegroup.go index 8c7fdf8a34..0c160ecd1a 100644 --- a/pkg/ctl/scale/nodegroup.go +++ b/pkg/ctl/scale/nodegroup.go @@ -49,11 +49,11 @@ func scaleNodeGroupWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd *cmdutils.Cmd } }) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, true) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, true) } func doScaleNodeGroup(cmd *cmdutils.Cmd, ng *api.NodeGroup) error { diff --git a/pkg/ctl/set/labels.go b/pkg/ctl/set/labels.go index 27aee07194..14d7f10cf9 100644 --- a/pkg/ctl/set/labels.go +++ b/pkg/ctl/set/labels.go @@ -34,11 +34,11 @@ func setLabelsCmd(cmd *cmdutils.Cmd) { cmdutils.AddStringToStringVarPFlag(fs, &options.labels, "labels", "l", nil, "Labels") _ = cobra.MarkFlagRequired(fs, "labels") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } @@ -52,7 +52,7 @@ func setLabels(cmd *cmdutils.Cmd, options labelOptions) error { return cmdutils.ErrUnsupportedNameArg() } - ctl := eks.New(cmd.ProviderConfig, cmd.ClusterConfig) + ctl := eks.New(&cmd.ProviderConfig, cmd.ClusterConfig) if err := ctl.CheckAuth(); err != nil { return err diff --git a/pkg/ctl/unset/labels.go b/pkg/ctl/unset/labels.go index 85931c0bf0..4911bc605a 100644 --- a/pkg/ctl/unset/labels.go +++ b/pkg/ctl/unset/labels.go @@ -33,11 +33,11 @@ func unsetLabelsCmd(cmd *cmdutils.Cmd) { _ = cobra.MarkFlagRequired(fs, "labels") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } @@ -51,7 +51,7 @@ func unsetLabels(cmd *cmdutils.Cmd, nodeGroupName string, removeLabels []string) return cmdutils.ErrUnsupportedNameArg() } - ctl := eks.New(cmd.ProviderConfig, cmd.ClusterConfig) + ctl := eks.New(&cmd.ProviderConfig, cmd.ClusterConfig) if err := ctl.CheckAuth(); err != nil { return err diff --git a/pkg/ctl/update/cluster.go b/pkg/ctl/update/cluster.go index df14e74dfe..2b3f587dd1 100644 --- a/pkg/ctl/update/cluster.go +++ b/pkg/ctl/update/cluster.go @@ -21,11 +21,11 @@ func updateClusterCmd(cmd *cmdutils.Cmd) { cmd.SetDescription("cluster", "DEPRECATED: use 'upgrade cluster' instead. Upgrade control plane to the next version. ", "DEPRECATED: use 'upgrade cluster' instead. Upgrade control plane to the next Kubernetes version if available. Will also perform any updates needed in the cluster stack if resources are missing.") - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVarP(&cfg.Metadata.Name, "name", "n", "", "EKS cluster name") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddVersionFlag(fs, cfg.Metadata, "") cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) diff --git a/pkg/ctl/upgrade/cluster.go b/pkg/ctl/upgrade/cluster.go index 7c76daafc0..65d7cde3aa 100644 --- a/pkg/ctl/upgrade/cluster.go +++ b/pkg/ctl/upgrade/cluster.go @@ -28,11 +28,11 @@ func upgradeClusterWithRunFunc(cmd *cmdutils.Cmd, runFunc func(cmd *cmdutils.Cmd cmd.SetDescription("cluster", "Upgrade control plane to the next version", "Upgrade control plane to the next Kubernetes version if available. Will also perform any updates needed in the cluster stack if resources are missing.") - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { fs.StringVarP(&cfg.Metadata.Name, "name", "n", "", "EKS cluster name") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddVersionFlag(fs, cfg.Metadata, "") cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) diff --git a/pkg/ctl/upgrade/nodegroup.go b/pkg/ctl/upgrade/nodegroup.go index 18c35b334c..2d1689745a 100644 --- a/pkg/ctl/upgrade/nodegroup.go +++ b/pkg/ctl/upgrade/nodegroup.go @@ -34,7 +34,7 @@ func upgradeNodeGroupCmd(cmd *cmdutils.Cmd) { fs.StringVarP(&cfg.Metadata.Name, "cluster", "", "", "EKS cluster name") fs.StringVarP(&options.nodeGroupName, "name", "", "", "Nodegroup name") fs.StringVarP(&options.kubernetesVersion, "kubernetes-version", "", "", "Kubernetes version") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmd.Wait = true cmdutils.AddWaitFlag(fs, &cmd.Wait, "nodegroup upgrade to complete") @@ -43,7 +43,7 @@ func upgradeNodeGroupCmd(cmd *cmdutils.Cmd) { cmdutils.AddTimeoutFlagWithValue(fs, &cmd.ProviderConfig.WaitTimeout, 35*time.Minute) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } @@ -65,7 +65,7 @@ func upgradeNodeGroup(cmd *cmdutils.Cmd, options upgradeOptions) error { return cmdutils.ErrMustBeSet("name") } - ctl := eks.New(cmd.ProviderConfig, cmd.ClusterConfig) + ctl := eks.New(&cmd.ProviderConfig, cmd.ClusterConfig) if err := ctl.CheckAuth(); err != nil { return err diff --git a/pkg/ctl/utils/associate_iam_oidc_provider.go b/pkg/ctl/utils/associate_iam_oidc_provider.go index 2745c9fe0e..d8b12c5c1b 100644 --- a/pkg/ctl/utils/associate_iam_oidc_provider.go +++ b/pkg/ctl/utils/associate_iam_oidc_provider.go @@ -23,12 +23,12 @@ func associateIAMOIDCProviderCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddApproveFlag(fs, cmd) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doAssociateIAMOIDCProvider(cmd *cmdutils.Cmd) error { diff --git a/pkg/ctl/utils/describe_stacks.go b/pkg/ctl/utils/describe_stacks.go index e848d5bc82..3c1c5a2a5d 100644 --- a/pkg/ctl/utils/describe_stacks.go +++ b/pkg/ctl/utils/describe_stacks.go @@ -25,14 +25,14 @@ func describeStacksCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) fs.BoolVar(&all, "all", false, "include deleted stacks") fs.BoolVar(&events, "events", false, "include stack events") fs.BoolVar(&trail, "trail", false, "lookup CloudTrail events for the cluster") cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doDescribeStacksCmd(cmd *cmdutils.Cmd, all, events, trail bool) error { diff --git a/pkg/ctl/utils/install_vpc_controllers.go b/pkg/ctl/utils/install_vpc_controllers.go index b218014b13..add570d1ae 100644 --- a/pkg/ctl/utils/install_vpc_controllers.go +++ b/pkg/ctl/utils/install_vpc_controllers.go @@ -24,13 +24,13 @@ func installWindowsVPCController(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddApproveFlag(fs, cmd) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doInstallWindowsVPCController(cmd *cmdutils.Cmd) error { diff --git a/pkg/ctl/utils/nodegroup_health.go b/pkg/ctl/utils/nodegroup_health.go index daf82ceda6..73242a7145 100644 --- a/pkg/ctl/utils/nodegroup_health.go +++ b/pkg/ctl/utils/nodegroup_health.go @@ -29,18 +29,18 @@ func nodeGroupHealthCmd(cmd *cmdutils.Cmd) { fs.StringVar(&cfg.Metadata.Name, "cluster", "", "EKS cluster name") fs.StringVarP(&nodeGroupName, "name", "n", "", "Name of the nodegroup") - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func getNodeGroupHealth(cmd *cmdutils.Cmd, nodeGroupName string) error { cfg := cmd.ClusterConfig - ctl := eks.New(cmd.ProviderConfig, cmd.ClusterConfig) + ctl := eks.New(&cmd.ProviderConfig, cmd.ClusterConfig) if err := ctl.CheckAuth(); err != nil { return err diff --git a/pkg/ctl/utils/set_public_access_cidrs.go b/pkg/ctl/utils/set_public_access_cidrs.go index 0182b2d408..c80d219e04 100644 --- a/pkg/ctl/utils/set_public_access_cidrs.go +++ b/pkg/ctl/utils/set_public_access_cidrs.go @@ -27,13 +27,13 @@ func publicAccessCIDRsCmdWithHandler(cmd *cmdutils.Cmd, handler func(cmd *cmduti cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlag(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddApproveFlag(fs, cmd) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func publicAccessCIDRsCmd(cmd *cmdutils.Cmd) { diff --git a/pkg/ctl/utils/update_aws_node.go b/pkg/ctl/utils/update_aws_node.go index 0567b2e97d..dd94392892 100644 --- a/pkg/ctl/utils/update_aws_node.go +++ b/pkg/ctl/utils/update_aws_node.go @@ -22,13 +22,13 @@ func updateAWSNodeCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddApproveFlag(fs, cmd) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doUpdateAWSNode(cmd *cmdutils.Cmd) error { diff --git a/pkg/ctl/utils/update_cluster_endpoint_access.go b/pkg/ctl/utils/update_cluster_endpoint_access.go index c5fd5b9b87..e556235530 100644 --- a/pkg/ctl/utils/update_cluster_endpoint_access.go +++ b/pkg/ctl/utils/update_cluster_endpoint_access.go @@ -26,7 +26,7 @@ func updateClusterEndpointsCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddApproveFlag(fs, cmd) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) @@ -37,7 +37,7 @@ func updateClusterEndpointsCmd(cmd *cmdutils.Cmd) { fs.BoolVar(&private, "private-access", false, "access for private (VPC) clients") fs.BoolVar(&public, "public-access", false, "access for public clients") }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doUpdateClusterEndpoints(cmd *cmdutils.Cmd, newPrivate bool, newPublic bool) error { diff --git a/pkg/ctl/utils/update_cluster_logging.go b/pkg/ctl/utils/update_cluster_logging.go index a674c92a2c..eab1405acf 100644 --- a/pkg/ctl/utils/update_cluster_logging.go +++ b/pkg/ctl/utils/update_cluster_logging.go @@ -30,7 +30,7 @@ func enableLoggingCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddApproveFlag(fs, cmd) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) @@ -44,7 +44,7 @@ func enableLoggingCmd(cmd *cmdutils.Cmd) { }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doEnableLogging(cmd *cmdutils.Cmd, logTypesToEnable []string, logTypesToDisable []string) error { diff --git a/pkg/ctl/utils/update_coredns.go b/pkg/ctl/utils/update_coredns.go index 8b82a1fb6a..e0f63b0f65 100644 --- a/pkg/ctl/utils/update_coredns.go +++ b/pkg/ctl/utils/update_coredns.go @@ -22,13 +22,13 @@ func updateCoreDNSCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddApproveFlag(fs, cmd) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doUpdateCoreDNS(cmd *cmdutils.Cmd) error { diff --git a/pkg/ctl/utils/update_kube_proxy.go b/pkg/ctl/utils/update_kube_proxy.go index d9b53442d8..2c9bed4c52 100644 --- a/pkg/ctl/utils/update_kube_proxy.go +++ b/pkg/ctl/utils/update_kube_proxy.go @@ -22,13 +22,13 @@ func updateKubeProxyCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddConfigFileFlag(fs, &cmd.ClusterConfigFile) cmdutils.AddApproveFlag(fs, cmd) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doUpdateKubeProxy(cmd *cmdutils.Cmd) error { diff --git a/pkg/ctl/utils/update_legacy_subnet_settings.go b/pkg/ctl/utils/update_legacy_subnet_settings.go index b42859a08e..f309049783 100644 --- a/pkg/ctl/utils/update_legacy_subnet_settings.go +++ b/pkg/ctl/utils/update_legacy_subnet_settings.go @@ -24,11 +24,11 @@ func updateLegacySubnetSettings(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doUpdateLegacySubnetSettings(cmd *cmdutils.Cmd) error { diff --git a/pkg/ctl/utils/wait_nodes.go b/pkg/ctl/utils/wait_nodes.go index ac8e8e84b0..3908094599 100644 --- a/pkg/ctl/utils/wait_nodes.go +++ b/pkg/ctl/utils/wait_nodes.go @@ -41,7 +41,7 @@ func waitNodesCmd(cmd *cmdutils.Cmd) { func doWaitNodes(cmd *cmdutils.Cmd, ng *api.NodeGroup, kubeconfigPath string) error { cfg := cmd.ClusterConfig - ctl := eks.New(cmd.ProviderConfig, cfg) + ctl := eks.New(&cmd.ProviderConfig, cfg) if kubeconfigPath == "" { return cmdutils.ErrMustBeSet("--kubeconfig") diff --git a/pkg/ctl/utils/write_kubeconfig.go b/pkg/ctl/utils/write_kubeconfig.go index 89d1a31e31..8e05513f66 100644 --- a/pkg/ctl/utils/write_kubeconfig.go +++ b/pkg/ctl/utils/write_kubeconfig.go @@ -32,7 +32,7 @@ func writeKubeconfigCmd(cmd *cmdutils.Cmd) { cmd.FlagSetGroup.InFlagSet("General", func(fs *pflag.FlagSet) { cmdutils.AddClusterFlagWithDeprecated(fs, cfg.Metadata) - cmdutils.AddRegionFlag(fs, cmd.ProviderConfig) + cmdutils.AddRegionFlag(fs, &cmd.ProviderConfig) cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout) }) @@ -40,7 +40,7 @@ func writeKubeconfigCmd(cmd *cmdutils.Cmd) { cmdutils.AddCommonFlagsForKubeconfig(fs, &outputPath, &authenticatorRoleARN, &setContext, &autoPath, "") }) - cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, cmd.ProviderConfig, false) + cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false) } func doWriteKubeconfigCmd(cmd *cmdutils.Cmd, outputPath, roleARN string, setContext, autoPath bool) error {