Skip to content

Commit a9736f0

Browse files
Merge pull request #744 from njhale/update-group-manifests
chore(manifests): regenerate manifests to include new anyOf validation
2 parents 8d22327 + 20739d3 commit a9736f0

File tree

11 files changed

+166
-137
lines changed

11 files changed

+166
-137
lines changed

deploy/ocp/manifests/0.8.1/0000_50_olm_09-operatorgroup.crd.yaml

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,41 @@ spec:
3232
selector:
3333
type: object
3434
description: Optional label selector to find resources associated with or managed by the operator
35-
properties:
36-
matchLabels:
37-
type: object
38-
description: Label key:value pairs to match directly
39-
matchExpressions:
40-
type: array
41-
description: A set of expressions to match against the resource.
42-
items:
43-
allOf:
44-
- type: object
45-
required:
46-
- key
47-
- operator
48-
- values
49-
properties:
50-
key:
51-
type: string
52-
description: the key to match
53-
operator:
54-
type: string
55-
description: the operator for the expression
56-
enum:
57-
- In
58-
- NotIn
59-
- Exists
60-
- DoesNotExist
61-
values:
62-
type: array
63-
description: set of values for the expression
35+
anyOf:
36+
- properties:
37+
matchLabels:
38+
type: object
39+
description: Label key:value pairs to match directly
40+
required:
41+
- matchLabels
42+
- properties:
43+
matchExpressions:
44+
type: array
45+
description: A set of expressions to match against the resource.
46+
items:
47+
allOf:
48+
- type: object
49+
required:
50+
- key
51+
- operator
52+
- values
53+
properties:
54+
key:
55+
type: string
56+
description: the key to match
57+
operator:
58+
type: string
59+
description: the operator for the expression
60+
enum:
61+
- In
62+
- NotIn
63+
- Exists
64+
- DoesNotExist
65+
values:
66+
type: array
67+
description: set of values for the expression
68+
required:
69+
- matchExpressions
6470
targetNamespaces:
6571
type: array
6672
description: Optional list of target namespaces. If set, OLM will ignore selector.

deploy/ocp/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ package:
3939
beta.kubernetes.io/os: linux
4040
node-role.kubernetes.io/master: ""
4141
tolerations:
42-
- operator: Exists
42+
- operator: Exists

deploy/okd/manifests/0.8.1/0000_50_olm_09-operatorgroup.crd.yaml

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,41 @@ spec:
3232
selector:
3333
type: object
3434
description: Optional label selector to find resources associated with or managed by the operator
35-
properties:
36-
matchLabels:
37-
type: object
38-
description: Label key:value pairs to match directly
39-
matchExpressions:
40-
type: array
41-
description: A set of expressions to match against the resource.
42-
items:
43-
allOf:
44-
- type: object
45-
required:
46-
- key
47-
- operator
48-
- values
49-
properties:
50-
key:
51-
type: string
52-
description: the key to match
53-
operator:
54-
type: string
55-
description: the operator for the expression
56-
enum:
57-
- In
58-
- NotIn
59-
- Exists
60-
- DoesNotExist
61-
values:
62-
type: array
63-
description: set of values for the expression
35+
anyOf:
36+
- properties:
37+
matchLabels:
38+
type: object
39+
description: Label key:value pairs to match directly
40+
required:
41+
- matchLabels
42+
- properties:
43+
matchExpressions:
44+
type: array
45+
description: A set of expressions to match against the resource.
46+
items:
47+
allOf:
48+
- type: object
49+
required:
50+
- key
51+
- operator
52+
- values
53+
properties:
54+
key:
55+
type: string
56+
description: the key to match
57+
operator:
58+
type: string
59+
description: the operator for the expression
60+
enum:
61+
- In
62+
- NotIn
63+
- Exists
64+
- DoesNotExist
65+
values:
66+
type: array
67+
description: set of values for the expression
68+
required:
69+
- matchExpressions
6470
targetNamespaces:
6571
type: array
6672
description: Optional list of target namespaces. If set, OLM will ignore selector.

deploy/upstream/manifests/0.8.1/0000_50_olm_09-operatorgroup.crd.yaml

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,41 @@ spec:
3232
selector:
3333
type: object
3434
description: Optional label selector to find resources associated with or managed by the operator
35-
properties:
36-
matchLabels:
37-
type: object
38-
description: Label key:value pairs to match directly
39-
matchExpressions:
40-
type: array
41-
description: A set of expressions to match against the resource.
42-
items:
43-
allOf:
44-
- type: object
45-
required:
46-
- key
47-
- operator
48-
- values
49-
properties:
50-
key:
51-
type: string
52-
description: the key to match
53-
operator:
54-
type: string
55-
description: the operator for the expression
56-
enum:
57-
- In
58-
- NotIn
59-
- Exists
60-
- DoesNotExist
61-
values:
62-
type: array
63-
description: set of values for the expression
35+
anyOf:
36+
- properties:
37+
matchLabels:
38+
type: object
39+
description: Label key:value pairs to match directly
40+
required:
41+
- matchLabels
42+
- properties:
43+
matchExpressions:
44+
type: array
45+
description: A set of expressions to match against the resource.
46+
items:
47+
allOf:
48+
- type: object
49+
required:
50+
- key
51+
- operator
52+
- values
53+
properties:
54+
key:
55+
type: string
56+
description: the key to match
57+
operator:
58+
type: string
59+
description: the operator for the expression
60+
enum:
61+
- In
62+
- NotIn
63+
- Exists
64+
- DoesNotExist
65+
values:
66+
type: array
67+
description: set of values for the expression
68+
required:
69+
- matchExpressions
6470
targetNamespaces:
6571
type: array
6672
description: Optional list of target namespaces. If set, OLM will ignore selector.

deploy/upstream/values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ writeStatusName: '""'
77
olm:
88
replicaCount: 1
99
image:
10-
ref: quay.io/openshift/origin-operator-lifecycle-manager:latest
10+
ref: quay.io/coreos/olm@sha256:995a181839f301585a0e115c083619b6d73812c58a8444d7b13b8e407010325f
1111
pullPolicy: IfNotPresent
1212
service:
1313
internalPort: 8080
1414
catalog:
1515
replicaCount: 1
1616
image:
17-
ref: quay.io/openshift/origin-operator-lifecycle-manager:latest
17+
ref: quay.io/coreos/olm@sha256:995a181839f301585a0e115c083619b6d73812c58a8444d7b13b8e407010325f
1818
pullPolicy: IfNotPresent
1919
service:
2020
internalPort: 8080
2121
package:
2222
replicaCount: 2
2323
image:
24-
ref: quay.io/openshift/origin-operator-lifecycle-manager:latest
24+
ref: quay.io/coreos/olm@sha256:995a181839f301585a0e115c083619b6d73812c58a8444d7b13b8e407010325f
2525
pullPolicy: Always
2626
service:
2727
internalPort: 5443

manifests/0000_50_olm_09-operatorgroup.crd.yaml

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,41 @@ spec:
3030
selector:
3131
type: object
3232
description: Optional label selector to find resources associated with or managed by the operator
33-
properties:
34-
matchLabels:
35-
type: object
36-
description: Label key:value pairs to match directly
37-
matchExpressions:
38-
type: array
39-
description: A set of expressions to match against the resource.
40-
items:
41-
allOf:
42-
- type: object
43-
required:
44-
- key
45-
- operator
46-
- values
47-
properties:
48-
key:
49-
type: string
50-
description: the key to match
51-
operator:
52-
type: string
53-
description: the operator for the expression
54-
enum:
55-
- In
56-
- NotIn
57-
- Exists
58-
- DoesNotExist
59-
values:
60-
type: array
61-
description: set of values for the expression
33+
anyOf:
34+
- properties:
35+
matchLabels:
36+
type: object
37+
description: Label key:value pairs to match directly
38+
required:
39+
- matchLabels
40+
- properties:
41+
matchExpressions:
42+
type: array
43+
description: A set of expressions to match against the resource.
44+
items:
45+
allOf:
46+
- type: object
47+
required:
48+
- key
49+
- operator
50+
- values
51+
properties:
52+
key:
53+
type: string
54+
description: the key to match
55+
operator:
56+
type: string
57+
description: the operator for the expression
58+
enum:
59+
- In
60+
- NotIn
61+
- Exists
62+
- DoesNotExist
63+
values:
64+
type: array
65+
description: set of values for the expression
66+
required:
67+
- matchExpressions
6268
targetNamespaces:
6369
type: array
6470
description: Optional list of target namespaces. If set, OLM will ignore selector.
@@ -85,4 +91,4 @@ spec:
8591
- lastUpdated
8692
type: object
8793
required:
88-
- metadata
94+
- metadata

pkg/api/apis/operators/v1alpha2/operatorgroup_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
type OperatorGroupSpec struct {
99
// Selector selects the OperatorGroup's target namespaces.
1010
// +optional
11-
Selector metav1.LabelSelector `json:"selector,omitempty"`
11+
Selector *metav1.LabelSelector `json:"selector,omitempty"`
1212

1313
// TargetNamespaces is an explicit set of namespaces to target.
1414
// If it is set, Selector is ignored.

pkg/api/apis/operators/v1alpha2/zz_generated.deepcopy.go

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/controller/operators/olm/operator_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2970,7 +2970,7 @@ func TestSyncOperatorGroups(t *testing.T) {
29702970
Namespace: operatorNamespace,
29712971
},
29722972
Spec: v1alpha2.OperatorGroupSpec{
2973-
Selector: metav1.LabelSelector{
2973+
Selector: &metav1.LabelSelector{
29742974
MatchLabels: map[string]string{"a": "app-a"},
29752975
},
29762976
},
@@ -3000,7 +3000,7 @@ func TestSyncOperatorGroups(t *testing.T) {
30003000
Namespace: operatorNamespace,
30013001
},
30023002
Spec: v1alpha2.OperatorGroupSpec{
3003-
Selector: metav1.LabelSelector{
3003+
Selector: &metav1.LabelSelector{
30043004
MatchLabels: map[string]string{"app": "app-a"},
30053005
},
30063006
},
@@ -3034,7 +3034,7 @@ func TestSyncOperatorGroups(t *testing.T) {
30343034
Namespace: operatorNamespace,
30353035
},
30363036
Spec: v1alpha2.OperatorGroupSpec{
3037-
Selector: metav1.LabelSelector{
3037+
Selector: &metav1.LabelSelector{
30383038
MatchLabels: map[string]string{"app": "app-a"},
30393039
},
30403040
},

pkg/controller/operators/olm/operatorgroup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ func namespacesChanged(clusterNamespaces []string, statusNamespaces []string) bo
560560
}
561561

562562
func (a *Operator) getOperatorGroupTargets(op *v1alpha2.OperatorGroup) ([]string, error) {
563-
selector, err := metav1.LabelSelectorAsSelector(&op.Spec.Selector)
563+
selector, err := metav1.LabelSelectorAsSelector(op.Spec.Selector)
564564
if err != nil {
565565
return nil, err
566566
}
@@ -573,7 +573,7 @@ func (a *Operator) getOperatorGroupTargets(op *v1alpha2.OperatorGroup) ([]string
573573
}
574574
namespaceSet[ns] = struct{}{}
575575
}
576-
} else if selector == nil || selector.Empty() {
576+
} else if selector == nil || selector.Empty() || selector == labels.Nothing() {
577577
namespaceSet[corev1.NamespaceAll] = struct{}{}
578578
} else {
579579
matchedNamespaces, err := a.lister.CoreV1().NamespaceLister().List(selector)

0 commit comments

Comments
 (0)