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

Refactor the publish.Namer, add --bare option for image naming #234

Merged
merged 3 commits into from
Nov 3, 2020

Conversation

mattmoor
Copy link
Collaborator

@mattmoor mattmoor commented Nov 2, 2020

In some environments (e.g. ECR) each repository needs to be pre-created, which gets tedious.

Given that ko does everything by digest, this collapses all of the images published into the same repository: ${KO_DOCKER_REPO} with no suffix to discriminate between images.

This is also beneficial from a security standpoint in certain contexts, as KO_DOCKER_REPO=docker.io/{user} might publish new repositories as public by default.

@mattmoor mattmoor changed the title Refactor the publish.Namer to produce the full repo name. Refactor the publish.Namer, add --naked option for image naming Nov 2, 2020
@mattmoor
Copy link
Collaborator Author

mattmoor commented Nov 2, 2020

For example with ECR, my registry domain is 912237561242.dkr.ecr.us-west-2.amazonaws.com, and I have to create each of: 912237561242.dkr.ecr.us-west-2.amazonaws.com/{foo} today.

With this, I can use KO_DOCKER_REPO=912237561242.dkr.ecr.us-west-2.amazonaws.com/ko-images and ko apply --naked will publish all images to the above repository and substitute their digests into the yamls, e.g. 912237561242.dkr.ecr.us-west-2.amazonaws.com/ko-images@sha256:deadbeef

In these cases, no part of the import path is incorporated into the repository name, which is where the name "naked" comes from. I'm open to alternative naming suggestions, but struggled to find a more descriptive term than this.

@jonjohnsonjr
Copy link
Collaborator

My only real issue with this is having a global flag called --naked. I wish we had a separate mechanism for selecting a namer that wasn't flag-based, ref:

#172
#143

@mattmoor
Copy link
Collaborator Author

mattmoor commented Nov 3, 2020

@imjasonh also doesn't like the name either. He suggested --bare, which I think bears the same meaning as --naked, but without the same (level of) vulgar connotation 🤷

I am happy to switch to --bare, though I'd probably drop the short flag since we already have -B.

@jonjohnsonjr
Copy link
Collaborator

I'd prefer dropping the short flag regardless, since they're such a precious resource. In fact, it would be great if this was really cumbersome to type so that you got annoyed into implementing a better mechanism for this :)

Some dumb ideas that might inspire better ideas:

  • --flat
  • --direct
  • --nosuffix
  • --norepo[sitory]
  • --noname
  • --nemo

In this mode, we should probably warn or error if you pass a single tag and we publish multiple images, because the tag will get overwritten. Alternatively (lazily), just document this caveat in the README or flag description.

@mattmoor mattmoor changed the title Refactor the publish.Namer, add --naked option for image naming Refactor the publish.Namer, add --bare option for image naming Nov 3, 2020
@mattmoor mattmoor merged commit 79beb3b into ko-build:master Nov 3, 2020
@mattmoor mattmoor deleted the refactor-namer branch November 3, 2020 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants