Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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=$?
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
18 changes: 9 additions & 9 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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] }
Expand Down
9 changes: 9 additions & 0 deletions internal/controller/postgrescluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
8 changes: 8 additions & 0 deletions internal/controller/postgrescluster/patroni.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
8 changes: 8 additions & 0 deletions internal/controller/postgrescluster/pgadmin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
24 changes: 12 additions & 12 deletions internal/controller/postgrescluster/pgbackrest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 10 additions & 4 deletions internal/controller/postgrescluster/pgbackrest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}},
}
Expand All @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions internal/controller/postgrescluster/pgbouncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
11 changes: 11 additions & 0 deletions pkg/apis/postgres-operator.crunchydata.com/v1beta1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand Down
Loading