@@ -339,6 +339,81 @@ master pods from being evicted by the K8s runtime. To prevent eviction
339339completely, specify the toleration by leaving out the `tolerationSeconds` value
340340(similar to how Kubernetes' own DaemonSets are configured)
341341
342+ # # Node readiness labels
343+
344+ The operator can watch on certain node labels to detect e.g. the start of a
345+ Kubernetes cluster upgrade procedure and move master pods off the nodes to be
346+ decommissioned. Key-value pairs for these node readiness labels can be
347+ specified in the configuration (option name is in singular form) :
348+
349+ ` ` ` yaml
350+ apiVersion: v1
351+ kind: ConfigMap
352+ metadata:
353+ name: postgres-operator
354+ data:
355+ node_readiness_label: "status1:ready,status2:ready"
356+ ` ` `
357+
358+ ` ` ` yaml
359+ apiVersion: "acid.zalan.do/v1"
360+ kind: OperatorConfiguration
361+ metadata:
362+ name: postgresql-configuration
363+ configuration:
364+ kubernetes:
365+ node_readiness_label:
366+ status1: ready
367+ status2: ready
368+ ` ` `
369+
370+ The operator will create a `nodeAffinity` on the pods. This makes the
371+ ` node_readiness_label` option the global configuration for defining node
372+ affinities for all Postgres clusters. You can have both, cluster-specific and
373+ global affinity, defined and they will get merged on the pods. If
374+ ` node_readiness_label_merge` is configured to `"AND"` the node readiness
375+ affinity will end up under the same `matchExpressions` section(s) from the
376+ manifest affinity.
377+
378+ ` ` ` yaml
379+ affinity:
380+ nodeAffinity:
381+ requiredDuringSchedulingIgnoredDuringExecution:
382+ nodeSelectorTerms:
383+ - matchExpressions:
384+ - key: environment
385+ operator: In
386+ values:
387+ - pci
388+ - key: status1
389+ operator: In
390+ values:
391+ - ready
392+ - key: status2
393+ ...
394+ ` ` `
395+
396+ If `node_readiness_label_merge` is set to `"OR"` (default) the readiness label
397+ affinty will be appended with its own expressions block :
398+
399+ ` ` ` yaml
400+ affinity:
401+ nodeAffinity:
402+ requiredDuringSchedulingIgnoredDuringExecution:
403+ nodeSelectorTerms:
404+ - matchExpressions:
405+ - key: environment
406+ ...
407+ - matchExpressions:
408+ - key: storage
409+ ...
410+ - matchExpressions:
411+ - key: status1
412+ ...
413+ - key: status2
414+ ...
415+ ` ` `
416+
342417# # Enable pod anti affinity
343418
344419To ensure Postgres pods are running on different topologies, you can use
0 commit comments