Skip to content
Open
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
2 changes: 2 additions & 0 deletions pkg/config/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ type FeatureGates struct {
CustomNoUpgrade CustomNoUpgrade `json:"customNoUpgrade"`
}

// ToApiserverArgs converts the FeatureGates struct to a list of feature-gates arguments for the kube-apiserver.
// Validation checks should be performed before calling this function to ensure the FeatureGates struct is valid.
func (fg FeatureGates) ToApiserverArgs() ([]string, error) {
ret := sets.NewString()
addFeatures := func(features []string, enabled bool) {
Expand Down
42 changes: 42 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,48 @@ func TestValidate(t *testing.T) {
}(),
expectErr: true,
},
{
name: "feature-gates-required-feature-gate-cannot-be-disabled",
config: func() *Config {
c := mkDefaultConfig()
c.ApiServer.FeatureGates.FeatureSet = "CustomNoUpgrade"
c.ApiServer.FeatureGates.CustomNoUpgrade.Enabled = []string{"feature1"}
c.ApiServer.FeatureGates.CustomNoUpgrade.Disabled = []string{"UserNamespacesSupport"}
return c
}(),
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 {
c := mkDefaultConfig()
c.ApiServer.FeatureGates.FeatureSet = "CustomNoUpgrade"
c.ApiServer.FeatureGates.CustomNoUpgrade.Enabled = []string{}
c.ApiServer.FeatureGates.CustomNoUpgrade.Disabled = []string{}
return c
}(),
expectErr: false,
},
{
name: "feature-gates-preview-feature-sets-not-supported",
config: func() *Config {
c := mkDefaultConfig()
c.ApiServer.FeatureGates.FeatureSet = "TechPreviewNoUpgrade"
return c
}(),
expectErr: true,
},
}
for _, tt := range ttests {
t.Run(tt.name, func(t *testing.T) {
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