crossplane / crossplane-cli

Tools and commands for managing and developing Crossplane
Apache License 2.0
14 stars 12 forks source link

stack install fails for stacks with an image tag #22

Closed displague closed 4 years ago

displague commented 5 years ago

STACK_NAME appears to be optional in the stack install help. This is reasonable as a default STACK_NAME could be derived from the image name presented in the STACK_IMAGE_NAME (org/name:version).

$ kubectl crossplane stack install --help
Usage: kubectl crossplane stack install [-h|--help] [-c|--cluster] STACK_IMAGE_NAME [STACK_NAME [STACK_IMAGE_SOURCE]]
...

However, STACK_NAME appears to be required when using real-world images. I can see how local image names would not contain slashes ("/") and could potentially omit a version, so STACK_NAME may technically be optional today in some limited cases.

$ kubectl crossplane stack install --cluster crossplane/stack-gcp:v0.2.0
The ClusterStackInstall "crossplane-stack-gcp:v0.2.0" is invalid: metadata.name: Invalid value: "crossplane-stack-gcp:v0.2.0": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
suskin commented 5 years ago

Thanks @displague ! It appears that what's happening here is that the : is not being handled properly (or at all really). If we want to generate a default name from the image name, we'll want the code to account for : characters.

jbw976 commented 4 years ago

I ran into this as well, I think this will be a pretty common error to run into when using stack images that have a version tag (which itself is pretty common). It would be nice to fix this so that stacks with a version tag can install cleanly without having to supply the extra stack name option.

> kubectl crossplane stack install --cluster crossplane/stack-gcp:v0.3.1
The ClusterStackInstall "crossplane-stack-gcp:v0.3.1" is invalid: metadata.name: Invalid value:
 "crossplane-stack-gcp:v0.3.1": a DNS-1123 subdomain must consist of lower case alphanumeric 
characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex 
used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
jbw976 commented 4 years ago

I edited the title to reflect the common scenario that fails due to this issue

prasek commented 4 years ago

@jbw976 does this still repro?

jbw976 commented 4 years ago

I am able to reproduce this behavior still on the latest version, but only when not providing the positional name parameter. The documentation that we have in https://crossplane.io/docs/master/stacks-guide.html#install-support-for-our-application-into-crossplane provides that named parameter, so we won't hit this at least on mainline paths from the documentation.

We can punt on this and fix sometime in the future.