Skip to content

Commit

Permalink
Merge pull request #1028 from rancher/dependabot/go_modules/exp/clust…
Browse files Browse the repository at this point in the history
…erclass/dependencies-5c7c082cf6

chore(deps): Bump sigs.k8s.io/cluster-api from 1.9.3 to 1.9.4 in /exp/clusterclass in the dependencies group
alexander-demicev committed Jan 22, 2025

Verified

This commit was signed with the committer’s verified signature.
jasonehines Jason Hines
2 parents 3d5dd5d + 286fef8 commit 6a492da
Showing 9 changed files with 72 additions and 118 deletions.
128 changes: 61 additions & 67 deletions charts/rancher-turtles/questions.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,66 @@
namespace: rancher-turtles-system
questions:
- variable: rancherTurtles.features.default
default: "false"
description: "Customize install settings"
label: Customize install settings
type: boolean
show_subquestion_if: true
group: "Rancher Turtles Extra Settings"
subquestions:
- variable: cluster-api-operator.cert-manager.enabled
default: false
- variable: rancherTurtles.features.default
default: "false"
description: "Customize install settings"
label: Customize install settings
type: boolean
description: "Flag to enable or disable installation of cert-manager. If set to false then you will need to install cert-manager manually"
label: "Enable Cert Manager"
- variable: rancherTurtles.cluster-api-operator.cleanup
default: true
description: "Specify that the CAPI Operator post-delete cleanup job will be performed"
type: boolean
label: Cleanup CAPI Operator installation
group: "CAPI Operator cleanup settings"
show_subquestion_if: true
group: "Rancher Turtles Extra Settings"
subquestions:
- variable: rancherTurtles.cluster-api-operator.kubectlImage
default: "registry.k8s.io/kubernetes/kubectl:v1.30.0"
description: "Specify the image to use when cleaning up the Cluster API Operator manifests"
type: string
label: Cleanup Image
group: "CAPI Operator cleanup settings"
- variable: rancherTurtles.features.rancher-webhook.cleanup
default: true
description: "Specify that the Rancher embedded cluster api webhooks should be removed"
type: boolean
label: Cleanup Rancher Embedded CAPI Webhooks
group: "Rancher webhook cleanup settings"
show_subquestion_if: true
subquestions:
- variable: rancherTurtles.features.rancher-webhook.kubectlImage
default: "registry.k8s.io/kubernetes/kubectl:v1.30.0"
description: "Specify the image to use when cleaning up the webhooks"
type: string
label: Webhook Cleanup Image
group: "Rancher webhook cleanup settings"
- variable: rancherTurtles.features.rancher-kubeconfigs.label
default: false
description: "(Experimental) Specify that the kubeconfigs generated by Rancher should be automatically patched to contain the CAPI expected labels"
type: boolean
label: Label Rancher Kubeconfigs
group: "Rancher Turtles Features Settings"
- variable: cluster-api-operator.cluster-api.rke2.enabled
default: "true"
description: "Flag to enable or disable installation of the RKE2 provider for Cluster API. By default this is enabled."
label: "Enable RKE2 Provider"
type: boolean
- variable: rancherTurtles.features.propagate-labels.enabled
default: false
description: "(Experimental) Specify that the labels from CAPI should be propagated to Rancher"
type: boolean
label: Propagate CAPI Labels
group: "Rancher Turtles Features Settings"
- variable: rancherTurtles.features.addon-provider-fleet.enabled
default: true
description: "Enable Fleet Addon Provider functionality in Rancher Turtles"
type: boolean
label: Seamless integration with Fleet and CAPI
group: "Rancher Turtles Features Settings"
- variable: rancherTurtles.features.agent-tls-mode.enabled
default: false
description: "If enabled Turtles will use the agent-tls-mode setting to determine CA cert trust mode for importing clusters"
type: boolean
label: Enable Agent TLS Mode
group: "Rancher Turtles Features Settings"
- variable: cluster-api-operator.cert-manager.enabled
default: false
type: boolean
description: "Flag to enable or disable installation of cert-manager. If set to false then you will need to install cert-manager manually"
label: "Enable Cert Manager"
- variable: rancherTurtles.cluster-api-operator.cleanup
default: true
description: "Specify that the CAPI Operator post-delete cleanup job will be performed"
type: boolean
label: Cleanup CAPI Operator installation
group: "CAPI Operator cleanup settings"
show_subquestion_if: true
subquestions:
- variable: rancherTurtles.cluster-api-operator.kubectlImage
default: "registry.k8s.io/kubernetes/kubectl:v1.30.0"
description: "Specify the image to use when cleaning up the Cluster API Operator manifests"
type: string
label: Cleanup Image
group: "CAPI Operator cleanup settings"
- variable: rancherTurtles.features.rancher-webhook.cleanup
default: true
description: "Specify that the Rancher embedded cluster api webhooks should be removed"
type: boolean
label: Cleanup Rancher Embedded CAPI Webhooks
group: "Rancher webhook cleanup settings"
show_subquestion_if: true
subquestions:
- variable: rancherTurtles.features.rancher-webhook.kubectlImage
default: "registry.k8s.io/kubernetes/kubectl:v1.30.0"
description: "Specify the image to use when cleaning up the webhooks"
type: string
label: Webhook Cleanup Image
group: "Rancher webhook cleanup settings"
- variable: rancherTurtles.features.rancher-kubeconfigs.label
default: false
description: "(Experimental) Specify that the kubeconfigs generated by Rancher should be automatically patched to contain the CAPI expected labels"
type: boolean
label: Label Rancher Kubeconfigs
group: "Rancher Turtles Features Settings"
- variable: cluster-api-operator.cluster-api.rke2.enabled
default: "true"
description: "Flag to enable or disable installation of the RKE2 provider for Cluster API. By default this is enabled."
label: "Enable RKE2 Provider"
type: boolean
- variable: rancherTurtles.features.addon-provider-fleet.enabled
default: true
description: "Enable Fleet Addon Provider functionality in Rancher Turtles"
type: boolean
label: Seamless integration with Fleet and CAPI
group: "Rancher Turtles Features Settings"
- variable: rancherTurtles.features.agent-tls-mode.enabled
default: false
description: "If enabled Turtles will use the agent-tls-mode setting to determine CA cert trust mode for importing clusters"
type: boolean
label: Enable Agent TLS Mode
group: "Rancher Turtles Features Settings"
2 changes: 1 addition & 1 deletion charts/rancher-turtles/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ spec:
containers:
- args:
- --leader-elect
- --feature-gates=propagate-labels={{ index .Values "rancherTurtles" "features" "propagate-labels" "enabled"}},rancher-kube-secret-patch={{ index .Values "rancherTurtles" "features" "rancher-kubeconfigs" "label"}},addon-provider-fleet={{ index .Values "rancherTurtles" "features" "addon-provider-fleet" "enabled"}},agent-tls-mode={{ index .Values "rancherTurtles" "features" "agent-tls-mode" "enabled"}}
- --feature-gates=rancher-kube-secret-patch={{ index .Values "rancherTurtles" "features" "rancher-kubeconfigs" "label"}},addon-provider-fleet={{ index .Values "rancherTurtles" "features" "addon-provider-fleet" "enabled"}},agent-tls-mode={{ index .Values "rancherTurtles" "features" "agent-tls-mode" "enabled"}}
{{- range .Values.rancherTurtles.managerArguments }}
- {{ . }}
{{- end }}
2 changes: 0 additions & 2 deletions charts/rancher-turtles/values.yaml
Original file line number Diff line number Diff line change
@@ -12,8 +12,6 @@ rancherTurtles:
kubectlImage: registry.k8s.io/kubernetes/kubectl:v1.30.0
rancher-kubeconfigs:
label: false
propagate-labels:
enabled: false
etcd-snapshot-restore:
enabled: false
image: controller
5 changes: 3 additions & 2 deletions exp/clusterclass/go.mod
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ require (
k8s.io/api v0.31.4
k8s.io/apimachinery v0.31.4
k8s.io/client-go v0.31.4
sigs.k8s.io/cluster-api v1.9.3
sigs.k8s.io/controller-runtime v0.19.3
sigs.k8s.io/cluster-api v1.9.4
sigs.k8s.io/controller-runtime v0.19.4
)

require (
@@ -20,6 +20,7 @@ require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
10 changes: 6 additions & 4 deletions exp/clusterclass/go.sum
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@ github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ
github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=
github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
@@ -189,10 +191,10 @@ k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7F
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/cluster-api v1.9.3 h1:lKWbrXzyNmJh++IcX54ZbAmnO7tZ2wKgds7WvskpiXY=
sigs.k8s.io/cluster-api v1.9.3/go.mod h1:5iojv38PSvOd4cxqu08Un5TQmy2yBkd3+0U7R/e+msk=
sigs.k8s.io/controller-runtime v0.19.3 h1:XO2GvC9OPftRst6xWCpTgBZO04S2cbp0Qqkj8bX1sPw=
sigs.k8s.io/controller-runtime v0.19.3/go.mod h1:j4j87DqtsThvwTv5/Tc5NFRyyF/RF0ip4+62tbTSIUM=
sigs.k8s.io/cluster-api v1.9.4 h1:pa2Ho50F9Js/Vv/Jy11TcpmGiqY2ukXCoDj/dY25Y7M=
sigs.k8s.io/cluster-api v1.9.4/go.mod h1:9DjpPCxJJo7/mH+KceINNJHr9c5X9S9HEp2B8JG3Uv8=
sigs.k8s.io/controller-runtime v0.19.4 h1:SUmheabttt0nx8uJtoII4oIP27BVVvAKFvdvGFwV/Qo=
sigs.k8s.io/controller-runtime v0.19.4/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
5 changes: 0 additions & 5 deletions feature/feature.go
Original file line number Diff line number Diff line change
@@ -26,10 +26,6 @@ const (
// secrets so that they can be used with CAPI 1.5.x.
RancherKubeSecretPatch featuregate.Feature = "rancher-kube-secret-patch" //nolint:gosec

// PropagateLabels is used to enable copying the labels from the CAPI cluster
// to the Rancher cluster.
PropagateLabels featuregate.Feature = "propagate-labels"

// ExternalFleet allows to disable in-tree management of the Fleet clusters
// in the imported rancher clusters, by setting "provisioning.cattle.io/externally-managed"
// annotation.
@@ -46,7 +42,6 @@ func init() {

var defaultGates = map[featuregate.Feature]featuregate.FeatureSpec{
RancherKubeSecretPatch: {Default: false, PreRelease: featuregate.Beta},
PropagateLabels: {Default: false, PreRelease: featuregate.Beta},
ExternalFleet: {Default: true, PreRelease: featuregate.Beta},
AgentTLSMode: {Default: false, PreRelease: featuregate.Beta},
}
24 changes: 0 additions & 24 deletions internal/controllers/import_controller_v3.go
Original file line number Diff line number Diff line change
@@ -299,7 +299,6 @@ func (r *CAPIImportManagementV3Reconciler) reconcileNormal(ctx context.Context,

r.optOutOfClusterOwner(ctx, rancherCluster)
r.optOutOfFleetManagement(ctx, rancherCluster)
r.propagateLabels(ctx, capiCluster, rancherCluster)

addedFinalizer := controllerutil.AddFinalizer(rancherCluster, managementv3.CapiClusterFinalizer)
if addedFinalizer {
@@ -572,26 +571,3 @@ func (r *CAPIImportManagementV3Reconciler) optOutOfFleetManagement(ctx context.C
log.Info("Added fleet annotation to Rancher cluster")
}
}

func (r *CAPIImportManagementV3Reconciler) propagateLabels(
ctx context.Context,
capiCluster *clusterv1.Cluster,
rancherCluster *managementv3.Cluster,
) {
log := log.FromContext(ctx)

labels := rancherCluster.GetLabels()
if rancherCluster.Labels == nil {
labels = map[string]string{}
}

if feature.Gates.Enabled(feature.PropagateLabels) {
for labelKey, labelVal := range capiCluster.Labels {
labels[labelKey] = labelVal
}

rancherCluster.SetLabels(labels)

log.V(5).Info("Propagated labels to Rancher cluster")
}
}
11 changes: 0 additions & 11 deletions internal/controllers/import_controller_v3_test.go
Original file line number Diff line number Diff line change
@@ -183,7 +183,6 @@ var _ = Describe("reconcile CAPI Cluster", func() {
Expect(cl.Update(ctx, ns)).To(Succeed())
capiCluster.Labels = map[string]string{
importLabelName: "true",
testLabelName: testLabelVal,
}
Expect(cl.Create(ctx, capiCluster)).To(Succeed())
capiCluster.Status.ControlPlaneReady = true
@@ -204,7 +203,6 @@ var _ = Describe("reconcile CAPI Cluster", func() {
g.Expect(cl.List(ctx, rancherClusters, selectors...)).ToNot(HaveOccurred())
g.Expect(rancherClusters.Items).To(HaveLen(1))
g.Expect(rancherClusters.Items[0].Name).To(ContainSubstring("c-"))
g.Expect(rancherClusters.Items[0].Labels).To(HaveKeyWithValue(testLabelName, testLabelVal))
g.Expect(rancherClusters.Items[0].Annotations).To(HaveKey(turtlesannotations.NoCreatorRBACAnnotation))
g.Expect(rancherClusters.Items[0].Finalizers).To(ContainElement(managementv3.CapiClusterFinalizer))
}).Should(Succeed())
@@ -258,7 +256,6 @@ var _ = Describe("reconcile CAPI Cluster", func() {
g.Expect(cl.List(ctx, rancherClusters, selectors...)).ToNot(HaveOccurred())
g.Expect(rancherClusters.Items).To(HaveLen(1))
}).Should(Succeed())
Expect(rancherClusters.Items[0].Annotations).To(HaveKeyWithValue(externalFleetAnnotation, testLabelVal))
})

It("should reconcile a CAPI cluster when rancher cluster exists, and have finalizers set", func() {
@@ -268,9 +265,6 @@ var _ = Describe("reconcile CAPI Cluster", func() {
}))
defer server.Close()

capiCluster.Labels = map[string]string{
testLabelName: testLabelVal,
}
Expect(cl.Create(ctx, capiCluster)).To(Succeed())
capiCluster.Status.ControlPlaneReady = true
Expect(cl.Status().Update(ctx, capiCluster)).To(Succeed())
@@ -329,7 +323,6 @@ var _ = Describe("reconcile CAPI Cluster", func() {
g.Expect(cl.List(ctx, rancherClusters, selectors...)).ToNot(HaveOccurred())
g.Expect(rancherClusters.Items).To(HaveLen(1))
g.Expect(rancherClusters.Items[0].Name).To(ContainSubstring("c-"))
g.Expect(rancherClusters.Items[0].Labels).To(HaveKeyWithValue(testLabelName, testLabelVal))
g.Expect(rancherClusters.Items[0].Finalizers).To(ContainElement(managementv3.CapiClusterFinalizer))
}, 10*time.Second).Should(Succeed())
})
@@ -473,7 +466,6 @@ var _ = Describe("reconcile CAPI Cluster", func() {

rancherCluster := cluster.DeepCopy()
g.Expect(cl.Get(ctx, client.ObjectKeyFromObject(&cluster), rancherCluster)).To(Succeed())
g.Expect(rancherCluster.Annotations).To(HaveKeyWithValue(externalFleetAnnotation, testLabelVal))
}, 5*time.Second).Should(Succeed())
})

@@ -556,7 +548,6 @@ var _ = Describe("reconcile CAPI Cluster", func() {
Expect(cl.Update(ctx, ns)).To(Succeed())
capiCluster.Labels = map[string]string{
importLabelName: "true",
testLabelName: testLabelVal,
}
Expect(cl.Create(ctx, capiCluster)).To(Succeed())
capiCluster.Status.ControlPlaneReady = true
@@ -591,15 +582,13 @@ var _ = Describe("reconcile CAPI Cluster", func() {
g.Expect(rancherClusters.Items).To(HaveLen(1))
}).Should(Succeed())
Expect(rancherClusters.Items[0].Name).To(ContainSubstring("c-"))
Expect(rancherClusters.Items[0].Labels).To(HaveKeyWithValue(testLabelName, testLabelVal))
})

It("should reconcile a CAPI Cluster when V1 cluster exists and not migrated", func() {
ns.Labels = map[string]string{}
Expect(cl.Update(ctx, ns)).To(Succeed())
capiCluster.Labels = map[string]string{
importLabelName: "true",
testLabelName: testLabelVal,
}
Expect(cl.Create(ctx, capiCluster)).To(Succeed())
capiCluster.Status.ControlPlaneReady = true
3 changes: 1 addition & 2 deletions internal/controllers/suite_test.go
Original file line number Diff line number Diff line change
@@ -53,8 +53,7 @@ var (

func init() {
utilruntime.Must(feature.MutableGates.SetFromMap(map[string]bool{
string(feature.PropagateLabels): true,
string(feature.ExternalFleet): true,
string(feature.ExternalFleet): true,
}))
}

0 comments on commit 6a492da

Please sign in to comment.