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

kmeta package: ChildName function produces invalid resource names #2659

Closed
KauzClay opened this issue Dec 8, 2022 · 1 comment · Fixed by #2660
Closed

kmeta package: ChildName function produces invalid resource names #2659

KauzClay opened this issue Dec 8, 2022 · 1 comment · Fixed by #2660

Comments

@KauzClay
Copy link
Contributor

KauzClay commented Dec 8, 2022

Expected Behavior

When I use ChildName to create a truncated resource name, I expect the name produced to be a valid resource name in kubernetes.

Actual Behavior

The function will produce an invalid resource name ending with .

Steps to Reproduce the Problem

I've set up a go playground example with my input that cause the problem: https://go.dev/play/p/HB42UPAWp7h

Additional Info

This came up as an error in the net-contour controller that looks like this:

{"severity":"ERROR","timestamp":"2022-12-08T19:13:48.437648502Z","logger":"net-contour-controller","caller":"controller/controller.go:566","message":"Reconcile error","commit":"041f9e3","knative.dev/controller":"knative.dev.net-contour.pkg.reconciler.contour.Reconciler","knative.dev/kind":"networking.internal.knative.dev.Ingress","knative.dev/traceid":"ec12c38a-f1ac-4581-aae5-2350b60211a2","knative.dev/key":"cody/foo-java","duration":"18.23483ms","error":"HTTPProxy.projectcontour.io \"foo-java-contour-5f549ae3e6f584a5f33d069a0650c0d8foo-java.cody.\" is invalid: metadata.name: Invalid value: \"foo-java-contour-5f549ae3e6f584a5f33d069a0650c0d8foo-java.cody.\": a lowercase RFC 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])?)*')","stacktrace":"knative.dev/pkg/controller.(*Impl).handleErr\n\tknative.dev/pkg@v0.0.0-20221011175852-714b7630a836/controller/controller.go:566\nknative.dev/pkg/controller.(*Impl).processNextWorkItem\n\tknative.dev/pkg@v0.0.0-20221011175852-714b7630a836/controller/controller.go:543\nknative.dev/pkg/controller.(*Impl).RunContext.func3\n\tknative.dev/pkg@v0.0.0-20221011175852-714b7630a836/controller/controller.go:491"}

net-contour uses ChildName here: https://github.com/knative-sandbox/net-contour/blob/main/pkg/reconciler/contour/resources/httpproxy.go#L275

@dprotaso
Copy link
Member

dprotaso commented Dec 8, 2022

related/dupe of #2551

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 a pull request may close this issue.

2 participants