Skip to content
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

Error: invalid format of image for tag with plus (+) in it. #3314

Closed
solarmosaic-kflorence opened this issue Dec 6, 2020 · 6 comments
Closed
Labels
area/cli Issues for kustomize CLI interface kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@solarmosaic-kflorence
Copy link

Describe the bug

Kustomize doesn't seem to accept + when editing the image tag with kustomize edit set image. Having + in an image tag is perfectly valid according to semver standards, but aside from that I don't know why kustomize is trying to do any kind of validation on the format of the image tag. That seems like logic that is outside the scope of what kustomize should be caring about here.

Expected output

I expect it to update the kustomization.yaml appropriately:

images:
- name: helloworld
  newTag: 0.0.1-20201204201331+09775be8

Actual output

Execute:
kustomize edit set image "helloworld:0.0.1-20201204201331+09775be8"

The result is:

Error: invalid format of image, use one of the following options:
- <image>=<newimage>:<newtag>
- <image>=<newimage>@<digest>
- <image>=<newimage>
- <image>:<newtag>
- <image>@<digest>
Usage:
  kustomize edit set image [flags]

Kustomize version

{Version:kustomize/v3.8.7 GitCommit:ad092cc7a91c07fdf63a2e4b7f13fa588a39af4f BuildDate:2020-11-12T01:08:43+00:00 GoOs:darwin GoArch:amd64}

Platform

Mac OS Catalina 10.15.7

Additional context

It turns out that Docker also does not currently support + in tags: distribution/distribution#1201 -- however, much like the issue here that seems like an unnecessary restriction that will be removed at some point in the future. May as well get ahead of that change here.

@Shell32-Natsu Shell32-Natsu added area/cli Issues for kustomize CLI interface kind/bug Categorizes issue or PR as related to a bug. labels Dec 7, 2020
@Shell32-Natsu
Copy link
Contributor

If Docker doesn't support +, why do you want to use it in the label?

@Shell32-Natsu Shell32-Natsu added the triage/needs-information Indicates an issue needs more information in order to work on it. label Dec 7, 2020
@solarmosaic-kflorence
Copy link
Author

@Shell32-Natsu Because Docker and Kustomize should not care what the format the image tag is (it is outside of their responsibilities), and using + is the correct way to represent build metadata according to Semantic Versioning, which is a widely used and adopted spec:

Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata MUST be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85, 1.0.0+21AF26D3—-117B344092BD.

@solarmosaic-kflorence
Copy link
Author

See also opencontainers/distribution-spec#154

@Shell32-Natsu
Copy link
Contributor

Shell32-Natsu commented Dec 7, 2020

Docker shouldn't care the + in the tag but actually it does. This command in kustomize checks the tag format to avoid indeliberate mistakes in tag. We are happy to allow it to pass the validation once the Docker support it.

@solarmosaic-kflorence
Copy link
Author

I still disagree that this should be a concern of kustomize, but at the very least @Shell32-Natsu you could add something to the documentation to indicate what a valid image tag is: https://kubectl.docs.kubernetes.io/references/kustomize/images/

@Shell32-Natsu
Copy link
Contributor

That doc page is for label transformer, not for edit label command. Add a description in command help message in #3354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Issues for kustomize CLI interface kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

2 participants