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"
|
appVersion: "2.6.0"
|
||||||
description: Apache Pulsar Helm chart for Kubernetes
|
description: Apache Pulsar Helm chart for Kubernetes
|
||||||
name: pulsar
|
name: pulsar
|
||||||
version: 2.6.0-2
|
version: 2.6.0-3
|
||||||
home: https://pulsar.apache.org
|
home: https://pulsar.apache.org
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/apache/pulsar
|
- https://github.com/apache/pulsar
|
||||||
|
|||||||
@ -62,13 +62,14 @@ spec:
|
|||||||
affinity:
|
affinity:
|
||||||
{{- if and .Values.affinity.anti_affinity .Values.autorecovery.affinity.anti_affinity}}
|
{{- if and .Values.affinity.anti_affinity .Values.autorecovery.affinity.anti_affinity}}
|
||||||
podAntiAffinity:
|
podAntiAffinity:
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
{{ if eq .Values.autorecovery.affinity.type "requiredDuringSchedulingIgnoredDuringExecution"}}
|
||||||
|
{{ .Values.autorecovery.affinity.type }}:
|
||||||
- labelSelector:
|
- labelSelector:
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
- key: "app"
|
- key: "app"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
- "{{ template "pulsar.name" . }}-{{ .Values.bookkeeper.component }}"
|
- "{{ template "pulsar.name" . }}"
|
||||||
- key: "release"
|
- key: "release"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
@ -76,8 +77,28 @@ spec:
|
|||||||
- key: "component"
|
- key: "component"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
- {{ .Values.bookkeeper.component }}
|
- {{ .Values.autorecovery.component }}
|
||||||
topologyKey: "kubernetes.io/hostname"
|
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 }}
|
{{- end }}
|
||||||
terminationGracePeriodSeconds: {{ .Values.autorecovery.gracePeriod }}
|
terminationGracePeriodSeconds: {{ .Values.autorecovery.gracePeriod }}
|
||||||
initContainers:
|
initContainers:
|
||||||
|
|||||||
@ -59,13 +59,14 @@ spec:
|
|||||||
affinity:
|
affinity:
|
||||||
{{- if and .Values.affinity.anti_affinity .Values.bookkeeper.affinity.anti_affinity}}
|
{{- if and .Values.affinity.anti_affinity .Values.bookkeeper.affinity.anti_affinity}}
|
||||||
podAntiAffinity:
|
podAntiAffinity:
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
{{ if eq .Values.bookkeeper.affinity.type "requiredDuringSchedulingIgnoredDuringExecution"}}
|
||||||
|
{{ .Values.bookkeeper.affinity.type }}:
|
||||||
- labelSelector:
|
- labelSelector:
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
- key: "app"
|
- key: "app"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
- "{{ template "pulsar.name" . }}-{{ .Values.bookkeeper.component }}"
|
- "{{ template "pulsar.name" . }}"
|
||||||
- key: "release"
|
- key: "release"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
@ -75,6 +76,26 @@ spec:
|
|||||||
values:
|
values:
|
||||||
- {{ .Values.bookkeeper.component }}
|
- {{ .Values.bookkeeper.component }}
|
||||||
topologyKey: "kubernetes.io/hostname"
|
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 }}
|
{{- end }}
|
||||||
terminationGracePeriodSeconds: {{ .Values.bookkeeper.gracePeriod }}
|
terminationGracePeriodSeconds: {{ .Values.bookkeeper.gracePeriod }}
|
||||||
initContainers:
|
initContainers:
|
||||||
|
|||||||
@ -60,13 +60,14 @@ spec:
|
|||||||
affinity:
|
affinity:
|
||||||
{{- if and .Values.affinity.anti_affinity .Values.broker.affinity.anti_affinity}}
|
{{- if and .Values.affinity.anti_affinity .Values.broker.affinity.anti_affinity}}
|
||||||
podAntiAffinity:
|
podAntiAffinity:
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
{{ if eq .Values.broker.affinity.type "requiredDuringSchedulingIgnoredDuringExecution"}}
|
||||||
|
{{ .Values.broker.affinity.type }}:
|
||||||
- labelSelector:
|
- labelSelector:
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
- key: "app"
|
- key: "app"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
- "{{ template "pulsar.name" . }}-{{ .Values.broker.component }}"
|
- "{{ template "pulsar.name" . }}"
|
||||||
- key: "release"
|
- key: "release"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
@ -76,6 +77,26 @@ spec:
|
|||||||
values:
|
values:
|
||||||
- {{ .Values.broker.component }}
|
- {{ .Values.broker.component }}
|
||||||
topologyKey: "kubernetes.io/hostname"
|
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 }}
|
{{- end }}
|
||||||
terminationGracePeriodSeconds: {{ .Values.broker.gracePeriod }}
|
terminationGracePeriodSeconds: {{ .Values.broker.gracePeriod }}
|
||||||
initContainers:
|
initContainers:
|
||||||
|
|||||||
@ -59,13 +59,14 @@ spec:
|
|||||||
affinity:
|
affinity:
|
||||||
{{- if and .Values.affinity.anti_affinity .Values.proxy.affinity.anti_affinity}}
|
{{- if and .Values.affinity.anti_affinity .Values.proxy.affinity.anti_affinity}}
|
||||||
podAntiAffinity:
|
podAntiAffinity:
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
{{ if eq .Values.proxy.affinity.type "requiredDuringSchedulingIgnoredDuringExecution"}}
|
||||||
|
{{ .Values.proxy.affinity.type }}:
|
||||||
- labelSelector:
|
- labelSelector:
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
- key: "app"
|
- key: "app"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
- "{{ template "pulsar.name" . }}-{{ .Values.proxy.component }}"
|
- "{{ template "pulsar.name" . }}"
|
||||||
- key: "release"
|
- key: "release"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
@ -75,6 +76,26 @@ spec:
|
|||||||
values:
|
values:
|
||||||
- {{ .Values.proxy.component }}
|
- {{ .Values.proxy.component }}
|
||||||
topologyKey: "kubernetes.io/hostname"
|
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 }}
|
{{- end }}
|
||||||
terminationGracePeriodSeconds: {{ .Values.proxy.gracePeriod }}
|
terminationGracePeriodSeconds: {{ .Values.proxy.gracePeriod }}
|
||||||
initContainers:
|
initContainers:
|
||||||
|
|||||||
@ -56,13 +56,14 @@ spec:
|
|||||||
affinity:
|
affinity:
|
||||||
{{- if and .Values.affinity.anti_affinity .Values.zookeeper.affinity.anti_affinity}}
|
{{- if and .Values.affinity.anti_affinity .Values.zookeeper.affinity.anti_affinity}}
|
||||||
podAntiAffinity:
|
podAntiAffinity:
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
{{ if eq .Values.zookeeper.affinity.type "requiredDuringSchedulingIgnoredDuringExecution"}}
|
||||||
|
{{ .Values.zookeeper.affinity.type }}:
|
||||||
- labelSelector:
|
- labelSelector:
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
- key: "app"
|
- key: "app"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
- "{{ template "pulsar.name" . }}-{{ .Values.zookeeper.component }}"
|
- "{{ template "pulsar.name" . }}"
|
||||||
- key: "release"
|
- key: "release"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
@ -72,6 +73,26 @@ spec:
|
|||||||
values:
|
values:
|
||||||
- {{ .Values.zookeeper.component }}
|
- {{ .Values.zookeeper.component }}
|
||||||
topologyKey: "kubernetes.io/hostname"
|
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 }}
|
{{- end }}
|
||||||
terminationGracePeriodSeconds: {{ .Values.zookeeper.gracePeriod }}
|
terminationGracePeriodSeconds: {{ .Values.zookeeper.gracePeriod }}
|
||||||
containers:
|
containers:
|
||||||
|
|||||||
@ -66,6 +66,10 @@ volumes:
|
|||||||
## the `affinity.anti_affinity` settings to `false` for that component.
|
## the `affinity.anti_affinity` settings to `false` for that component.
|
||||||
affinity:
|
affinity:
|
||||||
anti_affinity: true
|
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
|
## Components
|
||||||
##
|
##
|
||||||
@ -285,6 +289,10 @@ zookeeper:
|
|||||||
periodSeconds: 30
|
periodSeconds: 30
|
||||||
affinity:
|
affinity:
|
||||||
anti_affinity: true
|
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:
|
annotations:
|
||||||
prometheus.io/scrape: "true"
|
prometheus.io/scrape: "true"
|
||||||
prometheus.io/port: "8000"
|
prometheus.io/port: "8000"
|
||||||
@ -391,6 +399,10 @@ bookkeeper:
|
|||||||
periodSeconds: 30
|
periodSeconds: 30
|
||||||
affinity:
|
affinity:
|
||||||
anti_affinity: true
|
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: {}
|
annotations: {}
|
||||||
tolerations: []
|
tolerations: []
|
||||||
gracePeriod: 30
|
gracePeriod: 30
|
||||||
@ -492,6 +504,10 @@ autorecovery:
|
|||||||
# cloud.google.com/gke-nodepool: default-pool
|
# cloud.google.com/gke-nodepool: default-pool
|
||||||
affinity:
|
affinity:
|
||||||
anti_affinity: true
|
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: {}
|
annotations: {}
|
||||||
# tolerations: []
|
# tolerations: []
|
||||||
gracePeriod: 30
|
gracePeriod: 30
|
||||||
@ -567,6 +583,10 @@ broker:
|
|||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
affinity:
|
affinity:
|
||||||
anti_affinity: true
|
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: {}
|
annotations: {}
|
||||||
tolerations: []
|
tolerations: []
|
||||||
gracePeriod: 30
|
gracePeriod: 30
|
||||||
@ -654,6 +674,10 @@ proxy:
|
|||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
affinity:
|
affinity:
|
||||||
anti_affinity: true
|
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: {}
|
annotations: {}
|
||||||
tolerations: []
|
tolerations: []
|
||||||
gracePeriod: 30
|
gracePeriod: 30
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user