HA
This commit is contained in:
@@ -15,4 +15,4 @@ type: application
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 0.13.2
|
||||
version: 0.14.0
|
||||
|
||||
@@ -103,9 +103,22 @@ spec:
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
{{- if or .Values.spreadAcrossNodes .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- if .Values.spreadAcrossNodes }}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app.kubernetes.io/instance"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Release.Name }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{- end }}
|
||||
{{- if .Values.affinity }}
|
||||
{{- toYaml .Values.affinity | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{{- if and (.Values.podDisruptionBudgetEnabled) (gt (.Values.replicas | int64) 1) }}
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
minAvailable: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "helm-chart.selectorLabels" . | nindent 6 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,27 @@
|
||||
suite: test deployment
|
||||
templates:
|
||||
- deployment.yaml
|
||||
- configmap.yaml
|
||||
tests:
|
||||
- it: Should spread pods across nodes
|
||||
set:
|
||||
spreadAccrossNodes: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.affinity
|
||||
value:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app.kubernetes.io/instance"
|
||||
operator: In
|
||||
values:
|
||||
- RELEASE-NAME
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
- it: Should not spread pods across nodes
|
||||
set:
|
||||
spreadAcrossNodes: false
|
||||
asserts:
|
||||
- isNull:
|
||||
path: spec.template.spec.affinity
|
||||
@@ -0,0 +1,11 @@
|
||||
suite: test prometheus rule
|
||||
templates:
|
||||
- pdb.yaml
|
||||
tests:
|
||||
- it: Should set Pod Disruption budget
|
||||
set:
|
||||
replicas: 2
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.minAvailable
|
||||
value: 1
|
||||
@@ -96,6 +96,20 @@
|
||||
1
|
||||
]
|
||||
},
|
||||
"podDisruptionBudgetEnabled": {
|
||||
"$id": "#/properties/podDisruptionBudgetEnabled",
|
||||
"type": "boolean",
|
||||
"title": "Pod Disruption Budget",
|
||||
"description": "If pod disruption budgets is enabled, node maintenance won't affect the availability of your application",
|
||||
"default": true
|
||||
},
|
||||
"spreadAcrossNodes": {
|
||||
"$id": "#/properties/spreadAcrossNodes",
|
||||
"type": "boolean",
|
||||
"title": "Spread pods across nodes",
|
||||
"description": "This setting prevents pods to be placed on the same node",
|
||||
"default": true
|
||||
},
|
||||
"nameOverride": {
|
||||
"$id": "#/properties/nameOverride",
|
||||
"type": "string",
|
||||
|
||||
@@ -29,7 +29,6 @@ nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
probe:
|
||||
enabled: false
|
||||
@@ -51,3 +50,6 @@ debugSidecar:
|
||||
image: debian:stable-slim
|
||||
shell: "/bin/bash"
|
||||
command: "while true; do sleep 30; done;"
|
||||
|
||||
podDisruptionBudgetEnabled: true
|
||||
spreadAcrossNodes: true
|
||||
|
||||
Reference in New Issue
Block a user