diff --git a/README.md b/README.md index 1c69e3e..a4da59f 100644 --- a/README.md +++ b/README.md @@ -607,6 +607,43 @@ ingress: kubernetes.io/ingress.class: alb ``` +### 4.1 Node Affinity, Taints and Tolerations. + +The API, Registry, Executor and UI support using affinity, taints and tolerations. Use the following examples as reference: + +#### Example API. + +```yaml +api: + enabled: true + version: "2.5.0" + replicaCount: "1" + serviceType: "ClusterIP" + resources: + limits: + cpu: 500m + memory: 1024Mi + requests: + cpu: 200m + memory: 256Mi + tolerations: + - key: "key1" + operator: "Equal" + value: "value1" + effect: "NoSchedule" + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: name + operator: In + values: + - terrakube + properties: + databaseType: "H2" +``` + ### 5. Deploy Terrakube using helm chart Now you have all the information to deploy Terrakube, you can use the following example: diff --git a/templates/deployment-api.yaml b/templates/deployment-api.yaml index 963ba44..dc554cb 100644 --- a/templates/deployment-api.yaml +++ b/templates/deployment-api.yaml @@ -44,4 +44,12 @@ spec: port: 8080 initialDelaySeconds: 120 periodSeconds: 10 + {{- with .Values.api.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.api.tolerations }} + tolerations: + {{- toYaml . | nindent 6 }} + {{- end }} {{ end }} \ No newline at end of file diff --git a/templates/deployment-executor.yaml b/templates/deployment-executor.yaml index 92e6968..919eb89 100644 --- a/templates/deployment-executor.yaml +++ b/templates/deployment-executor.yaml @@ -44,4 +44,12 @@ spec: port: 8090 initialDelaySeconds: 120 periodSeconds: 10 + {{- with .Values.executor.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.executor.tolerations }} + tolerations: + {{- toYaml . | nindent 6 }} + {{- end }} {{ end }} \ No newline at end of file diff --git a/templates/deployment-registry.yaml b/templates/deployment-registry.yaml index 27a34c5..db287ae 100644 --- a/templates/deployment-registry.yaml +++ b/templates/deployment-registry.yaml @@ -44,4 +44,12 @@ spec: port: 8075 initialDelaySeconds: 120 periodSeconds: 10 + {{- with .Values.registry.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.registry.tolerations }} + tolerations: + {{- toYaml . | nindent 6 }} + {{- end }} {{ end }} \ No newline at end of file diff --git a/templates/deployment-ui.yaml b/templates/deployment-ui.yaml index 88c065c..4b66ea3 100644 --- a/templates/deployment-ui.yaml +++ b/templates/deployment-ui.yaml @@ -26,4 +26,12 @@ spec: envFrom: - secretRef: name: terrakube-ui-secrets + {{- with .Values.ui.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.ui.tolerations }} + tolerations: + {{- toYaml . | nindent 6 }} + {{- end }} {{ end }} \ No newline at end of file diff --git a/values.schema.json b/values.schema.json index c255be8..36de1d8 100644 --- a/values.schema.json +++ b/values.schema.json @@ -123,6 +123,15 @@ "resources": { "type": "object" }, + "affinity": { + "type": "object" + }, + "tolerations": { + "type": "array", + "items": { + "type": "object" + } + }, "properties": { "type": "object", "required": ["databaseType", "databaseHostname", "databaseName", "databaseUser", "databasePassword"], @@ -174,6 +183,15 @@ "resources": { "type": "object" }, + "affinity": { + "type": "object" + }, + "tolerations": { + "type": "array", + "items": { + "type": "object" + } + }, "properties": { "type": "object", "required": ["toolsRepository", "toolsBranch"], @@ -220,6 +238,15 @@ }, "resources": { "type": "object" + }, + "affinity": { + "type": "object" + }, + "tolerations": { + "type": "array", + "items": { + "type": "object" + } } } }, @@ -245,6 +272,15 @@ }, "resources": { "type": "object" + }, + "affinity": { + "type": "object" + }, + "tolerations": { + "type": "array", + "items": { + "type": "object" + } } } },