feature: mutate spec object references for other published resources
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- go, kubernetes
Research direction
Start with the PublishedResources API and the mutation phase re-enabled in #19. Trace how renaming rules are represented for published resources and how a reference such as spec.configRef.name could be identified. Done means the API can declare the target resource and synced objects use the translated name for referenced resources.
Written by the indexing model from the issue text.
Description
Feature Description
For namespaced resources, syncing from kcp to a Kubernetes cluster (3D space to 2D space, in a way) is usually not a problem because our default resource renaming rules put everything under its own namespace, so e.g. related resources such as Secrets do not create problems with their naming (a secretRef in an object pointing to my-secret is not creating conflicts because everything will happen in a generated namespace of the format WORKSPACE-NAMESPACE [with hashes, but you get the idea]).
This is however not possible with cluster-scoped resources in general, plus referencing other published resources would also create similar problems. Think of the following manifests that I want to create in kcp with both being synced down to a service provider cluster:
apiVersion: service/v1
kind: Config # a cluster-scoped resource
metadata:
name: my-config
spec: {}
---
apiVersion: service/v1
kind: ServiceInstance # a namespace-scoped resource
metadata:
name: my-instance
namespace: my-namespace
spec:
configRef:
name: my-config # a reference to my Config object from above
What is needed is a way to describe object references like this (basically say: spec.configRef.name in the ServiceInstance kind is a reference to another resource that is within the realm of the api-syncagent) in PublishedResources.
Since the api-syncagent knows about the renaming rules of other resources published via PublishedResources, it should mutate spec.configRef.name to the name that it translated the my-config object to. So on the service provider side, these objects should look somewhat like this:
apiVersion: service/v1
kind: Config # a cluster-scoped resource
metadata:
name: iuc6yffea77crveb-7505d64a54e061b7acd5
spec: {}
---
apiVersion: service/v1
kind: ServiceInstance # a namespace-scoped resource
metadata:
name: my-instance
namespace: org-ucdyfdsa7trvfa-sdadsjdjwwewads
spec:
configRef:
name: iuc6yffea77crveb-7505d64a54e061b7acd5 # a reference to my Config object from above
Proposed Solution
I'm not fully clear on how the API should look, but most likely a PublishedResource should have a way to mark object references and define what resource is being referenced here. The api-syncagent would need to hold an internal representation of all renaming rules depending on resources, and would then use those rules in the mutation phase we recently re-enabled in #19.
Alternative Solutions
No response
Want to contribute?
- I would like to work on this issue.
Additional Context
No response
- Dominant language
- Go
- Stars
- 25
- Forks
- 30
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from kcp-dev/api-syncagent
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
kcp-dev/api-syncagent#163 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
kcp-dev/api-syncagent#161 ·
-
kind/feature
Difficulty 4/5 3-5 days Newbie friendliness 48/100
kcp-dev/api-syncagent#186 · 1 reaction ·
-
kind/bug
kcp-dev/api-syncagent#182 · 1 comment · 1 assignee ·
-
bug: finalizer "syncagent.kcp.io/cleanup" on related resources block deletion of primary object Openkind/bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
kcp-dev/api-syncagent#172 · 1 comment · 1 reaction ·
All issues in kcp-dev/api-syncagent
Similar issues
-
area/dev-productivity area/disaster-recovery area/ipcei kind/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
kind/bug status/0-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
🤔 refinement needed
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
equinor/radix-operator#1979 ·