Skip to content

Commit f1fa253

Browse files
committed
Add ReplicaCount to AKODeploymentConfig
Signed-off-by: Christian Ang <[email protected]>
1 parent aeacc93 commit f1fa253

6 files changed

+35
-1
lines changed

api/v1alpha1/akodeploymentconfig_types.go

+7
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ type AKODeploymentConfigSpec struct {
9898

9999
// ExtraConfigs contains extra configurations for AKO Deployment
100100
type ExtraConfigs struct {
101+
// Defines the number of AKO instances to deploy to allow of high availablity. Max number of replicas is two.
102+
// Default value: 1
103+
// +kubebuilder:validation:Minimum=1
104+
// +kubebuilder:validation:Maximum=2
105+
// +optional
106+
ReplicaCount *int `json:"replicaCount,omitempty"`
107+
101108
// Defines AKO instance is primary or not. Value `true` indicates that AKO instance is primary.
102109
// In a multiple AKO deployment in a cluster, only one AKO instance should be primary.
103110
// Default value: true.

api/v1alpha1/zz_generated.deepcopy.go

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/networking.tkg.tanzu.vmware.com_akodeploymentconfigs.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,13 @@ spec:
461461
the PodSecurityPolicy
462462
type: string
463463
type: object
464+
replicaCount:
465+
description: |-
466+
Defines the number of AKO instances to deploy to allow of high availablity. Max number of replicas is two.
467+
Default value: 1
468+
maximum: 2
469+
minimum: 1
470+
type: integer
464471
servicesAPI:
465472
description: |-
466473
ServicesAPI specifies if enables AKO in services API mode: https://kubernetes-sigs.github.io/service-apis/.

config/ytt/static.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,13 @@ spec:
465465
the PodSecurityPolicy
466466
type: string
467467
type: object
468+
replicaCount:
469+
description: |-
470+
Defines the number of AKO instances to deploy to allow of high availablity. Max number of replicas is two.
471+
Default value: 1
472+
maximum: 2
473+
minimum: 1
474+
type: integer
468475
servicesAPI:
469476
description: |-
470477
ServicesAPI specifies if enables AKO in services API mode: https://kubernetes-sigs.github.io/service-apis/.

pkg/ako/values.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ func NewValues(obj *akoov1alpha1.AKODeploymentConfig, clusterNameSpacedName stri
4949
rbac := NewRbac(obj.Spec.ExtraConfigs.Rbac)
5050
featureGates := NewFeatureGates(obj.Spec.ExtraConfigs.FeatureGates)
5151

52+
replicaCount := 1
53+
if obj.Spec.ExtraConfigs.ReplicaCount != nil {
54+
replicaCount = *obj.Spec.ExtraConfigs.ReplicaCount
55+
}
56+
5257
return &Values{
5358
LoadBalancerAndIngressService: LoadBalancerAndIngressService{
5459
Name: "ako-" + clusterNameSpacedName,
5560
Namespace: akoov1alpha1.AviNamespace,
5661
Config: Config{
5762
IsClusterService: "",
58-
ReplicaCount: 1,
63+
ReplicaCount: replicaCount,
5964
AKOSettings: akoSettings,
6065
NetworkSettings: networkSettings,
6166
L7Settings: l7Settings,

pkg/ako/values_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ var _ = Describe("AKO", func() {
7575
Expect(k).To(Equal(v))
7676
}
7777

78+
Expect(config.ReplicaCount).To(Equal(*akoDeploymentConfig.Spec.ExtraConfigs.ReplicaCount))
79+
7880
if len(akoDeploymentConfig.Spec.ExtraConfigs.IngressConfigs.NodeNetworkList) != 0 {
7981
nodeNetworkListJson, jsonerr := json.Marshal(akoDeploymentConfig.Spec.ExtraConfigs.IngressConfigs.NodeNetworkList)
8082
Expect(jsonerr).ShouldNot(HaveOccurred())
@@ -108,6 +110,7 @@ var _ = Describe("AKO", func() {
108110
CIDR: "10.1.0.0/24",
109111
},
110112
ExtraConfigs: akoov1alpha1.ExtraConfigs{
113+
ReplicaCount: ptr.To(2),
111114
FullSyncFrequency: "1900",
112115
Rbac: akoov1alpha1.AKORbacConfig{
113116
PspEnabled: ptr.To(true),

0 commit comments

Comments
 (0)