Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/config/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ func (fg *FeatureGates) validateFeatureGates() error {

switch fg.FeatureSet {
case "":
if len(fg.CustomNoUpgrade.Enabled) > 0 || len(fg.CustomNoUpgrade.Disabled) > 0 {
return fmt.Errorf("CustomNoUpgrade enabled/disabled lists must be empty when FeatureSet is empty")
}
return nil
case FeatureSetCustomNoUpgrade:
// Valid - continue with validation
Expand All @@ -211,6 +214,7 @@ func (fg *FeatureGates) validateFeatureGates() error {
msg string
}{
{disabledCustom, sets.New(RequiredFeatureGates...), "required feature gates cannot be disabled"},
{enabledCustom, sets.New(RequiredFeatureGates...), "required feature gates cannot be explicitly enabled"},
{enabledCustom, disabledCustom, "feature gates cannot be both enabled and disabled"},
}

Expand Down
29 changes: 15 additions & 14 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,16 +818,6 @@ func TestValidate(t *testing.T) {
}(),
expectErr: true,
},
{
name: "feature-gates-custom-no-upgrade-with-feature-set-empty",
config: func() *Config {
c := mkDefaultConfig()
c.ApiServer.FeatureGates.FeatureSet = ""
c.ApiServer.FeatureGates.CustomNoUpgrade.Enabled = []string{"feature1"}
c.ApiServer.FeatureGates.CustomNoUpgrade.Disabled = []string{"feature2"}
return c
}(),
},
{
name: "feature-gates-custom-no-upgrade-valid",
config: func() *Config {
Expand All @@ -840,15 +830,15 @@ func TestValidate(t *testing.T) {
expectErr: false,
},
{
name: "feature-gates-required-feature-gate-cannot-be-explicitly-enabled",
name: "feature-gates-custom-no-upgrade-with-feature-set-empty",
config: func() *Config {
c := mkDefaultConfig()
c.ApiServer.FeatureGates.FeatureSet = "CustomNoUpgrade"
c.ApiServer.FeatureGates.CustomNoUpgrade.Enabled = []string{"UserNamespacesSupport"}
c.ApiServer.FeatureGates.FeatureSet = ""
c.ApiServer.FeatureGates.CustomNoUpgrade.Enabled = []string{"feature1"}
c.ApiServer.FeatureGates.CustomNoUpgrade.Disabled = []string{"feature2"}
return c
}(),
expectErr: false,
expectErr: true,
},
{
name: "feature-gates-custom-no-upgrade-enabled-and-disabled-have-same-feature-gate",
Expand All @@ -872,6 +862,17 @@ func TestValidate(t *testing.T) {
}(),
expectErr: true,
},
{
name: "feature-gates-required-feature-gate-cannot-be-explicitly-enabled",
config: func() *Config {
c := mkDefaultConfig()
c.ApiServer.FeatureGates.FeatureSet = "CustomNoUpgrade"
c.ApiServer.FeatureGates.CustomNoUpgrade.Enabled = []string{"UserNamespacesSupport"}
c.ApiServer.FeatureGates.CustomNoUpgrade.Disabled = []string{"feature2"}
return c
}(),
expectErr: true,
},
{
name: "feature-gates-custom-no-upgrade-with-empty-enabled-and-disabled-lists",
config: func() *Config {
Expand Down
4 changes: 2 additions & 2 deletions scripts/aws/cf-gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Parameters:
Description: Current RHEL AMI to use.
Type: AWS::EC2::Image::Id
Machinename:
AllowedPattern: ^([a-zA-Z][a-zA-Z0-9\-]{0,26})$
MaxLength: 27
AllowedPattern: ^([a-zA-Z][a-zA-Z0-9\-]*)$
MaxLength: 64
MinLength: 1
ConstraintDescription: Machinename
Description: Machinename
Expand Down