From aab25313ce5e8be16ae19ac98a8af98db40d8389 Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley Date: Tue, 24 Oct 2023 13:09:59 +0100 Subject: [PATCH] Add k8s hyperconverged support Resolves: #144 --- kubernetes/kubernetes.yaml.template | 2 +- kubernetes/module_defaults | 3 ++- kubernetes/pipeline/02configure | 4 ++-- overlays/kubernetes/k8s-control-plane-ha.yaml | 2 +- .../unit_placement/kubernetes-control-plane.yaml.template | 3 +++ overlays/unit_placement/kubernetes-worker.yaml.template | 3 +++ overlays/unit_placement/openstack-integrator.yaml.template | 3 +++ 7 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 overlays/unit_placement/kubernetes-control-plane.yaml.template create mode 100644 overlays/unit_placement/kubernetes-worker.yaml.template create mode 100644 overlays/unit_placement/openstack-integrator.yaml.template diff --git a/kubernetes/kubernetes.yaml.template b/kubernetes/kubernetes.yaml.template index b0417cf9..8245d279 100644 --- a/kubernetes/kubernetes.yaml.template +++ b/kubernetes/kubernetes.yaml.template @@ -7,7 +7,7 @@ applications: charm: __CHARM_STORE____CHARM_CS_NS____CHARM_CH_PREFIX__kubernetes-control-plane constraints: mem=2G expose: true - num_units: __NUM_K8S_MASTER_UNITS__ + num_units: __NUM_K8S_CONTROL_PLANE_UNITS__ options: channel: *k8s_channel kubernetes-worker: diff --git a/kubernetes/module_defaults b/kubernetes/module_defaults index 1954d9ab..72a4c3ff 100644 --- a/kubernetes/module_defaults +++ b/kubernetes/module_defaults @@ -12,8 +12,9 @@ MOD_PARAMS[__K8S_CHANNEL__]="latest/stable" MOD_PARAMS[__NUM_ETCD_UNITS__]=1 MOD_PARAMS[__NUM_EASYRSA_UNITS__]=1 -MOD_PARAMS[__NUM_K8S_MASTER_UNITS__]=1 +MOD_PARAMS[__NUM_K8S_CONTROL_PLANE_UNITS__]=1 MOD_PARAMS[__NUM_K8S_WORKER_UNITS__]=2 +MOD_PARAMS[__NUM_K8S_OST_INTEGRATOR_UNITS__]=1 MOD_PARAMS[__NUM_K8S_LB_UNITS__]=1 MOD_PARAMS[__ETCD_SNAP_CHANNEL__]='latest/stable' MOD_PARAMS[__CONTAINER_RUNTIME__]='containerd' diff --git a/kubernetes/pipeline/02configure b/kubernetes/pipeline/02configure index 879845bc..68c82c4d 100644 --- a/kubernetes/pipeline/02configure +++ b/kubernetes/pipeline/02configure @@ -167,7 +167,7 @@ do echo "ERROR: you can't do --lb-ha and --control-plane-ha at the same time." exit 1 fi - get_units $1 __NUM_K8S_MASTER_UNITS__ 3 + get_units $1 __NUM_K8S_CONTROL_PLANE_UNITS__ 3 MOD_OVERLAYS+=( "kubernetes/k8s-control-plane-ha.yaml" ) check_hacluster_channel ;; @@ -193,7 +193,7 @@ do shift ;; --num-control-planes) #__OPT__type: - MOD_PARAMS[__NUM_K8S_MASTER_UNITS__]=$2 + MOD_PARAMS[__NUM_K8S_CONTROL_PLANE_UNITS__]=$2 shift ;; --rook-ceph) diff --git a/overlays/kubernetes/k8s-control-plane-ha.yaml b/overlays/kubernetes/k8s-control-plane-ha.yaml index 98312e20..71ca93ec 100644 --- a/overlays/kubernetes/k8s-control-plane-ha.yaml +++ b/overlays/kubernetes/k8s-control-plane-ha.yaml @@ -5,7 +5,7 @@ applications: kubernetes-control-plane-hacluster: charm: __CHARM_STORE____CHARM_CS_NS____CHARM_CH_PREFIX__hacluster options: - cluster_count: __NUM_K8S_MASTER_UNITS__ + cluster_count: __NUM_K8S_CONTROL_PLANE_UNITS__ relations: - [ kubernetes-control-plane-hacluster, kubernetes-control-plane ] - [ kubernetes-control-plane:kube-api-endpoint, kubernetes-worker:kube-api-endpoint ] diff --git a/overlays/unit_placement/kubernetes-control-plane.yaml.template b/overlays/unit_placement/kubernetes-control-plane.yaml.template new file mode 100644 index 00000000..39444b13 --- /dev/null +++ b/overlays/unit_placement/kubernetes-control-plane.yaml.template @@ -0,0 +1,3 @@ + kubernetes-control-plane: + to: +__UNIT_PLACEMENT_LXD__.__UNITS__.__NUM_K8S_CONTROL_PLANE_UNITS__ diff --git a/overlays/unit_placement/kubernetes-worker.yaml.template b/overlays/unit_placement/kubernetes-worker.yaml.template new file mode 100644 index 00000000..b73cc7f8 --- /dev/null +++ b/overlays/unit_placement/kubernetes-worker.yaml.template @@ -0,0 +1,3 @@ + kubernetes-worker: + to: +__UNIT_PLACEMENT_LXD__.__UNITS__.__NUM_K8S_WORKER_UNITS__ diff --git a/overlays/unit_placement/openstack-integrator.yaml.template b/overlays/unit_placement/openstack-integrator.yaml.template new file mode 100644 index 00000000..69c4dbe6 --- /dev/null +++ b/overlays/unit_placement/openstack-integrator.yaml.template @@ -0,0 +1,3 @@ + openstack-integrator: + to: +__UNIT_PLACEMENT_LXD__.__UNITS__.__NUM_K8S_OST_INTEGRATOR_UNITS__