-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix API Validation for OperatorGroup
Spec
#716
Fix API Validation for OperatorGroup
Spec
#716
Conversation
values: | ||
type: array | ||
description: set of values for the expression | ||
anyOf: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odd that this isn't required for standard kube objects?
{
"io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector": {
"description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.",
"properties": {
"matchExpressions": {
"description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.",
"items": {
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement"
},
"type": "array"
},
"matchLabels": {
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
},
"type": "object"
},
"io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement": {
"description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.",
"properties": {
"key": {
"description": "key is the label key that the selector applies to.",
"type": "string",
"x-kubernetes-patch-merge-key": "key",
"x-kubernetes-patch-strategy": "merge"
},
"operator": {
"description": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.",
"type": "string"
},
"values": {
"description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
}
From reading this it sounds like the correct behavior is to do runtime checks on these? You can set both and it will include matchLabels as part of the matchExperssion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The legacy selector
field accepted a list of key/value labels (now matchLabels
), so the upstream Kubernetes definition can't use anyOf
in order to preserve backwards-compatibility. We don't have that requirement, so anyOf
actually works (tested manually).
/test e2e-aws |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alecmerdler, ecordell The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
4 similar comments
/retest |
/retest |
/retest |
/retest |
Fix API Validation for `OperatorGroup` Spec
Description
Previously was not enforcing proper
selector
fields, causing this issue withcluster-monitoring-operator
.Addresses https://jira.coreos.com/browse/ALM-913