Skip to content

Commit

Permalink
Fix rke2 cluster class (#80)
Browse files Browse the repository at this point in the history
* Update RKE2 Cluster Class

Signed-off-by: Andrea Mazzotti <[email protected]>
  • Loading branch information
anmazzotti authored Jul 29, 2024
1 parent 8c559a7 commit 4482c01
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ spec:
value: ${CONTROL_PLANE_ENDPOINT_PORT:=6443}
- name: vipInterface
value: ${VIP_INTERFACE:=eth0}
- name: k8sVersion
value: "v${KUBERNETES_VERSION:=1.30.1}+rke2r1"

11 changes: 10 additions & 1 deletion infrastructure-elemental/v0.0.0/clusterclass-rke2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ spec:
openAPIV3Schema:
type: string
default: "eth0"
- name: k8sVersion
required: true
schema:
openAPIV3Schema:
type: string
patches:
- name: elementalClusterTemplate
definitions:
Expand All @@ -76,7 +81,11 @@ spec:
controlPlane: true
jsonPatches:
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/files"
path: "/spec/template/spec/version"
valueFrom:
variable: k8sVersion
- op: add
path: "/spec/template/spec/files"
valueFrom:
template: |
- content: |
Expand Down
58 changes: 28 additions & 30 deletions test/scripts/apply_all_templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,20 @@ k3s > $MANIFEST_K3S
kubectl create namespace $MANIFEST_K3S_NAMESPACE
kubectl apply -f $MANIFEST_K3S

## k3s clusterclass not supported upstream yet
# printf "\n##### k3s-clusterclass #####\n"
# MANIFEST_K3S_CLUSTERCLASS="$MANIFESTS_DIR/k3s-clusterclass.yaml"
# MANIFEST_K3S_CLUSTERCLASS_NAMESPACE="k3s-clusterclass"
# kubectl delete namespace $MANIFEST_K3S_CLUSTERCLASS_NAMESPACE --ignore-not-found
# clusterctl generate cluster --config $CONFIG_FILE \
# --control-plane-machine-count=1 \
# --worker-machine-count=1 \
# --infrastructure elemental:$PROVIDER_VERSION \
# --target-namespace $MANIFEST_K3S_CLUSTERCLASS_NAMESPACE \
# --flavor k3s-clusterclass \
# --v $LOG_LEVEL \
# k3s-clusterclass > $MANIFEST_K3S_CLUSTERCLASS
# kubectl create namespace $MANIFEST_K3S_CLUSTERCLASS_NAMESPACE
# kubectl apply -f $MANIFEST_K3S_CLUSTERCLASS
printf "\n##### k3s-clusterclass #####\n"
MANIFEST_K3S_CLUSTERCLASS="$MANIFESTS_DIR/k3s-clusterclass.yaml"
MANIFEST_K3S_CLUSTERCLASS_NAMESPACE="k3s-clusterclass"
kubectl delete namespace $MANIFEST_K3S_CLUSTERCLASS_NAMESPACE --ignore-not-found
clusterctl generate cluster --config $CONFIG_FILE \
--control-plane-machine-count=1 \
--worker-machine-count=1 \
--infrastructure elemental:$PROVIDER_VERSION \
--target-namespace $MANIFEST_K3S_CLUSTERCLASS_NAMESPACE \
--flavor k3s-clusterclass \
--v $LOG_LEVEL \
k3s-clusterclass > $MANIFEST_K3S_CLUSTERCLASS
kubectl create namespace $MANIFEST_K3S_CLUSTERCLASS_NAMESPACE
kubectl apply -f $MANIFEST_K3S_CLUSTERCLASS

# rke2
printf "\n##### rke2 #####\n"
Expand All @@ -100,21 +99,20 @@ rke2 > $MANIFEST_RKE2
kubectl create namespace $MANIFEST_RKE2_NAMESPACE
kubectl apply -f $MANIFEST_RKE2

# rke2 clusterclass not supported upstream yet
# printf "\n##### rke2-clusterclass #####\n"
# MANIFEST_RKE2_CLUSTERCLASS="$MANIFESTS_DIR/rke2-clusterclass.yaml"
# MANIFEST_RKE2_CLUSTERCLASS_NAMESPACE="rke2-clusterclass"
# kubectl delete namespace $MANIFEST_RKE2_CLUSTERCLASS_NAMESPACE --ignore-not-found
# clusterctl generate cluster --config $CONFIG_FILE \
# --control-plane-machine-count=1 \
# --worker-machine-count=1 \
# --infrastructure elemental:$PROVIDER_VERSION \
# --target-namespace $MANIFEST_RKE2_CLUSTERCLASS_NAMESPACE \
# --flavor rke2-clusterclass \
# --v $LOG_LEVEL \
# rke2-clusterclass > $MANIFEST_RKE2_CLUSTERCLASS
# kubectl create namespace $MANIFEST_RKE2_CLUSTERCLASS_NAMESPACE
# kubectl apply -f $MANIFEST_RKE2_CLUSTERCLASS
printf "\n##### rke2-clusterclass #####\n"
MANIFEST_RKE2_CLUSTERCLASS="$MANIFESTS_DIR/rke2-clusterclass.yaml"
MANIFEST_RKE2_CLUSTERCLASS_NAMESPACE="rke2-clusterclass"
kubectl delete namespace $MANIFEST_RKE2_CLUSTERCLASS_NAMESPACE --ignore-not-found
clusterctl generate cluster --config $CONFIG_FILE \
--control-plane-machine-count=1 \
--worker-machine-count=1 \
--infrastructure elemental:$PROVIDER_VERSION \
--target-namespace $MANIFEST_RKE2_CLUSTERCLASS_NAMESPACE \
--flavor rke2-clusterclass \
--v $LOG_LEVEL \
rke2-clusterclass > $MANIFEST_RKE2_CLUSTERCLASS
kubectl create namespace $MANIFEST_RKE2_CLUSTERCLASS_NAMESPACE
kubectl apply -f $MANIFEST_RKE2_CLUSTERCLASS

# kubeadm
printf "\n##### kubeadm #####\n"
Expand Down

0 comments on commit 4482c01

Please sign in to comment.