Skip to content

Commit d9e2019

Browse files
committed
fix: Add spec.useRancherDefaultRegistry to CAPIProvider and implement
controller logic
1 parent ef284d1 commit d9e2019

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

api/v1alpha1/clusterctl_config_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ type ClusterctlConfigSpec struct {
3636
// Provider overrides
3737
// +optional
3838
Providers ProviderList `json:"providers,omitempty"`
39+
40+
// UseRancherDefaultRegistry indicates whether to use the Rancher default registry for pulling images.
41+
// +optional
42+
UseRancherDefaultRegistry bool `json:"useRancherDefaultRegistry,omitempty"`
3943
}
4044

4145
// Provider allows to define providers with known URLs to pull the components.

config/crd/bases/turtles-capi.cattle.io_clusterctlconfigs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ spec:
8686
- url
8787
type: object
8888
type: array
89+
useRancherDefaultRegistry:
90+
description: UseRancherDefaultRegistry indicates whether to use the
91+
Rancher default registry for pulling images.
92+
type: boolean
8993
type: object
9094
type: object
9195
x-kubernetes-validations:

config/rbac/role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,18 @@ rules:
8080
- management.cattle.io
8181
resources:
8282
- clusterregistrationtokens/status
83+
verbs:
84+
- get
85+
- list
86+
- watch
87+
- apiGroups:
88+
- management.cattle.io
89+
resources:
8390
- settings
8491
verbs:
8592
- get
8693
- list
94+
- patch
8795
- watch
8896
- apiGroups:
8997
- provisioning.cattle.io

internal/controllers/clusterctlconfig_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func (r *ClusterctlConfigReconciler) SetupWithManager(_ context.Context, mgr ctr
7676
//+kubebuilder:rbac:groups=turtles-capi.cattle.io,resources=clusterctlconfigs/status,verbs=get;list;watch;patch
7777
//+kubebuilder:rbac:groups=turtles-capi.cattle.io,resources=clusterctlconfigs/finalizers,verbs=get;list;watch;patch;update
7878
//+kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch;create;patch
79+
//+kubebuilder:rbac:groups="management.cattle.io",resources=settings,verbs=get;list;watch;patch
7980

8081
// Reconcile reconciles the ClusterctlConfig object.
8182
func (r *ClusterctlConfigReconciler) Reconcile(ctx context.Context, _ reconcile.Request) (ctrl.Result, error) {

0 commit comments

Comments
 (0)