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

Conversion of underscores to hyphens in kpt function image names is confusing #2533

Open
bgrant0607 opened this issue Oct 4, 2021 · 4 comments
Labels
area/fn-sdk Typescript SDK bug Something isn't working triaged Issue has been triaged by adding an `area/` label

Comments

@bgrant0607
Copy link
Contributor

Expected behavior

This runs a function after locally building it:
$ kpt fn eval . --exec "node dist/my_func_run.js"

Then I want to push the function:
export npm_package_kpt_docker_repo_base="${REGISTRY}/${PROJECT}/${REPOSITORY}"
npm run kpt:docker-build -- --tag=latest
npm run kpt:docker-push -- --tag=latest

I would expect this to work:
$ kpt fn eval . --image "${REGISTRY}/${PROJECT}/${REPOSITORY}/my_func:latest"

Actual behavior

$ kpt fn eval . --image "${REGISTRY}/${PROJECT}/${REPOSITORY}/my_func:latest"

Doesn't find the function. The image is named my-func. This shown by the documentation, but it doesn't mention the conversion of underscores to hyphens.

Steps to reproduce the behavior

I followed https://kpt.dev/sdk/ts-guide

cc @justinsb

@bgrant0607 bgrant0607 added the bug Something isn't working label Oct 4, 2021
@mengqiy mengqiy self-assigned this Oct 5, 2021
@droot droot added triaged Issue has been triaged by adding an `area/` label area/fn-sdk Typescript SDK labels Oct 20, 2021
@sdowell
Copy link
Contributor

sdowell commented Jan 11, 2022

It seems this behavior is intentional and is explicitly implemented here:
https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/create-kpt-functions/src/utils/validator.ts#L183

What is the preferred resolution of this?
e.g. change the behavior, update the docs, etc

@mengqiy
Copy link
Contributor

mengqiy commented Jan 11, 2022

If these are the conventions in docker and js, what we should do here is to update our documentation.

@bgrant0607
Copy link
Contributor Author

It's not inherent to docker. We were able to push container images with names containing underscores side by side with those containing dashes and were able to add them to the Kptfile pipeline and use them successfully.

What does the Go SDK do?

I personally would probably use dashes in function source file names rather than underscores, but the silent, unexplained conversion was surprising.

@mengqiy
Copy link
Contributor

mengqiy commented Jan 11, 2022

We currently don't do much scaffolding in the Go SDK. So it doesn't have this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/fn-sdk Typescript SDK bug Something isn't working triaged Issue has been triaged by adding an `area/` label
Projects
None yet
Development

No branches or pull requests

4 participants