Open ziyue-101 opened 5 months ago
/cc @acpana @justinsb @yuwenma WDYT?
Make each resource has its own resource reference instead of sharing the same reference struct. This allows us to have customizations easily.
This may be closer to the final stage in that we use a references definition from a go struct that we control. I think you may be on the first reference out to a GSA account as a direct resource.
Two suggestions:
It's great to explore all possible options and compare the pros and cons. Regarding the question you have, I'm also leaning towards a dedicated resolution for each resource ref. Here's an example that may unblock your case:
We only hit 1-2 resource reference use cases in the direct controller, I would encourage to build your resource reference that best suite the use case you are dealing with and do not bother to abstract a common pattern (yet).
BTW, we shall not refer internal codenames or links in oss.
Checklist
Describe the feature or resource
The new workflow uses controller-gen https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/master/dev/tasks/generate-crds#L28 to generate CRDs from go structs(SOT).
However, the generated resources references are the same for all crds which use the shared references go struct. This would create breaking changes for some resources in which projectRef has a required Kind field that they used not have. It is also hard to customize individual resource on field attributes like descriptions.
For some resources like GKEHubFeatureMembership, KCC used to get reference's description from DCL/TF such as.
However, after removing DCL/TF layer, KCC should store the descriptions in the go structs(SOT).
For the field above, the existing go struct reuses a common ResourceRef here, which makes it hard to customize attributes like field description for individual resources. If we use the shared references, the generated CRD would look like
Instead of
I can think of two approaches to address the limitation.
I am leaning towards the first option and if the team agrees, we should call out that part in the new resource guide.
Additional information
No response
Importance
No response