Generate namespaced managed resources#1753
Generate namespaced managed resources#1753negz merged 40 commits intocrossplane-contrib:crossplane-v2from
Conversation
Signed-off-by: Nic Cope <nicc@rk0n.org>
It doesn't fit well in apis given it also generates controllers, commands, etc. Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Ideally the code generation configuration wouldn't depend on generated code. That should be fixed in a future commit. Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Using: sed -i -e 's/scope=Cluster/scope=Namespaced/' $(find . -name '*.go'|xargs) Signed-off-by: Nic Cope <nicc@rk0n.org>
Unchanged, for now. Signed-off-by: Nic Cope <nicc@rk0n.org>
This should make the namespaced APIs and controllers actually namespaced Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
The controller import package is now configurable. Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
…o pass to upjet pipeline Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
…lly cased in singleton list handling These specific controllers were handled specially in the singleton list conversion code, since that has now been removed, their versions are bumped during code gen. Not entirely sure this is a good thing just yet, but we'll see. Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
* refactor GetProvider so that xpprovider.GetProvider() is only called once at runtime and then reused for both cluster and namespaced * update provider main.go template to use both cluster and namespaced config during start up. This is important as both of their setup, conversions, etc. need to be honored Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
The CRD file names don't conflict with each other because they have their full group names embedded in the file name. When the kustomize tooling runs over the CRDs, it's easier to process them all in one single directory, so we don't end up with wierd duplicates. Signed-off-by: Jared Watts <jbw976@gmail.com>
This isn't an ideal name because it doesn't exactly match the same pattern of other groups, e.g. s3.m.aws.upbound.io, but it is a quick way to make publishing work for the family/config provider. That provider is special cased to take all aws.* CRDs. Updating the group for namespaced core/config CRDs to aws.m.upbound.io means they are also included in the family/config provider along with the cluster scoped aws.upbound.io CRDs. We should likely revisit this with more time to maybe update the up xpkg batch tooling. Signed-off-by: Jared Watts <jbw976@gmail.com>
…tory Signed-off-by: Jared Watts <jbw976@gmail.com>
…atial Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
|
Trying to fix the linter errors now, but that has been a bit tough due to the long cycles it takes to run, find issues, repeat :) I don't have a solution for the failed |
… vars Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
|
Just pushed a few commits that give me a clean |
| // Package v1alpha1 contains the core resources of the aws provider. | ||
| // +kubebuilder:object:generate=true | ||
| // +groupName=m.aws.upbound.io | ||
| // +groupName=aws.m.upbound.io |
There was a problem hiding this comment.
Could we switch everything to use aws.m.upbound.io?
I think that actually makes the most sense - since `m.upbound.io is the least specific part of the domain.
There was a problem hiding this comment.
sure, we can do that! that actually makes more sense for the root "config" group, as the xpkg batch assumes all of the CRDs for that group start with aws.*. Let's see how code gen like this update... 🙏
There was a problem hiding this comment.
This is now complete @negz, all the namespaced CRDs consistently use *.aws.m.upbound.io and I manually built/tested with the s3 provider 👍
| go 1.23.6 | ||
|
|
||
| replace github.com/crossplane/upjet => github.com/negz/upjet v0.0.0-20250227033622-bf0ba4f0de9d | ||
| replace github.com/crossplane/upjet => github.com/negz/upjet v0.0.0-20250320063135-520f63c242c6 |
There was a problem hiding this comment.
Just adding a note that we shouldn't merge this until we switch this to the crossplane/upjet crossplane-v2 branch after crossplane/upjet#480 is merged.
|
@jbw976 why did you end up with When we chatted with @ulucinar and @sergenyalcin I think we said we'd:
Is that still the plan long term? |
negz
left a comment
There was a problem hiding this comment.
I focused on the hand-written commits in my review, and this looks like a good starting point. I'd like to get it merged so we can build an artifact and iterate.
Yes I think that is still the long term plan! I haven't tried any config consolidation into a common config yet in the interest of time.
This is an artifact of there previously being a There's not a ton of code in those common config dirs, so I reckon when we try to do a REAL common config dir it should be easy enough to make it work. Just haven't done any of that yet 😁 |
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
|
I'm not sure what's going on with the linter check on this PR, From my laptop: I wonder if we need to continue investing in the strategy already in place from #1194, beyond what I've already done in this PR, to maybe filter out via build tags all the namespaced generated code, so we're not doing ~2x the linting? Or give the On |
Signed-off-by: Jared Watts <jbw976@gmail.com>
|
yay Only unsolved item for the PR feedback and status checks is now |
We don't currently have manually curated examples for namespaced resources, so for now we will exclude them for this examples check. Signed-off-by: Jared Watts <jbw976@gmail.com>
|
@negz, we got a green run here!! take a quick look again if you'd like at the latest manual commits to integrate all your feedback, to get linting passing by using a larger runner, and to exclude namespaced examples for now. I am tracking all these shortcuts and will open issues later, don't worry about that! 😇 |
Description of your changes
This PR continues the work from draft PR #1689 that @negz started. It essentially updates this provider to start generating namespaced managed resources in addition to cluster scoped ones, which will be featured heavily in the current proposal of Crossplane v2.
This should not be taken as a final product. This is a practical update to this provider as a proof of concept for what we think a provider could look like in Crossplane v2. There are many short cuts taken, it is not production ready, and we are very open to feedback to change directions or improve the architecture.
The work in this PR should be merged into the new
crossplane-v2branch, which is based on commit 1ecd9cb, the latest commit when we started this work. We will need to rebase this effort in the future to include latest changes frommain, but that should not block this PR.I have:
make reviewableto ensure this PR is ready for review.General steps this PR has taken
The following list describes the general process that was taken to update this provider to support namespaced MRs:
How has this code been tested
Besides generating, building and publishing successfully, this code has also been tested manually by installing the config, s3, rds, and ec2 packages into a control plane, then creating both cluster scoped and namespaced S3 buckets. Ex.: