-
Notifications
You must be signed in to change notification settings - Fork 37
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
[validation] check glanceAPI names are valid #587
Conversation
The glanceAPI controller creates StatefulSet for glanceapi to run. This adds a StatefulSet pod's label "controller-revision-hash": "<statefulset_name>-<hash>" to the pod. The kubernetes label is restricted under 63 char and the revision hash is an int32, 10 chars + the hyphen. Which results in a default statefulset max len of 52 chars. The statefulset name also contain the glance name and the glanceAPI type + 2 hyphens. So the max len also need to be reduced bye the length of those. Also the name of the created rabbitmq instance must match a lowercase RFC 1123. Depends-On: openstack-k8s-operators/lib-common#532 Jira: https://issues.redhat.com/browse/OSPRH-8063 Signed-off-by: Martin Schuppert <[email protected]>
The glanceAPI controller creates StatefulSet for glanceapi to run. This adds a StatefulSet pod's label "controller-revision-hash": "<statefulset_name>-<hash>" to the pod. The kubernetes label is restricted under 63 char and the revision hash is an int32, 10 chars + the hyphen. Which results in a default statefulset max len of 52 chars. The statefulset name also contain the glance name and the glanceAPI type + 2 hyphens. So the max len also need to be reduced bye the length of those. Also the name of the created rabbitmq instance must match a lowercase RFC 1123. Depends-On: openstack-k8s-operators/lib-common#532 Depends-On: openstack-k8s-operators/glance-operator#587 Jira: https://issues.redhat.com/browse/OSPRH-8063 Signed-off-by: Martin Schuppert <[email protected]>
@@ -215,6 +217,26 @@ func (r *Glance) ValidateCreate() (admission.Warnings, error) { | |||
glancelog.Info("validate create", "name", r.Name) | |||
var allErrs field.ErrorList | |||
basePath := field.NewPath("spec") | |||
|
|||
for key, glanceAPI := range r.Spec.GlanceAPIs { |
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.
I first had it in ValidateCreate for the GlanceSpecCore but then we'd have to pass down the glance name. I have no real preference, except that it we call the GlanceSpecCore from openstack-operator webhook and changing the params of the func will result in some CI dep madness.
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abays, stuggi 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 |
The glanceAPI controller creates StatefulSet for glanceapi to run. This adds a StatefulSet pod's label "controller-revision-hash": "<statefulset_name>-<hash>" to the pod. The kubernetes label is restricted under 63 char and the revision hash is an int32, 10 chars + the hyphen. Which results in a default statefulset max len of 52 chars. The statefulset name also contain the glance name and the glanceAPI type + 2 hyphens. So the max len also need to be reduced bye the length of those. Also the name of the created rabbitmq instance must match a lowercase RFC 1123. Depends-On: openstack-k8s-operators/lib-common#532 Depends-On: openstack-k8s-operators/glance-operator#587 Jira: https://issues.redhat.com/browse/OSPRH-8063 Signed-off-by: Martin Schuppert <[email protected]>
570173d
into
openstack-k8s-operators:main
The glanceAPI controller creates StatefulSet for glanceapi to run. This adds a StatefulSet pod's label "controller-revision-hash": "<statefulset_name>-<hash>" to the pod. The kubernetes label is restricted under 63 char and the revision hash is an int32, 10 chars + the hyphen. Which results in a default statefulset max len of 52 chars. The statefulset name also contain the glance name and the glanceAPI type + 2 hyphens. So the max len also need to be reduced bye the length of those. Also the name of the created rabbitmq instance must match a lowercase RFC 1123. Depends-On: openstack-k8s-operators/lib-common#532 Depends-On: openstack-k8s-operators/glance-operator#587 Jira: https://issues.redhat.com/browse/OSPRH-8063 Signed-off-by: Martin Schuppert <[email protected]>
The glanceAPI controller creates StatefulSet for glanceapi to run. This adds a StatefulSet pod's label "controller-revision-hash": "<statefulset_name>-<hash>" to the pod. The kubernetes label is restricted under 63 char and the revision hash is an int32, 10 chars + the hyphen. Which results in a default statefulset max len of 52 chars. The statefulset name also contain the glance name and the glanceAPI type + 2 hyphens. So the max len also need to be reduced bye the length of those. Also the name of the created rabbitmq instance must match a lowercase RFC 1123. Depends-On: openstack-k8s-operators/lib-common#532 Depends-On: openstack-k8s-operators/glance-operator#587 Jira: https://issues.redhat.com/browse/OSPRH-8063 Signed-off-by: Martin Schuppert <[email protected]>
The glanceAPI controller creates StatefulSet for glanceapi to run. This adds a StatefulSet pod's label "controller-revision-hash": "<statefulset_name>-<hash>" to the pod. The kubernetes label is restricted under 63 char and the revision hash is an int32, 10 chars + the hyphen. Which results in a default statefulset max len of 52 chars. The statefulset name also contain the glance name and the glanceAPI type + 2 hyphens. So the max len also need to be reduced bye the length of those. Also the name of the created rabbitmq instance must match a lowercase RFC 1123. Depends-On: openstack-k8s-operators/lib-common#532 Depends-On: openstack-k8s-operators/glance-operator#587 Jira: https://issues.redhat.com/browse/OSPRH-8063 Signed-off-by: Martin Schuppert <[email protected]>
The glanceAPI controller creates StatefulSet for glanceapi to run. This adds a StatefulSet pod's label "controller-revision-hash": "<statefulset_name>-<hash>" to the pod. The kubernetes label is restricted under 63 char and the revision hash is an int32, 10 chars + the hyphen. Which results in a default statefulset max len of 52 chars. The statefulset name also contain the glance name and the glanceAPI type + 2 hyphens. So the max len also need to be reduced bye the length of those. Also the name of the created rabbitmq instance must match a lowercase RFC 1123. Depends-On: openstack-k8s-operators/lib-common#532 Depends-On: openstack-k8s-operators/glance-operator#587 Jira: https://issues.redhat.com/browse/OSPRH-8063 Signed-off-by: Martin Schuppert <[email protected]>
The glanceAPI controller creates StatefulSet for glanceapi to run. This adds a StatefulSet pod's label
"controller-revision-hash": "<statefulset_name>-" to the pod.
The kubernetes label is restricted under 63 char and the revision hash is an int32, 10 chars + the hyphen. Which results in a default statefulset max len of 52 chars. The statefulset name also contain the glance name and the glanceAPI type + 2 hyphens. So the max len also need to be reduced bye the length of those.
Also the name of the created rabbitmq instance must match a lowercase RFC 1123.
Depends-On: openstack-k8s-operators/lib-common#532
Jira: https://issues.redhat.com/browse/OSPRH-8063