From e2eb5e0731c77b0312cb3aead23bd1d61549db1b Mon Sep 17 00:00:00 2001 From: Patrick Lee Scott Date: Fri, 4 Sep 2026 12:21:36 -0500 Subject: [PATCH 1/2] fix: keep staged PSQL branches reconciling --- functions/branch/999-status.yaml.gotmpl | 3 + tests/test-branch/main.k | 13 +++- .../observed/cross-namespace-staged.yaml | 59 +++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 tests/test-branch/observed/cross-namespace-staged.yaml diff --git a/functions/branch/999-status.yaml.gotmpl b/functions/branch/999-status.yaml.gotmpl index 3b0edc6..a1296c6 100644 --- a/functions/branch/999-status.yaml.gotmpl +++ b/functions/branch/999-status.yaml.gotmpl @@ -7,6 +7,9 @@ --- apiVersion: {{ $xr.apiVersion }} kind: {{ $xr.kind }} +metadata: + annotations: + gotemplating.fn.crossplane.io/ready: {{ ternary "True" "False" $state.status.ready | quote }} status: ready: {{ $state.status.ready }} bootstrapPhase: {{ $state.status.bootstrapPhase | quote }} diff --git a/tests/test-branch/main.k b/tests/test-branch/main.k index 9194ca7..647ab5b 100644 --- a/tests/test-branch/main.k +++ b/tests/test-branch/main.k @@ -288,7 +288,9 @@ _items = [ # ========================================================================== # Cross-namespace, second reconcile: once the source snapshot is bound, - # the branch snapshot is rendered with a non-empty static content ref. + # the branch snapshot is rendered with a non-empty static content ref. The + # composite must remain pipeline-unready while those new resources are + # absent; otherwise auto-ready stalls the staged composition here. # ========================================================================== metav1alpha1.CompositionTest { metadata.name = "cross-ns-imports-source-handle-into-branch-content" @@ -348,6 +350,15 @@ _items = [ metadata.name = "br-x-branch-snapshot" spec.forProvider.manifest.spec.source.volumeSnapshotContentName = "preview-pr-1-br-x-6a6f418e5232e5cb-content" } + { + apiVersion = "hops.ops.com.ai/v1alpha1" + kind = "PSQLBranch" + metadata.name = "br-x" + status = { + ready = False + conditions = [{type = "Ready", status = "False"}] + } + } ] } } diff --git a/tests/test-branch/observed/cross-namespace-staged.yaml b/tests/test-branch/observed/cross-namespace-staged.yaml new file mode 100644 index 0000000..14d6baa --- /dev/null +++ b/tests/test-branch/observed/cross-namespace-staged.yaml @@ -0,0 +1,59 @@ +apiVersion: kubernetes.m.crossplane.io/v1alpha1 +kind: Object +metadata: + name: pr-142-source-cluster + namespace: preview-pr-142 + annotations: + crossplane.io/composition-resource-name: source-cluster + gotemplating.fn.crossplane.io/composition-resource-name: source-cluster +status: + conditions: + - type: Ready + status: "True" + atProvider: + manifest: + spec: + imageName: ghcr.io/cloudnative-pg/postgresql:17 + status: + phase: Cluster in healthy state +--- +apiVersion: kubernetes.m.crossplane.io/v1alpha1 +kind: Object +metadata: + name: pr-142-source-snapshot + namespace: preview-pr-142 + annotations: + crossplane.io/composition-resource-name: source-snapshot + gotemplating.fn.crossplane.io/composition-resource-name: source-snapshot +status: + conditions: + - type: Ready + status: "True" + atProvider: + manifest: + status: + boundVolumeSnapshotContentName: source-content + readyToUse: true +--- +apiVersion: kubernetes.m.crossplane.io/v1alpha1 +kind: Object +metadata: + name: pr-142-source-snapshot-content + namespace: preview-pr-142 + annotations: + crossplane.io/composition-resource-name: source-snapshot-content + gotemplating.fn.crossplane.io/composition-resource-name: source-snapshot-content +status: + conditions: + - type: Ready + status: "True" + atProvider: + manifest: + spec: + driver: ebs.csi.eks.amazonaws.com + source: + snapshotHandle: snap-0123456789abcdef0 + sourceVolumeMode: Filesystem + volumeSnapshotClassName: psql + status: + readyToUse: true From 8b65157f504f393771a775447243ddaf35bb6a2a Mon Sep 17 00:00:00 2001 From: Patrick Lee Scott Date: Fri, 4 Sep 2026 12:25:51 -0500 Subject: [PATCH 2/2] test: assert staged branch pipeline readiness --- tests/test-branch/main.k | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test-branch/main.k b/tests/test-branch/main.k index 647ab5b..1d3cbd2 100644 --- a/tests/test-branch/main.k +++ b/tests/test-branch/main.k @@ -356,7 +356,11 @@ _items = [ metadata.name = "br-x" status = { ready = False - conditions = [{type = "Ready", status = "False"}] + conditions = [ + {type = "Responsive", status = "True"} + {type = "Synced", status = "True"} + {type = "Ready", status = "False"} + ] } } ]