Fix zookeeper antiaffinity (#52)
Fixes #39 ### Motivation The match expression for the "app" label was incorrect breaking the antiaffinity since they would never match. Fixing this makes the podAntiAffinity work, but now requires at least N nodes to be in the cluster where N = largest replica set with affinity. Added the option to set the affinity type to preferredDuringSchedulingIgnoredDuringExecution where it will try to follow the affinity, but will still deploy a pod if it needs to break it. ### Modifications - Fixed app matchExpression - Added option to set the affinity type - bumped chart version ### Verifying this change - [X] Make sure that the change passes the CI checks.
This commit is contained in:
parent
8426c8de9c
commit
207d697bed
@ -21,7 +21,7 @@ apiVersion: v1
|
||||
appVersion: "2.6.0"
|
||||
description: Apache Pulsar Helm chart for Kubernetes
|
||||
name: pulsar
|
||||
version: 2.6.0-2
|
||||
version: 2.6.0-3
|
||||
home: https://pulsar.apache.org
|
||||
sources:
|
||||
- https://github.com/apache/pulsar
|
||||
|
||||
@ -62,13 +62,14 @@ spec:
|
||||
affinity:
|
||||
{{- if and .Values.affinity.anti_affinity .Values.autorecovery.affinity.anti_affinity}}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
{{ if eq .Values.autorecovery.affinity.type "requiredDuringSchedulingIgnoredDuringExecution"}}
|
||||
{{ .Values.autorecovery.affinity.type }}:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- "{{ template "pulsar.name" . }}-{{ .Values.bookkeeper.component }}"
|
||||
- "{{ template "pulsar.name" . }}"
|
||||
- key: "release"
|
||||
operator: In
|
||||
values:
|
||||
@ -76,8 +77,28 @@ spec:
|
||||
- key: "component"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Values.bookkeeper.component }}
|
||||
- {{ .Values.autorecovery.component }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{ else }}
|
||||
{{ .Values.autorecovery.affinity.type }}:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- "{{ template "pulsar.name" . }}"
|
||||
- key: "release"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Release.Name }}
|
||||
- key: "component"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Values.autorecovery.component }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.autorecovery.gracePeriod }}
|
||||
initContainers:
|
||||
|
||||
@ -59,13 +59,14 @@ spec:
|
||||
affinity:
|
||||
{{- if and .Values.affinity.anti_affinity .Values.bookkeeper.affinity.anti_affinity}}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
{{ if eq .Values.bookkeeper.affinity.type "requiredDuringSchedulingIgnoredDuringExecution"}}
|
||||
{{ .Values.bookkeeper.affinity.type }}:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- "{{ template "pulsar.name" . }}-{{ .Values.bookkeeper.component }}"
|
||||
- "{{ template "pulsar.name" . }}"
|
||||
- key: "release"
|
||||
operator: In
|
||||
values:
|
||||
@ -75,6 +76,26 @@ spec:
|
||||
values:
|
||||
- {{ .Values.bookkeeper.component }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{ else }}
|
||||
{{ .Values.bookkeeper.affinity.type }}:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- "{{ template "pulsar.name" . }}"
|
||||
- key: "release"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Release.Name }}
|
||||
- key: "component"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Values.bookkeeper.component }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.bookkeeper.gracePeriod }}
|
||||
initContainers:
|
||||
|
||||
@ -60,13 +60,14 @@ spec:
|
||||
affinity:
|
||||
{{- if and .Values.affinity.anti_affinity .Values.broker.affinity.anti_affinity}}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
{{ if eq .Values.broker.affinity.type "requiredDuringSchedulingIgnoredDuringExecution"}}
|
||||
{{ .Values.broker.affinity.type }}:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- "{{ template "pulsar.name" . }}-{{ .Values.broker.component }}"
|
||||
- "{{ template "pulsar.name" . }}"
|
||||
- key: "release"
|
||||
operator: In
|
||||
values:
|
||||
@ -76,6 +77,26 @@ spec:
|
||||
values:
|
||||
- {{ .Values.broker.component }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{ else }}
|
||||
{{ .Values.broker.affinity.type }}:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- "{{ template "pulsar.name" . }}"
|
||||
- key: "release"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Release.Name }}
|
||||
- key: "component"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Values.broker.component }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.broker.gracePeriod }}
|
||||
initContainers:
|
||||
|
||||
@ -59,13 +59,14 @@ spec:
|
||||
affinity:
|
||||
{{- if and .Values.affinity.anti_affinity .Values.proxy.affinity.anti_affinity}}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
{{ if eq .Values.proxy.affinity.type "requiredDuringSchedulingIgnoredDuringExecution"}}
|
||||
{{ .Values.proxy.affinity.type }}:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- "{{ template "pulsar.name" . }}-{{ .Values.proxy.component }}"
|
||||
- "{{ template "pulsar.name" . }}"
|
||||
- key: "release"
|
||||
operator: In
|
||||
values:
|
||||
@ -75,6 +76,26 @@ spec:
|
||||
values:
|
||||
- {{ .Values.proxy.component }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{ else }}
|
||||
{{ .Values.proxy.affinity.type }}:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- "{{ template "pulsar.name" . }}"
|
||||
- key: "release"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Release.Name }}
|
||||
- key: "component"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Values.proxy.component }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.proxy.gracePeriod }}
|
||||
initContainers:
|
||||
|
||||
@ -56,13 +56,14 @@ spec:
|
||||
affinity:
|
||||
{{- if and .Values.affinity.anti_affinity .Values.zookeeper.affinity.anti_affinity}}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
{{ if eq .Values.zookeeper.affinity.type "requiredDuringSchedulingIgnoredDuringExecution"}}
|
||||
{{ .Values.zookeeper.affinity.type }}:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- "{{ template "pulsar.name" . }}-{{ .Values.zookeeper.component }}"
|
||||
- "{{ template "pulsar.name" . }}"
|
||||
- key: "release"
|
||||
operator: In
|
||||
values:
|
||||
@ -72,6 +73,26 @@ spec:
|
||||
values:
|
||||
- {{ .Values.zookeeper.component }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{ else }}
|
||||
{{ .Values.zookeeper.affinity.type }}:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- "{{ template "pulsar.name" . }}"
|
||||
- key: "release"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Release.Name }}
|
||||
- key: "component"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Values.zookeeper.component }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.zookeeper.gracePeriod }}
|
||||
containers:
|
||||
|
||||
@ -66,6 +66,10 @@ volumes:
|
||||
## the `affinity.anti_affinity` settings to `false` for that component.
|
||||
affinity:
|
||||
anti_affinity: true
|
||||
# Set the anti affinity type. Valid values:
|
||||
# requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica
|
||||
# preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee
|
||||
type: requiredDuringSchedulingIgnoredDuringExecution
|
||||
|
||||
## Components
|
||||
##
|
||||
@ -285,6 +289,10 @@ zookeeper:
|
||||
periodSeconds: 30
|
||||
affinity:
|
||||
anti_affinity: true
|
||||
# Set the anti affinity type. Valid values:
|
||||
# requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica
|
||||
# preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee
|
||||
type: requiredDuringSchedulingIgnoredDuringExecution
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "8000"
|
||||
@ -391,6 +399,10 @@ bookkeeper:
|
||||
periodSeconds: 30
|
||||
affinity:
|
||||
anti_affinity: true
|
||||
# Set the anti affinity type. Valid values:
|
||||
# requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica
|
||||
# preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee
|
||||
type: requiredDuringSchedulingIgnoredDuringExecution
|
||||
annotations: {}
|
||||
tolerations: []
|
||||
gracePeriod: 30
|
||||
@ -492,6 +504,10 @@ autorecovery:
|
||||
# cloud.google.com/gke-nodepool: default-pool
|
||||
affinity:
|
||||
anti_affinity: true
|
||||
# Set the anti affinity type. Valid values:
|
||||
# requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica
|
||||
# preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee
|
||||
type: requiredDuringSchedulingIgnoredDuringExecution
|
||||
annotations: {}
|
||||
# tolerations: []
|
||||
gracePeriod: 30
|
||||
@ -567,6 +583,10 @@ broker:
|
||||
periodSeconds: 10
|
||||
affinity:
|
||||
anti_affinity: true
|
||||
# Set the anti affinity type. Valid values:
|
||||
# requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica
|
||||
# preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee
|
||||
type: preferredDuringSchedulingIgnoredDuringExecution
|
||||
annotations: {}
|
||||
tolerations: []
|
||||
gracePeriod: 30
|
||||
@ -654,6 +674,10 @@ proxy:
|
||||
periodSeconds: 10
|
||||
affinity:
|
||||
anti_affinity: true
|
||||
# Set the anti affinity type. Valid values:
|
||||
# requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica
|
||||
# preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee
|
||||
type: requiredDuringSchedulingIgnoredDuringExecution
|
||||
annotations: {}
|
||||
tolerations: []
|
||||
gracePeriod: 30
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user