You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add name length validations to project creation #1232
Ran into an issue where I was able to create project 'foo', but unable to push to the local docker registry because the name was too short. Add name length validations to project creation, server-side, and possibly to the client create project command.
Origin will proxy the namespace create request in Kube, so in theory, we can provide our own more restrictive validation once the docker registry constraints are better known. In practice, I am not a fan of needing to align project name validation with docker registry validation rules.
Is it not possible to adapt a project name to a valid docker registry name?
For example, if the project name is too short, can we not pad it when its used on the registry side?
@derekwaynecarr we could do that. However, if someone wanted to pull from/push to their image repository in our registry, they'd have to know the padding rules, as docker pull registry.openshift.com/a/myapp will fail.
So if we need to provide our own more restrictive validation that a project has a length between 2 and 30 characters, we can do that, but it limits our ability to expose any existing namespaces in Kuberentes as projects if/when Origin runs as pod on an existing Kubernetes cluster.
@liggitt a Docker image repository is made up of 1 or more components separated by slashes. Each component must be at least 2 characters, and the first character of each component must be alphanumeric. The total length of an image repository's name, including slashes, must be <= 255 characters.
I'd like to propose that we add validation somewhere that a namespace must be at least 2 characters, and then for ImageStreams, add validation that len(namespace + / + name) <= 255. Thoughts?
if we say a project with a single character name is invalid, that could block a project update to add an annotation to a project that was created as a namespace with a single-character name
Activity
derekwaynecarr commentedon Mar 5, 2015
Origin will proxy the namespace create request in Kube, so in theory, we can provide our own more restrictive validation once the docker registry constraints are better known. In practice, I am not a fan of needing to align project name validation with docker registry validation rules.
Is it not possible to adapt a project name to a valid docker registry name?
For example, if the project name is too short, can we not pad it when its used on the registry side?
ncdc commentedon Mar 5, 2015
@derekwaynecarr we could do that. However, if someone wanted to pull from/push to their image repository in our registry, they'd have to know the padding rules, as
docker pull registry.openshift.com/a/myappwill fail.derekwaynecarr commentedon Mar 5, 2015
If the padding rule is to meet a min-length of 2, it's not a lot of padding, so I am less concerned there.
I am more concerned on the max length constraint of 30 characters.
Kube restricts at a much higher level:
https://github.com/GoogleCloudPlatform/kubernetes/blob/master/pkg/util/validation.go#L52
ncdc commentedon Mar 5, 2015
I'm not overly concerned about 30; we're working with Docker to get that increased.
derekwaynecarr commentedon Mar 5, 2015
So if we need to provide our own more restrictive validation that a project has a length between 2 and 30 characters, we can do that, but it limits our ability to expose any existing namespaces in Kuberentes as projects if/when Origin runs as pod on an existing Kubernetes cluster.
liggitt commentedon May 8, 2015
@ncdc what did the length requirements end up being for the v2 registry?
ncdc commentedon May 8, 2015
@liggitt a Docker image repository is made up of 1 or more components separated by slashes. Each component must be at least 2 characters, and the first character of each component must be alphanumeric. The total length of an image repository's name, including slashes, must be <= 255 characters.
ncdc commentedon May 8, 2015
See https://github.com/docker/distribution/blob/master/registry/api/v2/names.go for the impl.
liggitt commentedon May 17, 2015
Also see https://bugzilla.redhat.com/show_bug.cgi?id=1190052
derekwaynecarr commentedon May 17, 2015
We proxy project creation so in theory we could further restrict validation.
Sent from my iPhone
liggitt commentedon May 17, 2015
We can, but maybe just on create? Don't want to prevent updating an existing namespace with a short name using the project proxy
ncdc commentedon May 19, 2015
I'd like to propose that we add validation somewhere that a namespace must be at least 2 characters, and then for ImageStreams, add validation that len(namespace + / + name) <= 255. Thoughts?
liggitt commentedon May 19, 2015
We can add validation on Project create (but not update) and for ImageStream.
derekwaynecarr commentedon May 19, 2015
A name is immutable post create, so it should not be a concern.
liggitt commentedon May 19, 2015
if we say a project with a single character name is invalid, that could block a project update to add an annotation to a project that was created as a namespace with a single-character name
liggitt commentedon May 19, 2015
we can also do namespace validation on image streams... not let them be created in single-character namespaces
Squashed 'cmd/service-catalog/go/src/github.com/kubernetes-incubator/…
Squashed 'cmd/service-catalog/go/src/github.com/kubernetes-incubator/…
Re-enable the href checker (openshift#1232)