Skip to content

Commit

Permalink
Add validations for apiServerExtraArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
sp1999 committed Mar 2, 2024
1 parent aff6a39 commit 772f9a5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/api/v1alpha1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ var clusterConfigValidations = []func(*Cluster) error{
validatePackageControllerConfiguration,
validateEksaVersion,
validateControlPlaneCertSANs,
validateControlPlaneApiServerExtraArgs,
}

// GetClusterConfig parses a Cluster object from a multiobject yaml file in disk
Expand Down Expand Up @@ -494,6 +495,16 @@ func validateControlPlaneCertSANs(cfg *Cluster) error {
return nil
}

func validateControlPlaneApiServerExtraArgs(clusterConfig *Cluster) error {

Check warning on line 498 in pkg/api/v1alpha1/cluster.go

View workflow job for this annotation

GitHub Actions / lint

var-naming: func validateControlPlaneApiServerExtraArgs should be validateControlPlaneAPIServerExtraArgs (revive)
allowedFlags := map[string]string{"service-account-issuer": "", "service-account-jwks-uri": ""}
for k := range clusterConfig.Spec.ControlPlaneConfiguration.ApiServerExtraArgs {
if _, ok := allowedFlags[k]; !ok {
return fmt.Errorf("invalid ControlPlaneConfiguration.ApiServerExtraArgs; only 'service-account-issuer' and 'service-account-jwks-uri' flags are accepted currently")
}
}
return nil
}

func validateWorkerNodeGroups(clusterConfig *Cluster) error {
workerNodeGroupConfigs := clusterConfig.Spec.WorkerNodeGroupConfigurations
if len(workerNodeGroupConfigs) <= 0 {
Expand Down

0 comments on commit 772f9a5

Please sign in to comment.