Skip to content

Commit

Permalink
add rke2 flavor
Browse files Browse the repository at this point in the history
  • Loading branch information
AshleyDumaine committed Feb 28, 2024
1 parent fd17c44 commit c2e76c4
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 0 deletions.
22 changes: 22 additions & 0 deletions templates/flavors/rke2/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
resources:
- ../base
- rke2ControlPlane.yaml
- rke2ConfigTemplate.yaml
- secret.yaml
patches:
- target:
group: cluster.x-k8s.io
version: v1beta1
kind: Cluster
patch: |-
- op: replace
path: /spec/controlPlaneRef/kind
value: RKE2ControlPlane
- target:
group: cluster.x-k8s.io
version: v1beta1
kind: MachineDeployment
patch: |-
- op: replace
path: /spec/template/spec/bootstrap/configRef/kind
value: RKE2ConfigTemplate
18 changes: 18 additions & 0 deletions templates/flavors/rke2/rke2ConfigTemplate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha1
kind: RKE2ConfigTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
spec:
template:
spec:
agentConfig:
version: ${KUBERNETES_VERSION}
nodeName: '{{ ds.meta_data.label }}'
kubelet:
extraArgs:
- "provider-id=linode://{{ ds.meta_data.id }}"
preRKE2Commands:
- sed -i '/swap/d' /etc/fstab
- swapoff -a
- hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname
42 changes: 42 additions & 0 deletions templates/flavors/rke2/rke2ControlPlane.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
apiVersion: controlplane.cluster.x-k8s.io/v1alpha1
kind: RKE2ControlPlane
metadata:
name: ${CLUSTER_NAME}-control-plane
spec:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeMachineTemplate
name: ${CLUSTER_NAME}-control-plane
files:
- contentFrom:
secret:
key: linode-ccm.yaml
name: linode-${CLUSTER_NAME}-crs-0
owner: root:root
path: /var/lib/rancher/rke2/server/manifests/linode-ccm.yaml
- 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
serverConfig:
cni: cilium
cloudProviderName: external
disableComponents:
pluginComponents:
- "rke2-ingress-nginx"
kubernetesComponents:
- "cloudController"
agentConfig:
version: ${KUBERNETES_VERSION}
nodeName: '{{ ds.meta_data.label }}'
kubelet:
extraArgs:
- "provider-id=linode://{{ ds.meta_data.id }}"
preRKE2Commands:
- sed -i '/swap/d' /etc/fstab
- swapoff -a
- hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
32 changes: 32 additions & 0 deletions templates/flavors/rke2/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
apiVersion: v1
kind: Secret
metadata:
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}
linode-ccm.yaml: |-
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
namespace: kube-system
name: ccm-linode
spec:
targetNamespace: kube-system
version: ${LINODE_CCM_VERSION:=v0.3.24}
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"

0 comments on commit c2e76c4

Please sign in to comment.