Skip to content

Commit

Permalink
feat: Support in Helm charts for PodDisruptionBudget and TopologySpre…
Browse files Browse the repository at this point in the history
…adConstraints (#671)
  • Loading branch information
sheetaljoshi authored Nov 8, 2024
1 parent 8c35074 commit ef7ea83
Show file tree
Hide file tree
Showing 29 changed files with 200 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test-connection.yaml
test-connection.yaml
deploy/kubernetes/charts/**/*.yaml
4 changes: 4 additions & 0 deletions deploy/kubernetes/charts/assets/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ spec:
labels:
{{- include "assets.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
18 changes: 18 additions & 0 deletions deploy/kubernetes/charts/assets/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "assets.fullname" . }}
labels:
{{- include "assets.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "assets.selectorLabels" . | nindent 6 }}
{{- end }}
10 changes: 9 additions & 1 deletion deploy/kubernetes/charts/assets/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ tolerations: []

affinity: {}

topologySpreadConstraints: []

metrics:
enabled: false
podAnnotations:
Expand All @@ -69,4 +71,10 @@ configMap:

opentelemetry:
enabled: false
instrumentation: ""
instrumentation: ""

podDisruptionBudget:
enabled: false
minAvailable: 2
maxUnavailable: 1

4 changes: 4 additions & 0 deletions deploy/kubernetes/charts/carts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ spec:
labels:
{{- include "carts.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions deploy/kubernetes/charts/carts/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "carts.fullname" . }}
labels:
{{- include "carts.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "carts.selectorLabels" . | nindent 6 }}
{{- end }}
9 changes: 8 additions & 1 deletion deploy/kubernetes/charts/carts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ tolerations: []

affinity: {}

topologySpreadConstraints: []

metrics:
enabled: true
podAnnotations:
Expand Down Expand Up @@ -96,4 +98,9 @@ dynamodb:

opentelemetry:
enabled: false
instrumentation: ""
instrumentation: ""

podDisruptionBudget:
enabled: false
minAvailable: 2
maxUnavailable: 1
4 changes: 4 additions & 0 deletions deploy/kubernetes/charts/catalog/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ spec:
labels:
{{- include "catalog.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ spec:
- name: data
emptyDir: {}
{{- end }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions deploy/kubernetes/charts/catalog/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "catalog.fullname" . }}
labels:
{{- include "catalog.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "catalog.selectorLabels" . | nindent 6 }}
{{- end }}
10 changes: 8 additions & 2 deletions deploy/kubernetes/charts/catalog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ tolerations: []

affinity: {}

topologySpreadConstraints: []

metrics:
enabled: true
podAnnotations:
Expand Down Expand Up @@ -110,13 +112,17 @@ mysql:
accessModes:
- ReadWriteOnce
size: 10Gi
# storageClass: gp2
storageClass: ""

securityGroups:
create: false

securityGroupIds: []

opentelemetry:
enabled: false
instrumentation: ""

podDisruptionBudget:
enabled: false
minAvailable: 2
maxUnavailable: 1
4 changes: 4 additions & 0 deletions deploy/kubernetes/charts/checkout/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ spec:
labels:
{{- include "checkout.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
18 changes: 18 additions & 0 deletions deploy/kubernetes/charts/checkout/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "checkout.fullname" . }}
labels:
{{- include "checkout.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "checkout.selectorLabels" . | nindent 6 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
9 changes: 8 additions & 1 deletion deploy/kubernetes/charts/checkout/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ tolerations: []

affinity: {}

topologySpreadConstraints: []

metrics:
enabled: true
podAnnotations:
Expand Down Expand Up @@ -103,4 +105,9 @@ securityGroups:

opentelemetry:
enabled: false
instrumentation: ""
instrumentation: ""

podDisruptionBudget:
enabled: false
minAvailable: 2
maxUnavailable: 1
2 changes: 1 addition & 1 deletion deploy/kubernetes/charts/helmfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ releases:
carts: http://carts
checkout: http://checkout
orders: http://orders
assets: http://assets
assets: http://assets
2 changes: 2 additions & 0 deletions deploy/kubernetes/charts/opentelemetry/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ collector:
tolerations: []

affinity: {}


4 changes: 4 additions & 0 deletions deploy/kubernetes/charts/orders/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ spec:
labels:
{{- include "orders.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
18 changes: 18 additions & 0 deletions deploy/kubernetes/charts/orders/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "orders.fullname" . }}
labels:
{{- include "orders.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "orders.selectorLabels" . | nindent 6 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ spec:
- name: data
emptyDir: {}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ spec:
- name: data
emptyDir: {}
{{- end }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions deploy/kubernetes/charts/orders/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ tolerations: []

affinity: {}

topologySpreadConstraints: []

metrics:
enabled: true
podAnnotations:
Expand Down Expand Up @@ -167,3 +169,8 @@ securityGroups:
opentelemetry:
enabled: false
instrumentation: ""

podDisruptionBudget:
enabled: false
minAvailable: 2
maxUnavailable: 1
4 changes: 4 additions & 0 deletions deploy/kubernetes/charts/ui/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ spec:
labels:
{{- include "ui.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
3 changes: 3 additions & 0 deletions deploy/kubernetes/charts/ui/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.class }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
Expand Down
18 changes: 18 additions & 0 deletions deploy/kubernetes/charts/ui/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "ui.fullname" . }}
labels:
{{- include "ui.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "ui.selectorLabels" . | nindent 6 }}
{{- end }}
5 changes: 4 additions & 1 deletion deploy/kubernetes/charts/ui/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.service.loadBalancerClass }}
loadBalancerClass: {{ .Values.service.loadBalancerClass }}
{{- end }}
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "ui.selectorLabels" . | nindent 4 }}
{{- include "ui.selectorLabels" . | nindent 4 }}
Loading

0 comments on commit ef7ea83

Please sign in to comment.