Support podAffinity and podAntiAffinity for SGCluster

Problem to solve

Support podAffinity and podAntiFinity in the SGCluster custom resource.

Proposal

Proposed section to map to .spec.template.spec.affinity.podAffinity and .spec.template.spec.affinity.podAntiAffinity section of generated StatefulSet:

apiVersion: stackgres.io/v1
kind: SGCluster
spec:
  pods:
    scheduling:
      podAffinity: [ <object> ] # the same as https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#podaffinity-v1-core
      podAntiAffinity: [ <object> ] # the same as https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#podantiaffinity-v1-core

Acceptance Criteria

  • Implement the change in the SGCluster CRD
  • Implement the change in the REST API
  • Tests
  • Documentation

Links / references

Edited by Matteo Melli