From eb08b6f12d7459ac766a8acb82f30129d7eaf640 Mon Sep 17 00:00:00 2001 From: TJ Moore Date: Mon, 27 Jan 2025 12:20:35 -0500 Subject: [PATCH 1/4] Improve the pgBackRest repo host RBAC test This commit updates the pgBackRest repo host RBAC test to ensure desired annotations are passed as expected. --- .../controller/postgrescluster/pgbackrest_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/controller/postgrescluster/pgbackrest_test.go b/internal/controller/postgrescluster/pgbackrest_test.go index b3934d0fd1..3db4e18b9f 100644 --- a/internal/controller/postgrescluster/pgbackrest_test.go +++ b/internal/controller/postgrescluster/pgbackrest_test.go @@ -727,10 +727,6 @@ func TestReconcilePGBackRestRBAC(t *testing.T) { } func TestReconcileRepoHostRBAC(t *testing.T) { - // Garbage collector cleans up test resources before the test completes - if strings.EqualFold(os.Getenv("USE_EXISTING_CLUSTER"), "true") { - t.Skip("USE_EXISTING_CLUSTER: Test fails due to garbage collection") - } ctx := context.Background() _, tClient := setupKubernetes(t) @@ -745,6 +741,15 @@ func TestReconcileRepoHostRBAC(t *testing.T) { // create a PostgresCluster to test with postgresCluster := fakePostgresCluster(clusterName, ns.GetName(), clusterUID, true) + // create an example AWS ARN annotation + annotations := map[string]string{ + "eks.amazonaws.com/role-arn": "arn:aws:iam::123456768901:role/allow_bucket_access", + } + // set the annotation on the cluster + postgresCluster.Spec.Metadata = &v1beta1.Metadata{ + Annotations: annotations, + } + postgresCluster.Status.PGBackRest = &v1beta1.PGBackRestStatus{ Repos: []v1beta1.RepoStatus{{Name: "repo1", StanzaCreated: false}}, } @@ -760,6 +765,7 @@ func TestReconcileRepoHostRBAC(t *testing.T) { Namespace: postgresCluster.GetNamespace(), }, sa) assert.NilError(t, err) + assert.DeepEqual(t, sa.Annotations, annotations) } func TestReconcileStanzaCreate(t *testing.T) { From c940bde35490750d205a1562e5212a1f7d8f490a Mon Sep 17 00:00:00 2001 From: ValClarkson Date: Mon, 27 Jan 2025 18:31:35 -0500 Subject: [PATCH 2/4] post-release updates --- .github/workflows/test.yaml | 44 ++++++++++++++++++------------------- Makefile | 2 +- config/manager/manager.yaml | 18 +++++++-------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a5ee4c5aa1..e04d9ef131 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -67,9 +67,9 @@ jobs: with: k3s-channel: "${{ matrix.kubernetes }}" prefetch-images: | - registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.54.0-0 - registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.23-2 - registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-1 + registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.54.1-0 + registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.23-3 + registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-2 - run: make createnamespaces check-envtest-existing env: @@ -90,7 +90,7 @@ jobs: strategy: fail-fast: false matrix: - kubernetes: [v1.31, v1.30, v1.29, v1.28] + kubernetes: [v1.32, v1.31, v1.30, v1.29, v1.28] steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 @@ -101,16 +101,16 @@ jobs: with: k3s-channel: "${{ matrix.kubernetes }}" prefetch-images: | - registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-33 - registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.54.0-0 - registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.23-2 + registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-34 + registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.54.1-0 + registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.23-3 registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:latest registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:latest - registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-1 - registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.3-1 - registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.4-1 - registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-17.2-1 - registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-17.2-3.4-1 + registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-2 + registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.3-2 + registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.4-2 + registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-17.2-2 + registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-17.2-3.4-2 - run: go mod download - name: Build executable run: PGO_VERSION='${{ github.sha }}' make build-postgres-operator @@ -132,17 +132,17 @@ jobs: --env 'CHECK_FOR_UPGRADES=false' \ --env 'QUERIES_CONFIG_DIR=/mnt/hack/tools/queries' \ --env 'KUBECONFIG=hack/.kube/postgres-operator/pgo' \ - --env 'RELATED_IMAGE_PGADMIN=registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-33' \ - --env 'RELATED_IMAGE_PGBACKREST=registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.54.0-0' \ - --env 'RELATED_IMAGE_PGBOUNCER=registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.23-2' \ + --env 'RELATED_IMAGE_PGADMIN=registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-34' \ + --env 'RELATED_IMAGE_PGBACKREST=registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.54.1-0' \ + --env 'RELATED_IMAGE_PGBOUNCER=registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.23-3' \ --env 'RELATED_IMAGE_PGEXPORTER=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:latest' \ --env 'RELATED_IMAGE_PGUPGRADE=registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:latest' \ - --env 'RELATED_IMAGE_POSTGRES_16=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-1' \ - --env 'RELATED_IMAGE_POSTGRES_16_GIS_3.3=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.3-1' \ - --env 'RELATED_IMAGE_POSTGRES_16_GIS_3.4=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.4-1' \ - --env 'RELATED_IMAGE_POSTGRES_17=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-17.2-1' \ - --env 'RELATED_IMAGE_POSTGRES_17_GIS_3.4=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-17.2-3.4-1' \ - --env 'RELATED_IMAGE_STANDALONE_PGADMIN=registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-8.14-0' \ + --env 'RELATED_IMAGE_POSTGRES_16=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-2' \ + --env 'RELATED_IMAGE_POSTGRES_16_GIS_3.3=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.3-2' \ + --env 'RELATED_IMAGE_POSTGRES_16_GIS_3.4=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.4-2' \ + --env 'RELATED_IMAGE_POSTGRES_17=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-17.2-2' \ + --env 'RELATED_IMAGE_POSTGRES_17_GIS_3.4=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-17.2-3.4-2' \ + --env 'RELATED_IMAGE_STANDALONE_PGADMIN=registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-8.14-1' \ --env 'PGO_FEATURE_GATES=TablespaceVolumes=true' \ --name 'postgres-operator' ubuntu \ postgres-operator @@ -157,7 +157,7 @@ jobs: KUTTL_PG_UPGRADE_TO_VERSION: '17' KUTTL_PG_VERSION: '16' KUTTL_POSTGIS_VERSION: '3.4' - KUTTL_PSQL_IMAGE: 'registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-1' + KUTTL_PSQL_IMAGE: 'registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-2' - run: | make check-kuttl && exit failed=$? diff --git a/Makefile b/Makefile index 345761f525..7e55cbd7c0 100644 --- a/Makefile +++ b/Makefile @@ -229,7 +229,7 @@ generate-kuttl: export KUTTL_PG_UPGRADE_FROM_VERSION ?= 15 generate-kuttl: export KUTTL_PG_UPGRADE_TO_VERSION ?= 16 generate-kuttl: export KUTTL_PG_VERSION ?= 16 generate-kuttl: export KUTTL_POSTGIS_VERSION ?= 3.4 -generate-kuttl: export KUTTL_PSQL_IMAGE ?= registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.3-1 +generate-kuttl: export KUTTL_PSQL_IMAGE ?= registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-2 generate-kuttl: export KUTTL_TEST_DELETE_NAMESPACE ?= kuttl-test-delete-namespace generate-kuttl: ## Generate kuttl tests [ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 78c5db5bf5..8fb6bcf007 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -23,27 +23,27 @@ spec: - name: CRUNCHY_DEBUG value: "true" - name: RELATED_IMAGE_POSTGRES_16 - value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-1" + value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-2" - name: RELATED_IMAGE_POSTGRES_16_GIS_3.3 - value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.3-1" + value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.3-2" - name: RELATED_IMAGE_POSTGRES_16_GIS_3.4 - value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.4-1" + value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.4-2" - name: RELATED_IMAGE_POSTGRES_17 - value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-17.2-1" + value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-17.2-2" - name: RELATED_IMAGE_POSTGRES_17_GIS_3.4 - value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-17.2-3.4-1" + value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-17.2-3.4-2" - name: RELATED_IMAGE_PGADMIN - value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-33" + value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-34" - name: RELATED_IMAGE_PGBACKREST - value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.54.0-0" + value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.54.1-0" - name: RELATED_IMAGE_PGBOUNCER - value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.23-2" + value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.23-3" - name: RELATED_IMAGE_PGEXPORTER value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:latest" - name: RELATED_IMAGE_PGUPGRADE value: "registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:latest" - name: RELATED_IMAGE_STANDALONE_PGADMIN - value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-8.14-0" + value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-8.14-1" securityContext: allowPrivilegeEscalation: false capabilities: { drop: [ALL] } From 072a19d31465d99963b52205885cd8e01c747f3a Mon Sep 17 00:00:00 2001 From: Caitlin Strong <64797074+caitlinstrong@users.noreply.github.com> Date: Tue, 28 Jan 2025 16:13:32 -0500 Subject: [PATCH 3/4] Reconcile cronjobs with cluster config file (#4075) --- .../controller/postgrescluster/pgbackrest.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/controller/postgrescluster/pgbackrest.go b/internal/controller/postgrescluster/pgbackrest.go index ae68864598..b823e2bd26 100644 --- a/internal/controller/postgrescluster/pgbackrest.go +++ b/internal/controller/postgrescluster/pgbackrest.go @@ -342,18 +342,6 @@ func (r *Reconciler) cleanupRepoResources(ctx context.Context, delete = false } } - case hasLabel(naming.LabelPGBackRestBackup): - if !backupsSpecFound { - break - } - // If a Job is identified for a repo that no longer exists in the spec then - // delete it. Otherwise add it to the slice and continue. - for _, repo := range postgresCluster.Spec.Backups.PGBackRest.Repos { - if repo.Name == owned.GetLabels()[naming.LabelPGBackRestRepo] { - ownedNoDelete = append(ownedNoDelete, owned) - delete = false - } - } case hasLabel(naming.LabelPGBackRestCronJob): if !backupsSpecFound { break @@ -368,6 +356,18 @@ func (r *Reconciler) cleanupRepoResources(ctx context.Context, break } } + case hasLabel(naming.LabelPGBackRestBackup): + if !backupsSpecFound { + break + } + // If a Job is identified for a repo that no longer exists in the spec then + // delete it. Otherwise add it to the slice and continue. + for _, repo := range postgresCluster.Spec.Backups.PGBackRest.Repos { + if repo.Name == owned.GetLabels()[naming.LabelPGBackRestRepo] { + ownedNoDelete = append(ownedNoDelete, owned) + delete = false + } + } case hasLabel(naming.LabelPGBackRestRestore): if !backupsSpecFound { break From 740400d7f70b42385528a23cc55790004e46114b Mon Sep 17 00:00:00 2001 From: Philip Hurst Date: Tue, 28 Jan 2025 19:13:41 -0500 Subject: [PATCH 4/4] Add support for IP Family Policy and IP Families (#4076) * add IP Family Policy to CRD * update controller logic for IP Family Policy * added IPFamilies to the CRD * update controller logic for IP Families and IP Family Policy * update enum validation for IPFamily * update to enum for IP Families * refactor to use the upstream type * updated controller logic to use upstream type * simplified IP Family assignment --------- Co-authored-by: Philip Hurst --- ...ator.crunchydata.com_postgresclusters.yaml | 68 +++++++++++++++++++ .../controller/postgrescluster/cluster.go | 9 +++ .../controller/postgrescluster/patroni.go | 8 +++ .../controller/postgrescluster/pgadmin.go | 8 +++ .../controller/postgrescluster/pgbouncer.go | 8 +++ .../v1beta1/shared_types.go | 11 +++ .../v1beta1/zz_generated.deepcopy.go | 10 +++ 7 files changed, 122 insertions(+) diff --git a/config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml b/config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml index 914440f580..edae909760 100644 --- a/config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml +++ b/config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml @@ -14663,6 +14663,23 @@ spec: - Local maxLength: 10 type: string + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + enum: + - IPv4 + - IPv6 + type: string + type: array + ipFamilyPolicy: + description: 'More info: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/' + enum: + - SingleStack + - PreferDualStack + - RequireDualStack + type: string metadata: description: Metadata contains metadata for custom resources properties: @@ -15005,6 +15022,23 @@ spec: - Local maxLength: 10 type: string + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + enum: + - IPv4 + - IPv6 + type: string + type: array + ipFamilyPolicy: + description: 'More info: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/' + enum: + - SingleStack + - PreferDualStack + - RequireDualStack + type: string metadata: description: Metadata contains metadata for custom resources properties: @@ -15053,6 +15087,23 @@ spec: - Local maxLength: 10 type: string + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + enum: + - IPv4 + - IPv6 + type: string + type: array + ipFamilyPolicy: + description: 'More info: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/' + enum: + - SingleStack + - PreferDualStack + - RequireDualStack + type: string metadata: description: Metadata contains metadata for custom resources properties: @@ -16749,6 +16800,23 @@ spec: - Local maxLength: 10 type: string + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + enum: + - IPv4 + - IPv6 + type: string + type: array + ipFamilyPolicy: + description: 'More info: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/' + enum: + - SingleStack + - PreferDualStack + - RequireDualStack + type: string metadata: description: Metadata contains metadata for custom resources properties: diff --git a/internal/controller/postgrescluster/cluster.go b/internal/controller/postgrescluster/cluster.go index 7e863fdadf..67544d621b 100644 --- a/internal/controller/postgrescluster/cluster.go +++ b/internal/controller/postgrescluster/cluster.go @@ -267,6 +267,15 @@ func (r *Reconciler) generateClusterReplicaService( } service.Spec.ExternalTrafficPolicy = initialize.FromPointer(spec.ExternalTrafficPolicy) service.Spec.InternalTrafficPolicy = spec.InternalTrafficPolicy + + // Set IPFamilyPolicy and IPFamilies + if spec.IPFamilyPolicy != nil { + service.Spec.IPFamilyPolicy = spec.IPFamilyPolicy + } + if len(spec.IPFamilies) > 0 { + service.Spec.IPFamilies = spec.IPFamilies + } + } service.Spec.Ports = []corev1.ServicePort{servicePort} diff --git a/internal/controller/postgrescluster/patroni.go b/internal/controller/postgrescluster/patroni.go index 293690a77b..995de75b61 100644 --- a/internal/controller/postgrescluster/patroni.go +++ b/internal/controller/postgrescluster/patroni.go @@ -271,6 +271,14 @@ func (r *Reconciler) generatePatroniLeaderLeaseService( } service.Spec.ExternalTrafficPolicy = initialize.FromPointer(spec.ExternalTrafficPolicy) service.Spec.InternalTrafficPolicy = spec.InternalTrafficPolicy + + // Set IPFamilyPolicy and IPFamilies + if spec.IPFamilyPolicy != nil { + service.Spec.IPFamilyPolicy = spec.IPFamilyPolicy + } + if len(spec.IPFamilies) > 0 { + service.Spec.IPFamilies = spec.IPFamilies + } } service.Spec.Ports = []corev1.ServicePort{servicePort} diff --git a/internal/controller/postgrescluster/pgadmin.go b/internal/controller/postgrescluster/pgadmin.go index f102405b47..40874aa1be 100644 --- a/internal/controller/postgrescluster/pgadmin.go +++ b/internal/controller/postgrescluster/pgadmin.go @@ -183,6 +183,14 @@ func (r *Reconciler) generatePGAdminService( } service.Spec.ExternalTrafficPolicy = initialize.FromPointer(spec.ExternalTrafficPolicy) service.Spec.InternalTrafficPolicy = spec.InternalTrafficPolicy + + // Set IPFamilyPolicy and IPFamilies + if spec.IPFamilyPolicy != nil { + service.Spec.IPFamilyPolicy = spec.IPFamilyPolicy + } + if len(spec.IPFamilies) > 0 { + service.Spec.IPFamilies = spec.IPFamilies + } } service.Spec.Ports = []corev1.ServicePort{servicePort} diff --git a/internal/controller/postgrescluster/pgbouncer.go b/internal/controller/postgrescluster/pgbouncer.go index eb71c189f6..1b9bb837f3 100644 --- a/internal/controller/postgrescluster/pgbouncer.go +++ b/internal/controller/postgrescluster/pgbouncer.go @@ -306,6 +306,14 @@ func (r *Reconciler) generatePGBouncerService( } service.Spec.ExternalTrafficPolicy = initialize.FromPointer(spec.ExternalTrafficPolicy) service.Spec.InternalTrafficPolicy = spec.InternalTrafficPolicy + + // Set IPFamilyPolicy and IPFamilies + if spec.IPFamilyPolicy != nil { + service.Spec.IPFamilyPolicy = spec.IPFamilyPolicy + } + if len(spec.IPFamilies) > 0 { + service.Spec.IPFamilies = spec.IPFamilies + } } service.Spec.Ports = []corev1.ServicePort{servicePort} diff --git a/pkg/apis/postgres-operator.crunchydata.com/v1beta1/shared_types.go b/pkg/apis/postgres-operator.crunchydata.com/v1beta1/shared_types.go index 6de2b35336..79de9ae5f3 100644 --- a/pkg/apis/postgres-operator.crunchydata.com/v1beta1/shared_types.go +++ b/pkg/apis/postgres-operator.crunchydata.com/v1beta1/shared_types.go @@ -20,6 +20,7 @@ type SchemalessObject map[string]any // DeepCopy creates a new SchemalessObject by copying the receiver. func (in SchemalessObject) DeepCopy() SchemalessObject { return runtime.DeepCopyJSON(in) + } type ServiceSpec struct { @@ -44,6 +45,16 @@ type ServiceSpec struct { // +kubebuilder:validation:Enum={ClusterIP,NodePort,LoadBalancer} Type string `json:"type"` + // More info: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/ + // --- + // +optional + // +kubebuilder:validation:Enum=SingleStack;PreferDualStack;RequireDualStack + IPFamilyPolicy *corev1.IPFamilyPolicy `json:"ipFamilyPolicy,omitempty"` + + // +optional + // +kubebuilder:validation:items:Enum={IPv4,IPv6} + IPFamilies []corev1.IPFamily `json:"ipFamilies,omitempty"` + // More info: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-policies // --- // Kubernetes assumes the evaluation cost of an enum value is very large. diff --git a/pkg/apis/postgres-operator.crunchydata.com/v1beta1/zz_generated.deepcopy.go b/pkg/apis/postgres-operator.crunchydata.com/v1beta1/zz_generated.deepcopy.go index 5eb63bd867..a9c87a7abd 100644 --- a/pkg/apis/postgres-operator.crunchydata.com/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/postgres-operator.crunchydata.com/v1beta1/zz_generated.deepcopy.go @@ -2213,6 +2213,16 @@ func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) { *out = new(int32) **out = **in } + if in.IPFamilyPolicy != nil { + in, out := &in.IPFamilyPolicy, &out.IPFamilyPolicy + *out = new(corev1.IPFamilyPolicy) + **out = **in + } + if in.IPFamilies != nil { + in, out := &in.IPFamilies, &out.IPFamilies + *out = make([]corev1.IPFamily, len(*in)) + copy(*out, *in) + } if in.InternalTrafficPolicy != nil { in, out := &in.InternalTrafficPolicy, &out.InternalTrafficPolicy *out = new(corev1.ServiceInternalTrafficPolicy)