Skip to content

Commit 3543249

Browse files
Merge pull request #691 from tmshort/synchronize
OCPBUGS-60693,OCPBUGS-60958: Synchronize From Upstream Repositories
2 parents ec6d60e + 668f569 commit 3543249

39 files changed

Lines changed: 1372 additions & 391 deletions

.bingo/Variables.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ $(CONTROLLER_GEN): $(BINGO_DIR)/controller-gen.mod
3535
@echo "(re)installing $(GOBIN)/controller-gen-v0.20.1"
3636
@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"
3737

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

4444
CRD_REF_DOCS := $(GOBIN)/crd-ref-docs-v0.3.0
4545
$(CRD_REF_DOCS): $(BINGO_DIR)/crd-ref-docs.mod

.bingo/crd-diff.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
22

33
go 1.24.6
44

5-
require sigs.k8s.io/crdify v0.5.0
5+
require sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097

.bingo/crd-diff.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ sigs.k8s.io/controller-runtime v0.16.2 h1:mwXAVuEk3EQf478PQwQ48zGOXvW27UJc8NHktQ
251251
sigs.k8s.io/controller-runtime v0.16.2/go.mod h1:vpMu3LpI5sYWtujJOa2uPK61nB5rbwlN7BAB8aSLvGU=
252252
sigs.k8s.io/crdify v0.5.0 h1:mrMH9CgXQPTZUpTU6Klqfnlys8bggv/7uvLT2lXSP7A=
253253
sigs.k8s.io/crdify v0.5.0/go.mod h1:ZIFxaYNgKYmFtZCLPysncXQ8oqwnNlHQbRUfxJHZwzU=
254+
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097 h1:gwDRFCc64lhEpxY944IJFW+CrmMFXWH+JjpE0JHp42Y=
255+
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097/go.mod h1:ZIFxaYNgKYmFtZCLPysncXQ8oqwnNlHQbRUfxJHZwzU=
254256
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
255257
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
256258
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=

.bingo/variables.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ CONFTEST="${GOBIN}/conftest-v0.62.0"
1414

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

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

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

docs/concepts/large-bundle-support.md renamed to docs/draft/concepts/large-bundle-support.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,19 @@ follow for consistency and safe lifecycle management.
139139

140140
Recommended conventions:
141141

142-
1. **Immutability**: Secrets should set `immutable: true`. Because COS phases
142+
1. **Secret type**: Secrets should use the dedicated type
143+
`olm.operatorframework.io/object-data` to distinguish them from user-created
144+
Secrets and enable easy identification. The system always sets this type on
145+
Secrets it creates. The reconciler does not enforce the type when resolving
146+
refs — Secrets with any type are accepted — but producers should set it for
147+
consistency.
148+
149+
2. **Immutability**: Secrets should set `immutable: true`. Because COS phases
143150
are immutable, the content backing a ref should not change after creation.
144151
Mutable referenced Secrets are not rejected, but modifying them after the
145152
COS is created leads to undefined behavior.
146153

147-
2. **Owner references**: Referenced Secrets should carry an ownerReference to
154+
3. **Owner references**: Referenced Secrets should carry an ownerReference to
148155
the COS so that Kubernetes garbage collection removes them when the COS is
149156
deleted:
150157
```yaml
@@ -159,7 +166,7 @@ Recommended conventions:
159166
Secret when the COS is deleted. The reconciler does not delete referenced
160167
Secrets itself.
161168
162-
3. **Revision label**: A label identifying the owning revision aids discovery,
169+
4. **Revision label**: A label identifying the owning revision aids discovery,
163170
debugging, and bulk cleanup:
164171
```
165172
olm.operatorframework.io/revision-name: <COS-name>
@@ -237,6 +244,7 @@ metadata:
237244
uid: <revision-uid>
238245
controller: true
239246
immutable: true
247+
type: olm.operatorframework.io/object-data
240248
data:
241249
service-account: <base64(JSON ServiceAccount manifest)>
242250
cluster-role: <base64(JSON ClusterRole manifest)>
@@ -255,6 +263,7 @@ metadata:
255263
uid: <revision-uid>
256264
controller: true
257265
immutable: true
266+
type: olm.operatorframework.io/object-data
258267
data:
259268
my-crd: <base64(JSON CRD manifest)>
260269
---
@@ -272,6 +281,7 @@ metadata:
272281
uid: <revision-uid>
273282
controller: true
274283
immutable: true
284+
type: olm.operatorframework.io/object-data
275285
data:
276286
deployment: <base64(JSON Deployment manifest)>
277287
```
@@ -653,7 +663,7 @@ rollout semantics are unchanged.
653663
| **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 |
654664
| **Flexibility** | Mixed inline/ref per object within the same phase is possible | All-or-nothing — either all phases inline or all externalized |
655665
| **Storage efficiency** | Per-object compression misses cross-object redundancy; potentially more Secrets created in edge cases | Better compression from cross-phase redundancy; fewer Secrets |
656-
| **Resource type** | Secret only | Secret only (with dedicated type) |
666+
| **Resource type** | Secret with dedicated type `olm.operatorframework.io/object-data` | Secret with dedicated type `olm.operatorframework.io/revision-phase-data` |
657667
| **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 |
658668
| **Content addressability** | Content hash as Secret data key — key changes when content changes | Content hash embedded in Secret name — detects changes without fetching contents |
659669

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ require (
4545
k8s.io/klog/v2 v2.140.0
4646
k8s.io/kubernetes v1.35.0
4747
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5
48-
pkg.package-operator.run/boxcutter v0.12.0
48+
pkg.package-operator.run/boxcutter v0.13.0
4949
sigs.k8s.io/controller-runtime v0.23.3
5050
sigs.k8s.io/controller-tools v0.20.1
51-
sigs.k8s.io/crdify v0.5.0
51+
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097
5252
sigs.k8s.io/structured-merge-diff/v6 v6.3.2
5353
sigs.k8s.io/yaml v1.6.0
5454
)

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -796,16 +796,16 @@ k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbe
796796
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
797797
oras.land/oras-go/v2 v2.6.0 h1:X4ELRsiGkrbeox69+9tzTu492FMUu7zJQW6eJU+I2oc=
798798
oras.land/oras-go/v2 v2.6.0/go.mod h1:magiQDfG6H1O9APp+rOsvCPcW1GD2MM7vgnKY0Y+u1o=
799-
pkg.package-operator.run/boxcutter v0.12.0 h1:9XAi8MjwghfNHyuWzhqrEjY+XIGUz2rg+A72KITb+wA=
800-
pkg.package-operator.run/boxcutter v0.12.0/go.mod h1:Bo1tgiXCYJtehp5p+2aTrKt7VnJhrGKSSBvUQofnDRg=
799+
pkg.package-operator.run/boxcutter v0.13.0 h1:LNUS36NFkI+6J1CcVMrmTOtZt8UoalwXcIDlTPG66C4=
800+
pkg.package-operator.run/boxcutter v0.13.0/go.mod h1:Bo1tgiXCYJtehp5p+2aTrKt7VnJhrGKSSBvUQofnDRg=
801801
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec=
802802
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
803803
sigs.k8s.io/controller-runtime v0.23.3 h1:VjB/vhoPoA9l1kEKZHBMnQF33tdCLQKJtydy4iqwZ80=
804804
sigs.k8s.io/controller-runtime v0.23.3/go.mod h1:B6COOxKptp+YaUT5q4l6LqUJTRpizbgf9KSRNdQGns0=
805805
sigs.k8s.io/controller-tools v0.20.1 h1:gkfMt9YodI0K85oT8rVi80NTXO/kDmabKR5Ajn5GYxs=
806806
sigs.k8s.io/controller-tools v0.20.1/go.mod h1:b4qPmjGU3iZwqn34alUU5tILhNa9+VXK+J3QV0fT/uU=
807-
sigs.k8s.io/crdify v0.5.0 h1:mrMH9CgXQPTZUpTU6Klqfnlys8bggv/7uvLT2lXSP7A=
808-
sigs.k8s.io/crdify v0.5.0/go.mod h1:ZIFxaYNgKYmFtZCLPysncXQ8oqwnNlHQbRUfxJHZwzU=
807+
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097 h1:gwDRFCc64lhEpxY944IJFW+CrmMFXWH+JjpE0JHp42Y=
808+
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097/go.mod h1:ZIFxaYNgKYmFtZCLPysncXQ8oqwnNlHQbRUfxJHZwzU=
809809
sigs.k8s.io/gateway-api v1.5.0 h1:duoo14Ky/fJXpjpmyMISE2RTBGnfCg8zICfTYLTnBJA=
810810
sigs.k8s.io/gateway-api v1.5.0/go.mod h1:GvCETiaMAlLym5CovLxGjS0NysqFk3+Yuq3/rh6QL2o=
811811
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=

internal/operator-controller/applier/phase.go

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,11 @@ package applier
22

33
import (
44
"cmp"
5-
"encoding/json"
6-
"fmt"
75
"slices"
8-
"strings"
96

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

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

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

207199
return phasesSorted
208200
}
209-
210-
// FieldValueProbe checks if the value found at FieldPath matches the provided Value
211-
type FieldValueProbe struct {
212-
FieldPath, Value string
213-
}
214-
215-
var _ probing.Prober = (*FieldValueProbe)(nil)
216-
217-
// Probe executes the probe.
218-
func (fe *FieldValueProbe) Probe(obj client.Object) probing.Result {
219-
uMap, err := util.ToUnstructured(obj)
220-
if err != nil {
221-
return probing.UnknownResult(fmt.Sprintf("failed to convert to unstructured: %v", err))
222-
}
223-
return fe.probe(uMap)
224-
}
225-
226-
func (fv *FieldValueProbe) probe(obj *unstructured.Unstructured) probing.Result {
227-
fieldPath := strings.Split(strings.Trim(fv.FieldPath, "."), ".")
228-
229-
fieldVal, ok, err := unstructured.NestedFieldCopy(obj.Object, fieldPath...)
230-
if err != nil {
231-
return probing.Result{
232-
Status: probing.StatusFalse,
233-
Messages: []string{fmt.Sprintf(`error locating key %q; %v`, fv.FieldPath, err)},
234-
}
235-
}
236-
if !ok {
237-
return probing.Result{
238-
Status: probing.StatusFalse,
239-
Messages: []string{fmt.Sprintf(`missing key: %q`, fv.FieldPath)},
240-
}
241-
}
242-
243-
if !equality.Semantic.DeepEqual(fieldVal, fv.Value) {
244-
foundJSON, err := json.Marshal(fieldVal)
245-
if err != nil {
246-
foundJSON = []byte("<value marshal failed>")
247-
}
248-
expectedJSON, err := json.Marshal(fv.Value)
249-
if err != nil {
250-
expectedJSON = []byte("<value marshal failed>")
251-
}
252-
253-
return probing.Result{
254-
Status: probing.StatusFalse,
255-
Messages: []string{fmt.Sprintf(`value at key %q != %q; expected: %s got: %s`, fv.FieldPath, fv.Value, expectedJSON, foundJSON)},
256-
}
257-
}
258-
259-
return probing.Result{
260-
Status: probing.StatusTrue,
261-
Messages: []string{fmt.Sprintf(`value at key %q == %q`, fv.FieldPath, fv.Value)},
262-
}
263-
}

internal/operator-controller/applier/phase_test.go

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@ package applier_test
33
import (
44
"testing"
55

6-
"github.com/stretchr/testify/assert"
76
"github.com/stretchr/testify/require"
8-
corev1 "k8s.io/api/core/v1"
9-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
107
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
118
"k8s.io/utils/ptr"
12-
"pkg.package-operator.run/boxcutter/probing"
13-
"sigs.k8s.io/controller-runtime/pkg/client"
149

1510
ocv1ac "github.com/operator-framework/operator-controller/applyconfigurations/api/v1"
1611
"github.com/operator-framework/operator-controller/internal/operator-controller/applier"
@@ -1036,82 +1031,3 @@ func Test_PhaseSort(t *testing.T) {
10361031
})
10371032
}
10381033
}
1039-
1040-
func Test_FieldValueProbe(t *testing.T) {
1041-
for _, tc := range []struct {
1042-
name string
1043-
obj client.Object
1044-
probe applier.FieldValueProbe
1045-
expectedResult probing.Result
1046-
}{
1047-
{
1048-
name: "True result with found key and equal value",
1049-
obj: &corev1.Service{
1050-
TypeMeta: metav1.TypeMeta{Kind: "Service", APIVersion: "v1"},
1051-
ObjectMeta: metav1.ObjectMeta{Name: "my-service", Namespace: "my-namespace"},
1052-
},
1053-
probe: applier.FieldValueProbe{
1054-
FieldPath: "metadata.name",
1055-
Value: "my-service",
1056-
},
1057-
expectedResult: probing.Result{
1058-
Status: probing.StatusTrue,
1059-
Messages: []string{
1060-
`value at key "metadata.name" == "my-service"`,
1061-
},
1062-
},
1063-
},
1064-
{
1065-
name: "False result with unfound key",
1066-
obj: &corev1.Service{
1067-
TypeMeta: metav1.TypeMeta{Kind: "Service", APIVersion: "v1"},
1068-
ObjectMeta: metav1.ObjectMeta{Name: "my-service", Namespace: "my-namespace"},
1069-
},
1070-
probe: applier.FieldValueProbe{
1071-
FieldPath: "spec.foo",
1072-
Value: "my-service",
1073-
},
1074-
expectedResult: probing.Result{
1075-
Status: probing.StatusFalse,
1076-
Messages: []string{
1077-
`missing key: "spec.foo"`,
1078-
},
1079-
},
1080-
},
1081-
{
1082-
name: "False result with found key and unequal value",
1083-
obj: &corev1.Service{
1084-
TypeMeta: metav1.TypeMeta{Kind: "Service", APIVersion: "v1"},
1085-
ObjectMeta: metav1.ObjectMeta{Name: "my-service", Namespace: "my-namespace"},
1086-
},
1087-
probe: applier.FieldValueProbe{
1088-
FieldPath: "metadata.namespace",
1089-
Value: "bar",
1090-
},
1091-
expectedResult: probing.Result{
1092-
Status: probing.StatusFalse,
1093-
Messages: []string{
1094-
`value at key "metadata.namespace" != "bar"; expected: "bar" got: "my-namespace"`,
1095-
},
1096-
},
1097-
},
1098-
{
1099-
name: "Unknown result unstructured conversion failure",
1100-
obj: nil,
1101-
probe: applier.FieldValueProbe{
1102-
FieldPath: "metadata.name",
1103-
Value: "my-service",
1104-
},
1105-
expectedResult: probing.Result{
1106-
Status: probing.StatusUnknown,
1107-
Messages: []string{
1108-
"failed to convert to unstructured: object is nil",
1109-
},
1110-
},
1111-
},
1112-
} {
1113-
t.Run(tc.name, func(t *testing.T) {
1114-
assert.Equal(t, tc.expectedResult, tc.probe.Probe(tc.obj))
1115-
})
1116-
}
1117-
}

internal/operator-controller/applier/secretpacker.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ func (p *SecretPacker) newSecret(data map[string][]byte) corev1.Secret {
143143
},
144144
},
145145
Immutable: ptr.To(true),
146+
Type: labels.SecretTypeObjectData,
146147
Data: data,
147148
}
148149
}

0 commit comments

Comments
 (0)