From 37dd717ff7fa36b8ec8fbda1a35f7fc824c32ea3 Mon Sep 17 00:00:00 2001 From: Evan Johnson Date: Mon, 26 Feb 2024 10:24:50 -0500 Subject: [PATCH] move kubeadm specific config into default --- templates/flavors/base/cluster.yaml | 7 ++-- templates/flavors/base/kustomization.yaml | 3 +- .../flavors/base/linode-machine-template.yaml | 18 ++++++++-- .../{default => base}/machine-deployment.yaml | 3 +- .../kubeadm-control-plane.yaml | 0 templates/flavors/default/kustomization.yaml | 34 +++++++++++++++++-- .../default/linode-machine-template.yaml | 14 -------- 7 files changed, 55 insertions(+), 24 deletions(-) rename templates/flavors/{default => base}/machine-deployment.yaml (93%) rename templates/flavors/{base => default}/kubeadm-control-plane.yaml (100%) delete mode 100644 templates/flavors/default/linode-machine-template.yaml diff --git a/templates/flavors/base/cluster.yaml b/templates/flavors/base/cluster.yaml index b2ffcbe9b..c47d3f125 100644 --- a/templates/flavors/base/cluster.yaml +++ b/templates/flavors/base/cluster.yaml @@ -1,11 +1,10 @@ +--- apiVersion: cluster.x-k8s.io/v1beta1 kind: Cluster metadata: name: ${CLUSTER_NAME} labels: - cni: cilium - ccm: linode - crs: ${CLUSTER_NAME}-crs + cluster: ${CLUSTER_NAME} spec: clusterNetwork: pods: @@ -13,7 +12,7 @@ spec: - 192.168.128.0/17 controlPlaneRef: apiVersion: controlplane.cluster.x-k8s.io/v1beta1 - kind: KubeadmControlPlane + kind: REPLACEME name: ${CLUSTER_NAME}-control-plane infrastructureRef: apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 diff --git a/templates/flavors/base/kustomization.yaml b/templates/flavors/base/kustomization.yaml index 61a13775e..f0ec7b5d3 100644 --- a/templates/flavors/base/kustomization.yaml +++ b/templates/flavors/base/kustomization.yaml @@ -1,7 +1,8 @@ +--- apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - cluster.yaml - - kubeadm-control-plane.yaml - linode-cluster.yaml - linode-machine-template.yaml + - machine-deployment.yaml diff --git a/templates/flavors/base/linode-machine-template.yaml b/templates/flavors/base/linode-machine-template.yaml index 47810998b..b2ee8f19d 100644 --- a/templates/flavors/base/linode-machine-template.yaml +++ b/templates/flavors/base/linode-machine-template.yaml @@ -10,5 +10,19 @@ spec: type: ${LINODE_CONTROL_PLANE_MACHINE_TYPE} region: ${LINODE_REGION} authorizedKeys: -# uncomment to include your ssh key in linode provisioning -# - ${LINODE_SSH_PUBKEY:=""} + # uncomment to include your ssh key in linode provisioning + # - ${LINODE_SSH_PUBKEY:=""} +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 +kind: LinodeMachineTemplate +metadata: + name: ${CLUSTER_NAME}-md-0 +spec: + template: + spec: + image: ${LINODE_OS:="linode/ubuntu22.04"} + type: ${LINODE_MACHINE_TYPE} + region: ${LINODE_REGION} + authorizedKeys: + # uncomment to include your ssh key in linode provisioning + # - ${LINODE_SSH_PUBKEY:=""} diff --git a/templates/flavors/default/machine-deployment.yaml b/templates/flavors/base/machine-deployment.yaml similarity index 93% rename from templates/flavors/default/machine-deployment.yaml rename to templates/flavors/base/machine-deployment.yaml index 481827d2f..ea513bf86 100644 --- a/templates/flavors/default/machine-deployment.yaml +++ b/templates/flavors/base/machine-deployment.yaml @@ -1,3 +1,4 @@ +--- apiVersion: cluster.x-k8s.io/v1beta1 kind: MachineDeployment metadata: @@ -15,7 +16,7 @@ spec: configRef: name: ${CLUSTER_NAME}-md-0 apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 - kind: KubeadmConfigTemplate + kind: REPLACEME infrastructureRef: name: ${CLUSTER_NAME}-md-0 apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 diff --git a/templates/flavors/base/kubeadm-control-plane.yaml b/templates/flavors/default/kubeadm-control-plane.yaml similarity index 100% rename from templates/flavors/base/kubeadm-control-plane.yaml rename to templates/flavors/default/kubeadm-control-plane.yaml diff --git a/templates/flavors/default/kustomization.yaml b/templates/flavors/default/kustomization.yaml index 58021d152..02a8fec5f 100644 --- a/templates/flavors/default/kustomization.yaml +++ b/templates/flavors/default/kustomization.yaml @@ -1,9 +1,39 @@ resources: - ../base - kubeadm-config-template.yaml - - linode-machine-template.yaml - - machine-deployment.yaml + - kubeadm-control-plane.yaml - ../../common-init-files - ../../addons/cilium - ../../addons/provider-linode - ../../addons/cluster-resource-set +patches: + - target: + group: cluster.x-k8s.io + version: v1beta1 + kind: Cluster + patch: |- + - op: replace + path: /spec/controlPlaneRef/kind + value: KubeadmControlPlane + - target: + group: cluster.x-k8s.io + version: v1beta1 + kind: Cluster + patch: |- + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + metadata: + name: ${CLUSTER_NAME} + labels: + cni: cilium + ccm: linode + crs: ${CLUSTER_NAME}-crs + - target: + group: cluster.x-k8s.io + version: v1beta1 + kind: MachineDeployment + patch: |- + - op: replace + path: /spec/template/spec/bootstrap/configRef/kind + value: KubeadmConfigTemplate + diff --git a/templates/flavors/default/linode-machine-template.yaml b/templates/flavors/default/linode-machine-template.yaml deleted file mode 100644 index af9012e2a..000000000 --- a/templates/flavors/default/linode-machine-template.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 -kind: LinodeMachineTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 -spec: - template: - spec: - image: ${LINODE_OS:="linode/ubuntu22.04"} - type: ${LINODE_MACHINE_TYPE} - region: ${LINODE_REGION} - authorizedKeys: - # uncomment to include your ssh key in linode provisioning - # - ${LINODE_SSH_PUBKEY:=""}