diff --git a/templates/flavors/rke2/default/kustomization.yaml b/templates/flavors/rke2/default/kustomization.yaml index 6f98a10bd..1f8448567 100644 --- a/templates/flavors/rke2/default/kustomization.yaml +++ b/templates/flavors/rke2/default/kustomization.yaml @@ -4,11 +4,9 @@ resources: - ../../../infra - rke2ControlPlane.yaml - rke2ConfigTemplate.yaml + - secret.yaml - ../../../addons/cilium - ../../../addons/cilium-network-policies - - ../../../addons/csi-driver-linode - - ../../../addons/ccm-linode - - ../../../addons/cluster-resource-set patches: - target: group: cluster.x-k8s.io @@ -28,10 +26,7 @@ patches: metadata: name: ${CLUSTER_NAME} labels: - cni: ${CLUSTER_NAME}-cilium - ccm: ${CLUSTER_NAME}-linode - csi: ${CLUSTER_NAME}-linode - crs: ${CLUSTER_NAME}-crs + cni: ${CLUSTER_NAME}-cilium - target: group: cluster.x-k8s.io version: v1beta1 @@ -41,17 +36,13 @@ patches: path: /spec/template/spec/bootstrap/configRef/kind value: RKE2ConfigTemplate - target: - kind: HelmChartProxy - name: .*-linode-cloud-controller-manager + group: cluster.x-k8s.io + version: v1beta1 + kind: Cluster patch: |- - - op: replace - path: /spec/valuesTemplate - value: | - routeController: - vpcName: ${VPC_NAME:=${CLUSTER_NAME}} - clusterCIDR: 10.0.0.0/8 - configureCloudRoutes: true - secretRef: - name: "linode-token-region" - nodeSelector: - node-role.kubernetes.io/control-plane: "true" + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + metadata: + name: ${CLUSTER_NAME} + labels: + cni: ${CLUSTER_NAME}-cilium diff --git a/templates/flavors/rke2/default/rke2ControlPlane.yaml b/templates/flavors/rke2/default/rke2ControlPlane.yaml index 7730885f0..506735cb3 100644 --- a/templates/flavors/rke2/default/rke2ControlPlane.yaml +++ b/templates/flavors/rke2/default/rke2ControlPlane.yaml @@ -8,6 +8,36 @@ spec: apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 kind: LinodeMachineTemplate name: ${CLUSTER_NAME}-control-plane + files: + - path: /var/lib/rancher/rke2/server/manifests/ccm-linode.yaml + owner: root:root + content: |- + apiVersion: helm.cattle.io/v1 + kind: HelmChart + metadata: + namespace: kube-system + name: ccm-linode + spec: + targetNamespace: kube-system + version: ${LINODE_CCM_VERSION:=v0.4.4} + chart: ccm-linode + repo: https://linode.github.io/linode-cloud-controller-manager/ + bootstrap: true + valuesContent: |- + routeController: + vpcName: ${VPC_NAME:=${CLUSTER_NAME}} + clusterCIDR: 10.0.0.0/8 + configureCloudRoutes: true + secretRef: + name: "linode-token-region" + nodeSelector: + node-role.kubernetes.io/control-plane: "true" + - contentFrom: + secret: + key: linode-token-region.yaml + name: linode-${CLUSTER_NAME}-crs-0 + owner: root:root + path: /var/lib/rancher/rke2/server/manifests/linode-token-region.yaml registrationMethod: internal-only-ips serverConfig: cni: none diff --git a/templates/flavors/rke2/default/secret.yaml b/templates/flavors/rke2/default/secret.yaml new file mode 100644 index 000000000..04b685e1f --- /dev/null +++ b/templates/flavors/rke2/default/secret.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + labels: + clusterctl.cluster.x-k8s.io/move: "true" + name: linode-${CLUSTER_NAME}-crs-0 +stringData: + linode-token-region.yaml: |- + kind: Secret + apiVersion: v1 + metadata: + name: linode-token-region + namespace: kube-system + stringData: + apiToken: ${LINODE_TOKEN} + region: ${LINODE_REGION} diff --git a/templates/flavors/rke2/vpcless/kustomization.yaml b/templates/flavors/rke2/vpcless/kustomization.yaml index 7f173d8e7..03c2df75b 100644 --- a/templates/flavors/rke2/vpcless/kustomization.yaml +++ b/templates/flavors/rke2/vpcless/kustomization.yaml @@ -33,8 +33,6 @@ patches: name: "linode-token-region" image: pullPolicy: IfNotPresent - nodeSelector: - node-role.kubernetes.io/control-plane: "true" - target: kind: LinodeVPC patch: |- @@ -85,6 +83,34 @@ patches: - sed -i '/swap/d' /etc/fstab - swapoff -a - hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname + - op: replace + path: /spec/files + value: + - path: /var/lib/rancher/rke2/server/manifests/ccm-linode.yaml + owner: root:root + content: |- + apiVersion: helm.cattle.io/v1 + kind: HelmChart + metadata: + namespace: kube-system + name: ccm-linode + spec: + targetNamespace: kube-system + version: ${LINODE_CCM_VERSION:=v0.4.4} + chart: ccm-linode + repo: https://linode.github.io/linode-cloud-controller-manager/ + bootstrap: true + valuesContent: |- + secretRef: + name: "linode-token-region" + nodeSelector: + node-role.kubernetes.io/control-plane: "true" + - contentFrom: + secret: + key: linode-token-region.yaml + name: linode-${CLUSTER_NAME}-crs-0 + owner: root:root + path: /var/lib/rancher/rke2/server/manifests/linode-token-region.yaml - target: group: cluster.x-k8s.io version: v1beta1