From 443db142b4c81fa6e60772a36640c1d00314c1c8 Mon Sep 17 00:00:00 2001 From: Saurabh Parekh Date: Thu, 14 Mar 2024 12:41:20 -0700 Subject: [PATCH] Revert "Allow users to skip api server extra args preflight validation" This reverts commit e4b9ef4816a5622fa2cb2d21fab23be9f1bf8ba0. --- .../createvalidations/createvalidations.go | 1 - .../createvalidations/preflightvalidations.go | 11 ----------- pkg/validations/skipvalidations.go | 7 +++---- pkg/validations/skipvalidations_test.go | 10 ++++------ .../upgradevalidations/preflightvalidations.go | 11 ----------- .../upgradevalidations/upgradevalidations.go | 1 - 6 files changed, 7 insertions(+), 34 deletions(-) diff --git a/pkg/validations/createvalidations/createvalidations.go b/pkg/validations/createvalidations/createvalidations.go index 61489db582b8a..a42049530fdc4 100644 --- a/pkg/validations/createvalidations/createvalidations.go +++ b/pkg/validations/createvalidations/createvalidations.go @@ -7,7 +7,6 @@ import ( // SkippableValidations represents all the validations we offer for users to skip. var SkippableValidations = []string{ validations.VSphereUserPriv, - validations.APIServerExtraArgs, } func New(opts *validations.Opts) *CreateValidations { diff --git a/pkg/validations/createvalidations/preflightvalidations.go b/pkg/validations/createvalidations/preflightvalidations.go index 660fa43b71a34..76fa21e31a6ca 100644 --- a/pkg/validations/createvalidations/preflightvalidations.go +++ b/pkg/validations/createvalidations/preflightvalidations.go @@ -107,16 +107,5 @@ func (v *CreateValidations) PreflightValidations(ctx context.Context) []validati ) } - if !v.Opts.SkippedValidations[validations.APIServerExtraArgs] { - createValidations = append( - createValidations, - func() *validations.ValidationResult { - return &validations.ValidationResult{ - Name: "validate api server extra args", - Remediation: "ensure apiServerExtraArgs have only supported flags (service-account-issuer, service-account-jwks-uri)", - Err: validations.ValidateAPIServerExtraArgs(v.Opts.Spec), - } - }) - } return createValidations } diff --git a/pkg/validations/skipvalidations.go b/pkg/validations/skipvalidations.go index 241554c373e6f..268b372ab9180 100644 --- a/pkg/validations/skipvalidations.go +++ b/pkg/validations/skipvalidations.go @@ -7,10 +7,9 @@ import ( // string values of supported validation names that can be skipped. const ( - PDB = "pod-disruption" - VSphereUserPriv = "vsphere-user-privilege" - EksaVersionSkew = "eksa-version-skew" - APIServerExtraArgs = "api-server-extra-args" + PDB = "pod-disruption" + VSphereUserPriv = "vsphere-user-privilege" + EksaVersionSkew = "eksa-version-skew" ) // ValidSkippableValidationsMap returns a map for all valid skippable validations as keys, defaulting values to false. diff --git a/pkg/validations/skipvalidations_test.go b/pkg/validations/skipvalidations_test.go index fd05186a8ada8..0fff9b0f46935 100644 --- a/pkg/validations/skipvalidations_test.go +++ b/pkg/validations/skipvalidations_test.go @@ -29,10 +29,9 @@ func TestValidateSkippableValidation(t *testing.T) { { name: "valid upgrade validation param", want: map[string]bool{ - validations.PDB: true, - validations.VSphereUserPriv: false, - validations.EksaVersionSkew: false, - validations.APIServerExtraArgs: false, + validations.PDB: true, + validations.VSphereUserPriv: false, + validations.EksaVersionSkew: false, }, wantErr: nil, skippedValidations: []string{validations.PDB}, @@ -41,8 +40,7 @@ func TestValidateSkippableValidation(t *testing.T) { { name: "valid create validation param", want: map[string]bool{ - validations.VSphereUserPriv: true, - validations.APIServerExtraArgs: false, + validations.VSphereUserPriv: true, }, wantErr: nil, skippedValidations: []string{validations.VSphereUserPriv}, diff --git a/pkg/validations/upgradevalidations/preflightvalidations.go b/pkg/validations/upgradevalidations/preflightvalidations.go index 55aebfb457670..650bd9f941e26 100644 --- a/pkg/validations/upgradevalidations/preflightvalidations.go +++ b/pkg/validations/upgradevalidations/preflightvalidations.go @@ -166,17 +166,6 @@ func (u *UpgradeValidations) PreflightValidations(ctx context.Context) []validat } }) } - if !u.Opts.SkippedValidations[validations.APIServerExtraArgs] { - upgradeValidations = append( - upgradeValidations, - func() *validations.ValidationResult { - return &validations.ValidationResult{ - Name: "validate api server extra args", - Remediation: "ensure apiServerExtraArgs have only supported flags (service-account-issuer, service-account-jwks-uri)", - Err: validations.ValidateAPIServerExtraArgs(u.Opts.Spec), - } - }) - } return upgradeValidations } diff --git a/pkg/validations/upgradevalidations/upgradevalidations.go b/pkg/validations/upgradevalidations/upgradevalidations.go index ab68e35da3862..1490743507094 100644 --- a/pkg/validations/upgradevalidations/upgradevalidations.go +++ b/pkg/validations/upgradevalidations/upgradevalidations.go @@ -9,7 +9,6 @@ var SkippableValidations = []string{ validations.PDB, validations.VSphereUserPriv, validations.EksaVersionSkew, - validations.APIServerExtraArgs, } func New(opts *validations.Opts) *UpgradeValidations {