Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
1586800
Use dedicated Secret type for externalized object Secrets (#2613)
pedjak Mar 31, 2026
ba1e4cb
🌱 OCPBUGS-60693, OCPBUGS-60958: Upgrade sigs.k8s.io/crdify v0.5.0 => …
camilamacedo86 Mar 31, 2026
10dc0bc
fix(e2e): replace ${TEST_NAMESPACE} with plain text in feature files …
perdasilva Apr 1, 2026
c304741
Bump boxcutter to v0.13.0 (#2617)
dtfranz Apr 1, 2026
95ef574
Move large-bundle-support design doc to docs/draft/concepts (#2618)
pedjak Apr 1, 2026
d8e13a3
Merge branch 'main' into synchronize
tmshort Apr 1, 2026
2fd11eb
UPSTREAM: <carry>: Add OpenShift specific files
dtfranz Oct 26, 2023
c094fdf
UPSTREAM: <carry>: Add new tests for single/own namespaces install modes
camilamacedo86 Oct 6, 2025
1c7219b
UPSTREAM: <carry>: Upgrade OCP image from 4.20 to 4.21
camilamacedo86 Oct 13, 2025
9881ade
UPSTREAM: <carry>: [Default Catalog Tests] - Change logic to get ocp …
camilamacedo86 Oct 13, 2025
e980a16
UPSTREAM: <carry>: Update OCP catalogs to v4.21
tmshort Oct 13, 2025
df858e1
UPSTREAM: <carry>: support singleown cases in disconnected
kuiwang02 Oct 16, 2025
aa48b1b
UPSTREAM: <carry>: fix cases 81696 and 74618 for product code changes
kuiwang02 Oct 17, 2025
0b33955
UPSTREAM: <carry>: Define Default timeouts and apply their usage accr…
camilamacedo86 Oct 22, 2025
5652035
UPSTREAM: <carry>: Update to new feature-gate options in helm
tmshort Oct 22, 2025
90d5911
UPSTREAM: <carry>: Fix flake for single/own ns tests by ensuring uniq…
camilamacedo86 Oct 22, 2025
c2a9861
UPSTREAM: <carry>: [OTE]: Enhance single/own ns based on review comme…
camilamacedo86 Oct 24, 2025
02ec38f
UPSTREAM: <carry>: Update OwnSingle template to use spec.config.inlin…
kuiwang02 Nov 3, 2025
d6be463
UPSTREAM: <carry>: [OTE]: Add webhook cleanup validation on extension…
camilamacedo86 Nov 4, 2025
8cfe4fc
UPSTREAM: <carry>: Add [OTP] to migrated cases
kuiwang02 Nov 7, 2025
ecbd1cf
UPSTREAM: <carry>: [OTE]: Upgrade dependencies used
camilamacedo86 Nov 5, 2025
4f81226
UPSTREAM: <carry>: fix(OTE): fix OpenShift Kubernetes replace version…
camilamacedo86 Nov 10, 2025
b4d1de4
UPSTREAM: <carry>: [Default Catalog Tests] Upgrade go 1.24.6 and depe…
camilamacedo86 Nov 11, 2025
91e8ae0
UPSTREAM: <carry>: add disconnected environment support with custom p…
kuiwang02 Nov 12, 2025
bec9855
UPSTREAM: <carry>: migrate jiazha test cases to OTE
jianzhangbjz Nov 14, 2025
8b94b7d
UPSTREAM: <carry>: migrate clustercatalog case to ote
Xia-Zhao-rh Oct 17, 2025
3bfb239
UPSTREAM: <carry>: migrate olmv1 QE stress cases
kuiwang02 Nov 20, 2025
ae67998
UPSTREAM: <carry>: Use busybox/httpd to simulate probes
tmshort Nov 25, 2025
397a69a
UPSTREAM: <carry>: migrate olmv1 QE cases
Xia-Zhao-rh Nov 25, 2025
0c1f829
UPSTREAM: <carry>: add agent for olmv1 qe cases
kuiwang02 Oct 21, 2025
2338c7b
UPSTREAM: <carry>: Disable upstream PodDisruptionBudget
tmshort Dec 3, 2025
45d3a03
UPSTREAM: <carry>: Add AGENTS.md for AI code contributions
rashmigottipati Dec 11, 2025
1fbdc3b
UPSTREAM: <carry>: address review comments through addl prompts
rashmigottipati Dec 11, 2025
524ba45
UPSTREAM: <carry>: addressing some more review comments
rashmigottipati Dec 11, 2025
e43200f
UPSTREAM: <carry>: remove DCO line
rashmigottipati Dec 11, 2025
190330c
UPSTREAM: <carry>: migrate bandrade test cases to OTE
bandrade Nov 18, 2025
d897b3f
UPSTREAM: <carry>: update metadata
bandrade Dec 3, 2025
7524079
UPSTREAM: <carry>: remove originalName
bandrade Dec 3, 2025
21585f1
UPSTREAM: <carry>: update 80458's timeout to 180s
jianzhangbjz Dec 8, 2025
5ed79d6
UPSTREAM: <carry>: update 83026 to specify the clustercatalog
jianzhangbjz Dec 15, 2025
5a2dbc0
UPSTREAM: <carry>: Update to golang 1.25 and ocp 4.22
oceanc80 Dec 18, 2025
4ed3224
UPSTREAM: <carry>: Use oc client for running e2e tests
pedjak Jan 13, 2026
c74822d
UPSTREAM: <carry>: Run upstream e2e tests tagged with `@catalogd-update`
pedjak Jan 14, 2026
7af7113
UPSTREAM: <carry>: enhance case to make it more stable
kuiwang02 Jan 6, 2026
06c95f2
UPSTREAM: <carry>: add service account to curl job
ehearne-redhat Jan 7, 2026
ace50c7
UPSTREAM: <carry>: move sa creation out of buildCurlJob()
ehearne-redhat Jan 8, 2026
c94cdcf
UPSTREAM: <carry>: comment out delete service account
ehearne-redhat Jan 9, 2026
9a427c9
UPSTREAM: <carry>: move defercleanup for sa for LIFO
ehearne-redhat Jan 9, 2026
cb3d915
UPSTREAM: <carry>: add polling so job fully deleted before proceed
ehearne-redhat Jan 12, 2026
0f659f7
UPSTREAM: <carry>: Revert "Merge pull request #594 from ehearne-redha…
sosiouxme Jan 20, 2026
8e83e52
UPSTREAM: <carry>: Remove openshift-redhat-marketplace catalog tests
camilamacedo86 Jan 8, 2026
0b8905b
UPSTREAM: <carry>: config watchnamespace cases
kuiwang02 Jan 6, 2026
f7f02da
UPSTREAM: <carry>: enhance ocp-79770
Xia-Zhao-rh Jan 26, 2026
207830d
UPSTREAM: <carry>: upgrade version support case
kuiwang02 Jan 28, 2026
922a342
UPSTREAM: <carry>: Remove installed condition check from auth preflig…
Jan 30, 2026
8a0013c
UPSTREAM: <carry>: Add openshift/api dependency
Jan 30, 2026
cba6830
UPSTREAM: <carry>: Add boxcutter specific preflight auth test
Jan 30, 2026
1206737
UPSTREAM: <carry>: adjust watchnamespace case based on change
kuiwang02 Feb 2, 2026
9424722
UPSTREAM: <carry>: fix(ote): Use as operator-controller dep from root…
camilamacedo86 Feb 3, 2026
18d2b49
UPSTREAM: <carry>: add 83979 automation
bandrade Feb 2, 2026
8d8cfa3
UPSTREAM: <carry>: add 85889 automation
bandrade Feb 2, 2026
17b31c7
UPSTREAM: <carry>: Update test-operator startup script to fix pod pro…
Feb 4, 2026
a249349
UPSTREAM: <carry>: Fix up own-namespace invalid configuration test
Feb 7, 2026
57705f2
UPSTREAM: <carry>: Preflight tests use in-cluster catalog and bundles…
camilamacedo86 Feb 24, 2026
383ec02
UPSTREAM: <carry>: adjust sa and permission test cases per new change…
kuiwang02 Feb 2, 2026
9915735
UPSTREAM: <carry>: Update OCP catalogs to v4.22
camilamacedo86 Feb 3, 2026
e3c8399
UPSTREAM: <carry>: chore(OTE and Default Catalog Tests) Update go and…
camilamacedo86 Feb 26, 2026
5be0e4d
UPSTREAM: <carry>: fix 83026 for TP cluster
jianzhangbjz Feb 28, 2026
eaf3b2f
UPSTREAM: <carry>: serviceAccount validation unified across all runtimes
kuiwang02 Mar 6, 2026
a092136
UPSTREAM: <carry>: Fix OLMv1 test operator to listen on IPv6
stbenjam Mar 6, 2026
bd1d1dc
UPSTREAM: <carry>: Increase install timeout and add diagnostic loggin…
camilamacedo86 Mar 11, 2026
c35c5a4
UPSTREAM: <carry>: add service account to curl job
ehearne-redhat Mar 2, 2026
84ab8dc
UPSTREAM: <carry>: update OCP-75441 to support multi-arch
jianzhangbjz Mar 19, 2026
fd9f6ab
UPSTREAM: <carry>: deployment config cases
kuiwang02 Feb 6, 2026
2b32c1d
UPSTREAM: <carry>: Add OTE tests for OLMv1 DeploymentConfig support
tmshort Mar 11, 2026
f02b5fc
UPSTREAM: <carry>: Update openshift/api and client-go
tmshort Mar 19, 2026
def4067
UPSTREAM: <carry>: Add boxcutter tests
camilamacedo86 Mar 23, 2026
da1ea3d
UPSTREAM: <carry>: enhance QE cases
Xia-Zhao-rh Mar 17, 2026
cf687e9
UPSTREAM: <carry>: Update quay-operator version to one containing arm…
dtfranz Mar 24, 2026
231f247
UPSTREAM: <carry>: verify volume/volumeMount override
kuiwang02 Mar 25, 2026
20f6162
UPSTREAM: <carry>: Add long-duration test script and documents
jianzhangbjz Mar 11, 2026
ba3b095
UPSTREAM: <carry>: Update grpc in default-catalog-consistency tests
tmshort Mar 27, 2026
01584e3
UPSTREAM: <carry>: Rename ClusterExtensionRevision to ClusterObjectSe…
camilamacedo86 Mar 31, 2026
5423a55
UPSTREAM: <carry>: Skip incompatible operator test when Boxcutter use…
camilamacedo86 Mar 31, 2026
ffeda75
UPSTREAM: <carry>: add ocp-87557
bandrade Feb 8, 2026
d9c7dce
UPSTREAM: <carry>: Add fgiudici as reviewer
fgiudici Mar 31, 2026
9477103
UPSTREAM: <drop>: go mod vendor
tmshort Apr 1, 2026
10e615a
UPSTREAM: <drop>: remove upstream GitHub configuration
tmshort Apr 1, 2026
668f569
UPSTREAM: <drop>: configure the commit-checker
tmshort Apr 1, 2026
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
6 changes: 3 additions & 3 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ $(CONTROLLER_GEN): $(BINGO_DIR)/controller-gen.mod
@echo "(re)installing $(GOBIN)/controller-gen-v0.20.1"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=controller-gen.mod -o=$(GOBIN)/controller-gen-v0.20.1 "sigs.k8s.io/controller-tools/cmd/controller-gen"

CRD_DIFF := $(GOBIN)/crd-diff-v0.5.0
CRD_DIFF := $(GOBIN)/crd-diff-v0.5.1-0.20260309184313-54162f2e3097
$(CRD_DIFF): $(BINGO_DIR)/crd-diff.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/crd-diff-v0.5.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=crd-diff.mod -o=$(GOBIN)/crd-diff-v0.5.0 "sigs.k8s.io/crdify"
@echo "(re)installing $(GOBIN)/crd-diff-v0.5.1-0.20260309184313-54162f2e3097"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=crd-diff.mod -o=$(GOBIN)/crd-diff-v0.5.1-0.20260309184313-54162f2e3097 "sigs.k8s.io/crdify"

CRD_REF_DOCS := $(GOBIN)/crd-ref-docs-v0.3.0
$(CRD_REF_DOCS): $(BINGO_DIR)/crd-ref-docs.mod
Expand Down
2 changes: 1 addition & 1 deletion .bingo/crd-diff.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.24.6

require sigs.k8s.io/crdify v0.5.0
require sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097
2 changes: 2 additions & 0 deletions .bingo/crd-diff.sum
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ sigs.k8s.io/controller-runtime v0.16.2 h1:mwXAVuEk3EQf478PQwQ48zGOXvW27UJc8NHktQ
sigs.k8s.io/controller-runtime v0.16.2/go.mod h1:vpMu3LpI5sYWtujJOa2uPK61nB5rbwlN7BAB8aSLvGU=
sigs.k8s.io/crdify v0.5.0 h1:mrMH9CgXQPTZUpTU6Klqfnlys8bggv/7uvLT2lXSP7A=
sigs.k8s.io/crdify v0.5.0/go.mod h1:ZIFxaYNgKYmFtZCLPysncXQ8oqwnNlHQbRUfxJHZwzU=
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097 h1:gwDRFCc64lhEpxY944IJFW+CrmMFXWH+JjpE0JHp42Y=
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097/go.mod h1:ZIFxaYNgKYmFtZCLPysncXQ8oqwnNlHQbRUfxJHZwzU=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
Expand Down
2 changes: 1 addition & 1 deletion .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CONFTEST="${GOBIN}/conftest-v0.62.0"

CONTROLLER_GEN="${GOBIN}/controller-gen-v0.20.1"

CRD_DIFF="${GOBIN}/crd-diff-v0.5.0"
CRD_DIFF="${GOBIN}/crd-diff-v0.5.1-0.20260309184313-54162f2e3097"

CRD_REF_DOCS="${GOBIN}/crd-ref-docs-v0.3.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,19 @@ follow for consistency and safe lifecycle management.

Recommended conventions:

1. **Immutability**: Secrets should set `immutable: true`. Because COS phases
1. **Secret type**: Secrets should use the dedicated type
`olm.operatorframework.io/object-data` to distinguish them from user-created
Secrets and enable easy identification. The system always sets this type on
Secrets it creates. The reconciler does not enforce the type when resolving
refs — Secrets with any type are accepted — but producers should set it for
consistency.

2. **Immutability**: Secrets should set `immutable: true`. Because COS phases
are immutable, the content backing a ref should not change after creation.
Mutable referenced Secrets are not rejected, but modifying them after the
COS is created leads to undefined behavior.

2. **Owner references**: Referenced Secrets should carry an ownerReference to
3. **Owner references**: Referenced Secrets should carry an ownerReference to
the COS so that Kubernetes garbage collection removes them when the COS is
deleted:
```yaml
Expand All @@ -159,7 +166,7 @@ Recommended conventions:
Secret when the COS is deleted. The reconciler does not delete referenced
Secrets itself.

3. **Revision label**: A label identifying the owning revision aids discovery,
4. **Revision label**: A label identifying the owning revision aids discovery,
debugging, and bulk cleanup:
```
olm.operatorframework.io/revision-name: <COS-name>
Expand Down Expand Up @@ -237,6 +244,7 @@ metadata:
uid: <revision-uid>
controller: true
immutable: true
type: olm.operatorframework.io/object-data
data:
service-account: <base64(JSON ServiceAccount manifest)>
cluster-role: <base64(JSON ClusterRole manifest)>
Expand All @@ -255,6 +263,7 @@ metadata:
uid: <revision-uid>
controller: true
immutable: true
type: olm.operatorframework.io/object-data
data:
my-crd: <base64(JSON CRD manifest)>
---
Expand All @@ -272,6 +281,7 @@ metadata:
uid: <revision-uid>
controller: true
immutable: true
type: olm.operatorframework.io/object-data
data:
deployment: <base64(JSON Deployment manifest)>
```
Expand Down Expand Up @@ -653,7 +663,7 @@ rollout semantics are unchanged.
| **Crash safety** | 3-step: Secrets → COS → patch ownerRefs; orphan cleanup via revision label | 2-step: COS → Secrets with ownerRefs; simpler but reconciler may see missing Secrets temporarily |
| **Flexibility** | Mixed inline/ref per object within the same phase is possible | All-or-nothing — either all phases inline or all externalized |
| **Storage efficiency** | Per-object compression misses cross-object redundancy; potentially more Secrets created in edge cases | Better compression from cross-phase redundancy; fewer Secrets |
| **Resource type** | Secret only | Secret only (with dedicated type) |
| **Resource type** | Secret with dedicated type `olm.operatorframework.io/object-data` | Secret with dedicated type `olm.operatorframework.io/revision-phase-data` |
| **Phases structure** | Unchanged — phases array preserved as-is; only individual objects gain a new resolution path | Replaced at the top level — phases field swapped for phasesRef |
| **Content addressability** | Content hash as Secret data key — key changes when content changes | Content hash embedded in Secret name — detects changes without fetching contents |

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ require (
k8s.io/klog/v2 v2.140.0
k8s.io/kubernetes v1.35.0
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5
pkg.package-operator.run/boxcutter v0.12.0
pkg.package-operator.run/boxcutter v0.13.0
sigs.k8s.io/controller-runtime v0.23.3
sigs.k8s.io/controller-tools v0.20.1
sigs.k8s.io/crdify v0.5.0
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097
sigs.k8s.io/structured-merge-diff/v6 v6.3.2
sigs.k8s.io/yaml v1.6.0
)
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -796,16 +796,16 @@ k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbe
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
oras.land/oras-go/v2 v2.6.0 h1:X4ELRsiGkrbeox69+9tzTu492FMUu7zJQW6eJU+I2oc=
oras.land/oras-go/v2 v2.6.0/go.mod h1:magiQDfG6H1O9APp+rOsvCPcW1GD2MM7vgnKY0Y+u1o=
pkg.package-operator.run/boxcutter v0.12.0 h1:9XAi8MjwghfNHyuWzhqrEjY+XIGUz2rg+A72KITb+wA=
pkg.package-operator.run/boxcutter v0.12.0/go.mod h1:Bo1tgiXCYJtehp5p+2aTrKt7VnJhrGKSSBvUQofnDRg=
pkg.package-operator.run/boxcutter v0.13.0 h1:LNUS36NFkI+6J1CcVMrmTOtZt8UoalwXcIDlTPG66C4=
pkg.package-operator.run/boxcutter v0.13.0/go.mod h1:Bo1tgiXCYJtehp5p+2aTrKt7VnJhrGKSSBvUQofnDRg=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/controller-runtime v0.23.3 h1:VjB/vhoPoA9l1kEKZHBMnQF33tdCLQKJtydy4iqwZ80=
sigs.k8s.io/controller-runtime v0.23.3/go.mod h1:B6COOxKptp+YaUT5q4l6LqUJTRpizbgf9KSRNdQGns0=
sigs.k8s.io/controller-tools v0.20.1 h1:gkfMt9YodI0K85oT8rVi80NTXO/kDmabKR5Ajn5GYxs=
sigs.k8s.io/controller-tools v0.20.1/go.mod h1:b4qPmjGU3iZwqn34alUU5tILhNa9+VXK+J3QV0fT/uU=
sigs.k8s.io/crdify v0.5.0 h1:mrMH9CgXQPTZUpTU6Klqfnlys8bggv/7uvLT2lXSP7A=
sigs.k8s.io/crdify v0.5.0/go.mod h1:ZIFxaYNgKYmFtZCLPysncXQ8oqwnNlHQbRUfxJHZwzU=
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097 h1:gwDRFCc64lhEpxY944IJFW+CrmMFXWH+JjpE0JHp42Y=
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097/go.mod h1:ZIFxaYNgKYmFtZCLPysncXQ8oqwnNlHQbRUfxJHZwzU=
sigs.k8s.io/gateway-api v1.5.0 h1:duoo14Ky/fJXpjpmyMISE2RTBGnfCg8zICfTYLTnBJA=
sigs.k8s.io/gateway-api v1.5.0/go.mod h1:GvCETiaMAlLym5CovLxGjS0NysqFk3+Yuq3/rh6QL2o=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
Expand Down
63 changes: 0 additions & 63 deletions internal/operator-controller/applier/phase.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@ package applier

import (
"cmp"
"encoding/json"
"fmt"
"slices"
"strings"

"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"pkg.package-operator.run/boxcutter/probing"
"sigs.k8s.io/controller-runtime/pkg/client"

ocv1ac "github.com/operator-framework/operator-controller/applyconfigurations/api/v1"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util"
)

// The following, with modifications, is taken from:
Expand Down Expand Up @@ -206,58 +198,3 @@ func PhaseSort(unsortedObjs []ocv1ac.ClusterObjectSetObjectApplyConfiguration) [

return phasesSorted
}

// FieldValueProbe checks if the value found at FieldPath matches the provided Value
type FieldValueProbe struct {
FieldPath, Value string
}

var _ probing.Prober = (*FieldValueProbe)(nil)

// Probe executes the probe.
func (fe *FieldValueProbe) Probe(obj client.Object) probing.Result {
uMap, err := util.ToUnstructured(obj)
if err != nil {
return probing.UnknownResult(fmt.Sprintf("failed to convert to unstructured: %v", err))
}
return fe.probe(uMap)
}

func (fv *FieldValueProbe) probe(obj *unstructured.Unstructured) probing.Result {
fieldPath := strings.Split(strings.Trim(fv.FieldPath, "."), ".")

fieldVal, ok, err := unstructured.NestedFieldCopy(obj.Object, fieldPath...)
if err != nil {
return probing.Result{
Status: probing.StatusFalse,
Messages: []string{fmt.Sprintf(`error locating key %q; %v`, fv.FieldPath, err)},
}
}
if !ok {
return probing.Result{
Status: probing.StatusFalse,
Messages: []string{fmt.Sprintf(`missing key: %q`, fv.FieldPath)},
}
}

if !equality.Semantic.DeepEqual(fieldVal, fv.Value) {
foundJSON, err := json.Marshal(fieldVal)
if err != nil {
foundJSON = []byte("<value marshal failed>")
}
expectedJSON, err := json.Marshal(fv.Value)
if err != nil {
expectedJSON = []byte("<value marshal failed>")
}

return probing.Result{
Status: probing.StatusFalse,
Messages: []string{fmt.Sprintf(`value at key %q != %q; expected: %s got: %s`, fv.FieldPath, fv.Value, expectedJSON, foundJSON)},
}
}

return probing.Result{
Status: probing.StatusTrue,
Messages: []string{fmt.Sprintf(`value at key %q == %q`, fv.FieldPath, fv.Value)},
}
}
84 changes: 0 additions & 84 deletions internal/operator-controller/applier/phase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@ package applier_test
import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/utils/ptr"
"pkg.package-operator.run/boxcutter/probing"
"sigs.k8s.io/controller-runtime/pkg/client"

ocv1ac "github.com/operator-framework/operator-controller/applyconfigurations/api/v1"
"github.com/operator-framework/operator-controller/internal/operator-controller/applier"
Expand Down Expand Up @@ -1036,82 +1031,3 @@ func Test_PhaseSort(t *testing.T) {
})
}
}

func Test_FieldValueProbe(t *testing.T) {
for _, tc := range []struct {
name string
obj client.Object
probe applier.FieldValueProbe
expectedResult probing.Result
}{
{
name: "True result with found key and equal value",
obj: &corev1.Service{
TypeMeta: metav1.TypeMeta{Kind: "Service", APIVersion: "v1"},
ObjectMeta: metav1.ObjectMeta{Name: "my-service", Namespace: "my-namespace"},
},
probe: applier.FieldValueProbe{
FieldPath: "metadata.name",
Value: "my-service",
},
expectedResult: probing.Result{
Status: probing.StatusTrue,
Messages: []string{
`value at key "metadata.name" == "my-service"`,
},
},
},
{
name: "False result with unfound key",
obj: &corev1.Service{
TypeMeta: metav1.TypeMeta{Kind: "Service", APIVersion: "v1"},
ObjectMeta: metav1.ObjectMeta{Name: "my-service", Namespace: "my-namespace"},
},
probe: applier.FieldValueProbe{
FieldPath: "spec.foo",
Value: "my-service",
},
expectedResult: probing.Result{
Status: probing.StatusFalse,
Messages: []string{
`missing key: "spec.foo"`,
},
},
},
{
name: "False result with found key and unequal value",
obj: &corev1.Service{
TypeMeta: metav1.TypeMeta{Kind: "Service", APIVersion: "v1"},
ObjectMeta: metav1.ObjectMeta{Name: "my-service", Namespace: "my-namespace"},
},
probe: applier.FieldValueProbe{
FieldPath: "metadata.namespace",
Value: "bar",
},
expectedResult: probing.Result{
Status: probing.StatusFalse,
Messages: []string{
`value at key "metadata.namespace" != "bar"; expected: "bar" got: "my-namespace"`,
},
},
},
{
name: "Unknown result unstructured conversion failure",
obj: nil,
probe: applier.FieldValueProbe{
FieldPath: "metadata.name",
Value: "my-service",
},
expectedResult: probing.Result{
Status: probing.StatusUnknown,
Messages: []string{
"failed to convert to unstructured: object is nil",
},
},
},
} {
t.Run(tc.name, func(t *testing.T) {
assert.Equal(t, tc.expectedResult, tc.probe.Probe(tc.obj))
})
}
}
1 change: 1 addition & 0 deletions internal/operator-controller/applier/secretpacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func (p *SecretPacker) newSecret(data map[string][]byte) corev1.Secret {
},
},
Immutable: ptr.To(true),
Type: labels.SecretTypeObjectData,
Data: data,
}
}
Expand Down
1 change: 1 addition & 0 deletions internal/operator-controller/applier/secretpacker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func TestSecretPacker_Pack(t *testing.T) {
assert.True(t, strings.HasPrefix(result.Secrets[0].Name, "my-ext-3-"), "Secret name should be content-addressable with revision prefix")
assert.Equal(t, "olmv1-system", result.Secrets[0].Namespace)
assert.True(t, *result.Secrets[0].Immutable)
assert.Equal(t, labels.SecretTypeObjectData, result.Secrets[0].Type)
assert.Equal(t, "my-ext-3", result.Secrets[0].Labels[labels.RevisionNameKey])
assert.Equal(t, "my-ext", result.Secrets[0].Labels[labels.OwnerNameKey])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/source"

ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/operator-controller/applier"
"github.com/operator-framework/operator-controller/internal/operator-controller/labels"
)

Expand Down Expand Up @@ -643,7 +642,7 @@ func buildProgressionProbes(progressionProbes []ocv1.ProgressionProbe) (probing.
fieldsEqualProbe := probing.FieldsEqualProbe(probe.FieldsEqual)
assertions = append(assertions, &fieldsEqualProbe)
case ocv1.ProbeTypeFieldValue:
fieldValueProbe := applier.FieldValueProbe(probe.FieldValue)
fieldValueProbe := probing.FieldValueProbe(probe.FieldValue)
assertions = append(assertions, &fieldValueProbe)
default:
return nil, fmt.Errorf("unknown progressionProbe assertion probe type: %s", probe.Type)
Expand Down
7 changes: 7 additions & 0 deletions internal/operator-controller/labels/labels.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package labels

import corev1 "k8s.io/api/core/v1"

const (
// SecretTypeObjectData is the custom Secret type used for Secrets that store
// externalized object content referenced by ClusterObjectSet ref entries.
// It distinguishes OLM-managed ref Secrets from user-created Secrets.
SecretTypeObjectData corev1.SecretType = "olm.operatorframework.io/object-data" //nolint:gosec // G101 false positive: this is a Kubernetes Secret type identifier, not a credential

// OwnerKindKey is the label key used to record the kind of the owner
// resource responsible for creating or managing a ClusterObjectSet.
OwnerKindKey = "olm.operatorframework.io/owner-kind"
Expand Down
Loading