Skip to content

Commit f42265a

Browse files
authored
Merge pull request #586 from mojaloop/fix/calico
improve Redis topologySpreadConstraints to be zone aware
2 parents 9f2a555 + e8d5f7c commit f42265a

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

terraform/gitlab/ci-templates/k8s-cluster/.gitlab-ci.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ deploy-infra:
183183
when: always
184184
rules:
185185
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^deploy-infra:.*/
186+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE == "update generated configs to project"
187+
when: manual
188+
allow_failure: true
186189
- when: manual
187190

188191
deploy-managed-srvcs:
@@ -212,7 +215,12 @@ refresh-templates:
212215
script:
213216
- !reference [.source, script]
214217
- .gitlab/scripts/refresh-repo.sh $cluster_name $TMP_GIT_REPO $TMP_TEMPLATES_DIR $GITLAB_CI_PAT $iac_terraform_modules_tag
215-
when: manual
218+
rules:
219+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^refresh:.*/
220+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE == "update generated configs to project"
221+
when: manual
222+
allow_failure: true
223+
- when: manual
216224

217225
destroy:
218226
extends: .terraform:destroy
@@ -253,6 +261,9 @@ refresh-deploy-infra:
253261
rules:
254262
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^deploy:.*/
255263
- if: $CI_PIPELINE_TRIGGERED && $CI_PIPELINE_SOURCE == "trigger" && $CD_UPDATE_PROFILE
264+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE == "update generated configs to project"
265+
when: manual
266+
allow_failure: true
256267
- when: manual
257268

258269
tf-refresh-deploy-infra:
@@ -276,6 +287,9 @@ tf-refresh-deploy-infra:
276287
when: always
277288
rules:
278289
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^tf_trigger.*/
290+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE == "update generated configs to project"
291+
when: manual
292+
allow_failure: true
279293
- when: manual
280294

281295
lint-apps:

terraform/gitops/k8s-cluster-config/base-utils.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ module "generate_reflector_files" {
1414
velero_credentials_secret = "velero-s3-credentials"
1515
velero_bsl_credentials_secret = "velerobsl-s3-credentials"
1616
external_secret_sync_wave = var.external_secret_sync_wave
17+
cloud_platform = local.cloud_platform
18+
k8s_cluster_type = local.k8s_cluster_type
19+
cluster = var.app_var_map.cluster
1720

1821
}
1922
file_list = [for f in fileset(local.base_utils_template_path, "**/*.tpl") : trimsuffix(f, ".tpl") if !can(regex(local.base_utils_app_file, f))]

terraform/gitops/stateful-resources/templates/stateful-resources/redis/redis-cluster.yaml.tpl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ spec:
7878
- follower
7979
topologyKey: kubernetes.io/hostname
8080
weight: 10
81+
topologySpreadConstraints:
82+
- maxSkew: 1
83+
topologyKey: kubernetes.io/hostname
84+
whenUnsatisfiable: ScheduleAnyway
85+
labelSelector:
86+
matchLabels:
87+
role: leader
88+
clusterId: redis-cluster
89+
- maxSkew: 1
90+
topologyKey: topology.kubernetes.io/zone
91+
whenUnsatisfiable: ScheduleAnyway
92+
labelSelector:
93+
matchLabels:
94+
role: leader
95+
clusterId: redis-cluster
8196
redisFollower:
8297
readinessProbe:
8398
failureThreshold: 5
@@ -124,6 +139,21 @@ spec:
124139
- leader
125140
topologyKey: kubernetes.io/hostname
126141
weight: 10
142+
topologySpreadConstraints:
143+
- maxSkew: 1
144+
topologyKey: kubernetes.io/hostname
145+
whenUnsatisfiable: ScheduleAnyway
146+
labelSelector:
147+
matchLabels:
148+
role: follower
149+
clusterId: redis-cluster
150+
- maxSkew: 1
151+
topologyKey: topology.kubernetes.io/zone
152+
whenUnsatisfiable: ScheduleAnyway
153+
labelSelector:
154+
matchLabels:
155+
role: follower
156+
clusterId: redis-cluster
127157
# %{ endif }
128158
redisExporter:
129159
enabled: false

0 commit comments

Comments
 (0)