diff --git a/pkg/providers/vsphere/validator.go b/pkg/providers/vsphere/validator.go index 2f0e8a596223c..2f5eeb3b6e9d3 100644 --- a/pkg/providers/vsphere/validator.go +++ b/pkg/providers/vsphere/validator.go @@ -9,6 +9,7 @@ import ( "net" anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1" + "github.com/aws/eks-anywhere/pkg/config" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/networkutils" "github.com/aws/eks-anywhere/pkg/types" @@ -424,7 +425,7 @@ func (v *Validator) validateControlPlaneIpUniqueness(spec *Spec) error { return nil } -func (v *Validator) validateUserPrivs(ctx context.Context, spec *Spec, vuc *VSphereUserConfig) error { +func (v *Validator) validateUserPrivs(ctx context.Context, spec *Spec, vuc *config.VSphereUserConfig) error { controlPlaneMachineConfig := spec.controlPlaneMachineConfig() privObjs := []map[string]string{ @@ -485,7 +486,7 @@ func (v *Validator) validateUserPrivs(ctx context.Context, spec *Spec, vuc *VSph return v.validatePrivs(ctx, privObjs, vsc) } -func (v *Validator) validateCSIUserPrivs(ctx context.Context, spec *Spec, vuc *VSphereUserConfig) error { +func (v *Validator) validateCSIUserPrivs(ctx context.Context, spec *Spec, vuc *config.VSphereUserConfig) error { controlPlaneMachineConfig := spec.controlPlaneMachineConfig() privObjs := []map[string]string{ @@ -525,7 +526,7 @@ func (v *Validator) validateCSIUserPrivs(ctx context.Context, spec *Spec, vuc *V return v.validatePrivs(ctx, privObjs, vsc) } -func (v *Validator) validateCPUserPrivs(ctx context.Context, spec *Spec, vuc *VSphereUserConfig) error { +func (v *Validator) validateCPUserPrivs(ctx context.Context, spec *Spec, vuc *config.VSphereUserConfig) error { // CP role just needs read only privObjs := []map[string]string{ { diff --git a/pkg/providers/vsphere/vsphere.go b/pkg/providers/vsphere/vsphere.go index 38a055458399c..79341b944ee88 100644 --- a/pkg/providers/vsphere/vsphere.go +++ b/pkg/providers/vsphere/vsphere.go @@ -22,6 +22,7 @@ import ( "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/clusterapi" "github.com/aws/eks-anywhere/pkg/constants" + "github.com/aws/eks-anywhere/pkg/config" "github.com/aws/eks-anywhere/pkg/crypto" "github.com/aws/eks-anywhere/pkg/executables" "github.com/aws/eks-anywhere/pkg/filewriter" @@ -710,16 +711,8 @@ func (vs *VsphereTemplateBuilder) GenerateCAPISpecWorkers(clusterSpec *cluster.S return templater.AppendYamlResources(workerSpecs...), nil } -type VSphereUserConfig struct { - EksaVsphereUsername string - EksaVspherePassword string - EksaVsphereCPUsername string - EksaVsphereCPPassword string - EksaVsphereCSIUsername string - EksaVsphereCSIPassword string -} -func NewVsphereUserConfig() *VSphereUserConfig { +func NewVsphereUserConfig() *config.VSphereUserConfig { eksaVsphereUsername := os.Getenv(EksavSphereUsernameKey) eksaVspherePassword := os.Getenv(EksavSpherePasswordKey) @@ -739,7 +732,7 @@ func NewVsphereUserConfig() *VSphereUserConfig { eksaCSIPassword = eksaVspherePassword } - vuc := VSphereUserConfig{ + vuc := config.VSphereUserConfig{ eksaVsphereUsername, eksaVspherePassword, eksaCPUsername,