Skip to content

Commit

Permalink
Revert "Allow users to skip api server extra args preflight validation"
Browse files Browse the repository at this point in the history
This reverts commit e4b9ef4.
  • Loading branch information
sp1999 committed Mar 15, 2024
1 parent ce94127 commit 443db14
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 34 deletions.
1 change: 0 additions & 1 deletion pkg/validations/createvalidations/createvalidations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions pkg/validations/createvalidations/preflightvalidations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 3 additions & 4 deletions pkg/validations/skipvalidations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 4 additions & 6 deletions pkg/validations/skipvalidations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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},
Expand Down
11 changes: 0 additions & 11 deletions pkg/validations/upgradevalidations/preflightvalidations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
1 change: 0 additions & 1 deletion pkg/validations/upgradevalidations/upgradevalidations.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ var SkippableValidations = []string{
validations.PDB,
validations.VSphereUserPriv,
validations.EksaVersionSkew,
validations.APIServerExtraArgs,
}

func New(opts *validations.Opts) *UpgradeValidations {
Expand Down

0 comments on commit 443db14

Please sign in to comment.