Skip to content

Commit

Permalink
Add template label to CRD
Browse files Browse the repository at this point in the history
Required for the policy framework to distribute OperatorPolicies.

Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
  • Loading branch information
JustinKuli committed Jan 30, 2024
1 parent 4e78199 commit 3546ee8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions deploy/crds/kustomize_operatorpolicy/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ patches:
version: v1
kind: CustomResourceDefinition
name: operatorpolicies.policy.open-cluster-management.io
- path: template-label.json
target:
group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
name: operatorpolicies.policy.open-cluster-management.io
7 changes: 7 additions & 0 deletions deploy/crds/kustomize_operatorpolicy/template-label.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"op":"add",
"path":"/metadata/labels",
"value": {"policy.open-cluster-management.io/policy-type": "template"}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
labels:
policy.open-cluster-management.io/policy-type: template
name: operatorpolicies.policy.open-cluster-management.io
spec:
group: policy.open-cluster-management.io
Expand Down
9 changes: 9 additions & 0 deletions test/e2e/case38_install_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ var _ = Describe("Test installing an operator from OperatorPolicy", Ordered, fun
It("Should report a mismatch when the OperatorGroup is manually edited", func() {
utils.Kubectl("patch", "operatorgroup", scopedOpGroupName, "-n", opPolTestNS, "--type=json", "-p",
`[{"op": "replace", "path": "/spec/targetNamespaces", "value": []}]`)

unstructGroup := utils.GetWithTimeout(clientManagedDynamic, gvrOperatorGroup, scopedOpGroupName,
opPolTestNS, true, opPolTimeout)

groupJSON, err := json.MarshalIndent(unstructGroup.Object, "", " ")
Expect(err).NotTo(HaveOccurred())

GinkgoWriter.Printf("Debug info for failure.\noperatorGroup JSON: %s\n", string(groupJSON))

check(
opPolName,
true,
Expand Down

0 comments on commit 3546ee8

Please sign in to comment.