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

Open Beginner friendly
#163 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
api, backend

Research direction

Start at internal/sync/templating/naming.go around line 53 and reproduce the failure with a cluster-scoped PublishedResource using the default naming scheme. Trace how the namespace value is passed to sha3short, then verify that local object names are generated successfully for cluster-scoped published resources while the documented workaround remains unnecessary.

Written by the indexing model from the issue text.

Description

kind/bug
Describe the bug

When a published resource is cluster-scoped, the default naming scheme {{ .Object.metadata.namespace | sha3short }}-{{ .Object.metadata.name | sha3short }} won't work cause sha3short requires a string input.
The local object will not be created.

Essentially this is not a bug but more of a convenience feature to have the defaults work in more usecases.

workaround:
Set a custom naming for the published resources, i.e.

spec:
  naming:
    name: "{{ .Object.metadata.name | sha3short }}"
Steps To Reproduce
  1. create a PublishedResource for a cluster-scoped object
  2. create APIExports and APIBindings
  3. create an instance of the resource
  4. check log entries in the api-syncagent primary pod
{"level":"error","time":"2026-04-30T06:06:01.526Z","logger":"syncagent-sync","caller":"controller/controller.go:495","msg":"Reconciler error","controller":"syncagent-sync","reconcileID":"a6c4a2ad-c31f-4d2b-99f3-179802f41453","error":"failed to create destination object: failed to create destination object: failed to generate local object name: invalid name naming: failed to evaluate: template: inline:1:32: executing \"inline\" at <sha3short>: invalid value; expected string"}
Expected Behaviour

The defaultNaming of local object works even for cluster-scoped published resources.

Additional Context

related source line:
https://github.com/kcp-dev/api-syncagent/blob/main/internal/sync/templating/naming.go#L53

Dominant language
Go
Stars
25
Forks
30
Avg merge
3d 9h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from kcp-dev/api-syncagent

All issues in kcp-dev/api-syncagent

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.