Skip to content

Commit 1b61e4b

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

8 files changed

+429
-504
lines changed

api/v1alpha1/akodeploymentconfig_types.go

+5
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ 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+
// +optional
104+
ReplicaCount *int `json:"replicaCount,omitempty"`
105+
101106
// Defines AKO instance is primary or not. Value `true` indicates that AKO instance is primary.
102107
// In a multiple AKO deployment in a cluster, only one AKO instance should be primary.
103108
// 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

+205-170
Large diffs are not rendered by default.

config/rbac/role.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
21
---
32
apiVersion: rbac.authorization.k8s.io/v1
43
kind: ClusterRole
54
metadata:
6-
creationTimestamp: null
75
name: manager-role
86
rules:
97
- apiGroups:

config/webhook/manifests.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
21
---
32
apiVersion: admissionregistration.k8s.io/v1
43
kind: MutatingWebhookConfiguration
54
metadata:
6-
creationTimestamp: null
75
name: mutating-webhook-configuration
86
webhooks:
97
- admissionReviewVersions:
@@ -27,12 +25,10 @@ webhooks:
2725
resources:
2826
- akodeploymentconfigs
2927
sideEffects: None
30-
3128
---
3229
apiVersion: admissionregistration.k8s.io/v1
3330
kind: ValidatingWebhookConfiguration
3431
metadata:
35-
creationTimestamp: null
3632
name: validating-webhook-configuration
3733
webhooks:
3834
- admissionReviewVersions:

config/ytt/static.yaml

+205-327
Large diffs are not rendered by default.

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)