Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change GatewayAPI type in adc to boolean pointer #174

Merged
merged 1 commit into from
Oct 27, 2023
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: 3 additions & 1 deletion api/v1alpha1/akodeploymentconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ type ExtraConfigs struct {
Rbac AKORbacConfig `json:"rbac,omitempty"`

// FeatureGates specifies the configuration for AKO features
// +optional
FeatureGates FeatureGates `json:"featureGates,omitempty"`
}

Expand Down Expand Up @@ -351,7 +352,8 @@ type AKORbacConfig struct {
// FeatureGates describes the configuration for AKO features
type FeatureGates struct {
// GatewayAPI enables/disables processing of Kubernetes Gateway API CRDs.
GatewayAPI string `json:"GatewayAPI,omitempty"`
// +optional
GatewayAPI *bool `json:"GatewayAPI,omitempty"`
}

// AVITenant describes settings for an AVI Tenant object
Expand Down
7 changes: 6 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ spec:
GatewayAPI:
description: GatewayAPI enables/disables processing of Kubernetes
Gateway API CRDs.
type: string
type: boolean
type: object
fullSyncFrequency:
description: FullSyncFrequency controls how often AKO polls the
Expand Down
2 changes: 1 addition & 1 deletion config/ytt/static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ spec:
GatewayAPI:
description: GatewayAPI enables/disables processing of Kubernetes
Gateway API CRDs.
type: string
type: boolean
type: object
fullSyncFrequency:
description: FullSyncFrequency controls how often AKO polls the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func unitTestAKODeploymentYaml() {
},
DisableStaticRouteSync: pointer.BoolPtr(true),
FeatureGates: akoov1alpha1.FeatureGates{
GatewayAPI: "true",
GatewayAPI: pointer.Bool(true),
},
},
},
Expand Down
14 changes: 10 additions & 4 deletions pkg/ako/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,18 @@ type FeatureGates struct {
GatewayAPI string `yaml:"gateway_api"`
}

// NewFeatureGates creates a FeatureGates from the v1alpha1.FeatureGates
func NewFeatureGates(config v1alpha1.FeatureGates) *FeatureGates {
gatewayAPIEnabled := "false"
if config.GatewayAPI != "" {
gatewayAPIEnabled = config.GatewayAPI
settings := DefaultFeatureGates()
if config.GatewayAPI != nil {
settings.GatewayAPI = strconv.FormatBool(*config.GatewayAPI)
}
return settings
}

// DefaultFeatureGates returns default FeatureGates
func DefaultFeatureGates() *FeatureGates {
return &FeatureGates{
GatewayAPI: gatewayAPIEnabled,
// GatewayAPI: don't set, populate in runtime
}
}
6 changes: 3 additions & 3 deletions pkg/ako/values_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var _ = Describe("AKO", func() {
rbac.PspPolicyApiVersion: "test/1.2",
l7Settings.ShardVSSize: akoDeploymentConfig.Spec.ExtraConfigs.IngressConfigs.ShardVSSize,
l7Settings.ServiceType: akoDeploymentConfig.Spec.ExtraConfigs.IngressConfigs.ServiceType,
featureGates.GatewayAPI: akoDeploymentConfig.Spec.ExtraConfigs.FeatureGates.GatewayAPI,
featureGates.GatewayAPI: strconv.FormatBool(*akoDeploymentConfig.Spec.ExtraConfigs.FeatureGates.GatewayAPI),
}
for k, v := range expectedPairs {
Expect(k).To(Equal(v))
Expand Down Expand Up @@ -135,7 +135,7 @@ var _ = Describe("AKO", func() {
DisableStaticRouteSync: pointer.BoolPtr(true),
CniPlugin: "antrea",
FeatureGates: akoov1alpha1.FeatureGates{
GatewayAPI: "true",
GatewayAPI: pointer.Bool(true),
},
},
},
Expand Down Expand Up @@ -189,7 +189,7 @@ var _ = Describe("AKO", func() {
DisableStaticRouteSync: pointer.BoolPtr(true),
CniPlugin: "antrea",
FeatureGates: akoov1alpha1.FeatureGates{
GatewayAPI: "false",
GatewayAPI: pointer.Bool(false),
},
},
},
Expand Down
Loading