Skip to content

Only duplicate resource configuration when it differs between cluster/namespaced #543

@erhancagirici

Description

@erhancagirici

Moved to this repo from original issue: crossplane/crossplane#6456

In the v2 compatible upjet providers, we took an approach of first duplicating the original cluster scoped config into a namespaced dir, and then made appropriate changes from that starting point. @negz describes this decision a bit more at the end of crossplane/crossplane#6280 (comment). That got the job done, but introduces a maintenance burden when new resources are added because the dev would have to add resource config in two places now.

A better approach here would be to de-duplicate the config that doesn’t change between cluster and namespaced, and only make two separate configs when there’s an actual change between the two.

This may be tricky though because we ended up doing a couple very different things across all the namespaced types vs. the cluster ones:

we removed all CRD conversion logic having to do with singleton lists (commit 1), but kept the terraform conversions (commit).
all types are v1beta1 because there are no "legacy" namespaced types that we need to account for - everything starts fresh on the same version.
@ulucinar suggested it may be possible to enable a single config dir by centrally removing conversions and resetting versions to v1beta1 for namespaced types in a single place, but that needs to be explored further.

Another benefit to this common config approach would be with the multiple places where we are awkwardly using a cluster scoped config for namespaced setup, when it could make better sense to just use a single common config. Some examples include:

Pipeline run only uses the main.go template from cluster config (#480 (comment))
generated and skipped resources list are only using cluster config: https://github.com/crossplane-contrib/provider-upjet-aws/blob/crossplane-v2/cmd/generator/main.go#L48-L49
provider main.go setup only configures external secret stores for cluster scoped controllers: https://github.com/crossplane-contrib/provider-upjet-aws/blob/crossplane-v2/hack/main.go.tmpl#L236

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions