Skip to content

Use a default local name that works for cluster-scoped objects - #192

Open
Sarthak-Shreshtha01 wants to merge 1 commit into
kcp-dev:mainfrom
Sarthak-Shreshtha01:fix/issue-163
Open

Sarthak-Shreshtha01 wants to merge 1 commit into
kcp-dev:mainfrom
Sarthak-Shreshtha01:fix/issue-163

Conversation

@Sarthak-Shreshtha01

Copy link
Copy Markdown

Summary

The default local name is {{ .Object.metadata.namespace | sha3short }}-{{ .Object.metadata.name | sha3short }}. Cluster-scoped objects have no namespace, so sha3short gets no string, the template fails, and the local object is never created.

For objects without a namespace, the default name is now {{ .ClusterName | sha3short }}-{{ .Object.metadata.name | sha3short }}. Using the cluster name keeps names unique even when the local copy is cluster-scoped too, since then the {{ .ClusterName }} namespace is dropped. Names of namespaced objects do not change. The API comment, the generated CRD and the docs mention the new default.

What Type of PR Is This?

/kind bug

Related Issue(s)

Fixes #163

Release Notes

The default naming for local objects now works for cluster-scoped published resources.

The default name template hashes .Object.metadata.namespace, which is
missing on cluster-scoped objects, so sha3short failed and the local
object was never created. For objects without a namespace the default
name now hashes the cluster name instead, which also keeps names unique
when the local copy is cluster-scoped and the namespace is dropped.

Signed-off-by: Sarthak <sarthakshreshtha345@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 15, 2026 19:18
@kcp-ci-bot kcp-ci-bot added kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has signed the DCO. labels Oct 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign embik for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 15, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

Hi @Sarthak-Shreshtha01. Thanks for your PR.

I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kcp-ci-bot kcp-ci-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. kind/bug Categorizes issue or PR as related to a bug. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: default naming for local object fails on cluster-scoped published resources

3 participants