Commit d51e65c
authored
feat: Migrate provider-template from cluster scope to namespaced scope (#132)
This PR migrates the provider template from Crossplane v1 to v2. It also implements Gate feature that introduced from v2 to control resources to install to the cluster.
Key changes:
API Updates:
- Consolidate ProviderConfig and related types into unified types.go
- Add namespaced ProviderConfig alongside cluster-scoped ClusterProviderConfig
- Add namespaced ProviderConfigUsage and ClusterProviderConfigUsage
- Update MyType to use namespaced scope by default
- Remove deprecated StoreConfig (external secret stores no longer supported in v2)
- Migrate to crossplane-runtime v2.0.0 with breaking changes
Controller Enhancements:
- Implement safe-start pattern with SetupGated functions
- Add gate-based controller registration to wait for CRDs
- Add customresourcesgate controller to watch for CRD availability
- Update credential extraction to support both namespaced and cluster-scoped configs
- Support dynamic ProviderConfig reference kind switching
- Remove deprecated feature flag system in favor of runtime feature package
- Remove deprecated non-gated Setup function from register.go
- Rename internal/controller/template.go to register.go for clarity
Template Updates:
- Add SetupGated function to controller template for safe-start support
- Update controller template to use v1alpha1 instead of dynamic API version
- Fix typo: WithExternalConnecter -> WithExternalConnector
- Remove unused ConnectionPublisher initialization
- Add missing xpv1 import for ResourceStatus in type templates
- Change Status to use xpv1.ResourceStatus instead of xpv2.ResourceStatus
- Improve error constant alignment and formatting
Dependencies:
- Upgrade to crossplane-runtime v2.0.0
- Add k8s.io/apiextensions-apiserver for CRD scheme registration
- Update controller-runtime to v0.21.0
- Update Go toolchain to 1.24.5
Examples and Documentation:
- Update code generation templates for namespaced resources
- Add namespace field to example manifests
- Update ProviderConfig examples to demonstrate new structure
- Remove StoreConfig examples
- Update README.md to include step for registering new types in SetupGated
- Fix capitalization: "Template provider" -> "template provider"
- Fix capitalization: "group Sample" -> "group sample"
Package Metadata:
- Add safe-start capability to crossplane.yaml package metadata
This migration provides better resource isolation, simplified authentication
patterns, and improved startup reliability through the safe-start mechanism.
Signed-off-by: Chuan-Yen Chiang <[email protected]>1 parent 529bc62 commit d51e65c
File tree
40 files changed
+1059
-1103
lines changed- apis
- sample
- v1alpha1
- v1alpha1
- cmd/provider
- examples
- provider
- sample
- storeconfig
- hack/helpers
- apis/GROUP_LOWER/APIVERSION
- controller/KIND_LOWER
- internal
- controller
- config
- mytype
- features
- package
- crds
40 files changed
+1059
-1103
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | 1 | | |
4 | 2 | | |
5 | 3 | | |
| |||
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
42 | | - | |
| 42 | + | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
This file was deleted.
0 commit comments