Skip to content

Commit

Permalink
Add cluster template for MaaS (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
neoaggelos authored Sep 12, 2023
1 parent 3c36f6f commit 7d684df
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
17 changes: 17 additions & 0 deletions templates/cluster-template-maas.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Kubernetes cluster configuration
export KUBERNETES_VERSION=1.27.0
export CONTROL_PLANE_MACHINE_COUNT=1
export WORKER_MACHINE_COUNT=1

# MaaS domain to use
export MAAS_DNS_DOMAIN="maas"

# Control plane machine configuration
export CONTROL_PLANE_MACHINE_MINCPU="1"
export CONTROL_PLANE_MACHINE_MINMEMORY="2"
export CONTROL_PLANE_MACHINE_IMAGE="ubuntu"

# Worker machine configuration
export WORKER_MACHINE_MINCPU="1"
export WORKER_MACHINE_MINMEMORY="2"
export WORKER_MACHINE_IMAGE="ubuntu"
97 changes: 97 additions & 0 deletions templates/cluster-template-maas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Based on https://github.com/spectrocloud/cluster-api-provider-maas/blob/v4.0.2-spectro/templates/cluster-template.yaml
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
spec:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: MaasCluster
name: ${CLUSTER_NAME}
controlPlaneRef:
kind: MicroK8sControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
name: ${CLUSTER_NAME}-control-plane
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: MaasCluster
metadata:
name: ${CLUSTER_NAME}
spec:
dnsDomain: ${MAAS_DNS_DOMAIN}
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: MicroK8sControlPlane
metadata:
name: "${CLUSTER_NAME}-control-plane"
spec:
controlPlaneConfig:
initConfiguration:
joinTokenTTLInSecs: 9000
IPinIP: true
addons:
- dns
- ingress
clusterConfiguration:
portCompatibilityRemap: true
machineTemplate:
infrastructureTemplate:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: MaasMachineTemplate
name: "${CLUSTER_NAME}-control-plane"
replicas: ${CONTROL_PLANE_MACHINE_COUNT:=1}
version: "v${KUBERNETES_VERSION}"
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: MaasMachineTemplate
metadata:
name: "${CLUSTER_NAME}-control-plane"
spec:
template:
spec:
minCPU: ${CONTROL_PLANE_MACHINE_MINCPU}
minMemory: ${CONTROL_PLANE_MACHINE_MINMEMORY}
image: ${CONTROL_PLANE_MACHINE_IMAGE}
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
clusterName: "${CLUSTER_NAME}"
replicas: ${WORKER_MACHINE_COUNT:=1}
selector:
matchLabels:
template:
spec:
clusterName: "${CLUSTER_NAME}"
version: "${KUBERNETES_VERSION}"
bootstrap:
configRef:
name: "${CLUSTER_NAME}-md-0"
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: MicroK8sConfigTemplate
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: MaasMachineTemplate
name: "${CLUSTER_NAME}-md-0"
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: MaasMachineTemplate
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
template:
spec:
minCPU: ${WORKER_MACHINE_MINCPU}
minMemory: ${WORKER_MACHINE_MINMEMORY}
image: ${WORKER_MACHINE_IMAGE}
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: MicroK8sConfigTemplate
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
template:
spec: {}

0 comments on commit 7d684df

Please sign in to comment.