From ffe763b96aeb833578f7832349e1102facc85906 Mon Sep 17 00:00:00 2001 From: Rishabh Kumar Jain Date: Mon, 25 Jan 2021 11:13:34 -0800 Subject: [PATCH] Update docker base template (CAPD) - update cluster, controlplane and workers template - update includes removing machine health check crd - update pod and service cidr - remove cni application as post kubeadm command Relates-To: #452 Change-Id: I04f0a3ed0966cdb6a58d618e50381b45b80f1f10 --- .../function/k8scontrol-capd/cluster.yaml | 23 +++++----- .../k8scontrol-capd/controlplane.yaml | 42 ++++--------------- manifests/function/workers-capd/workers.yaml | 16 +++---- 3 files changed, 27 insertions(+), 54 deletions(-) diff --git a/manifests/function/k8scontrol-capd/cluster.yaml b/manifests/function/k8scontrol-capd/cluster.yaml index e4c4b4d8a..e831f3d65 100644 --- a/manifests/function/k8scontrol-capd/cluster.yaml +++ b/manifests/function/k8scontrol-capd/cluster.yaml @@ -1,26 +1,29 @@ -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 -kind: DockerCluster -metadata: - name: "target-cluster" --- apiVersion: cluster.x-k8s.io/v1alpha3 kind: Cluster metadata: name: "target-cluster" + namespace: default spec: clusterNetwork: - pods: - cidrBlocks: - - 172.17.0.0/16 - serviceDomain: cluster.local services: - cidrBlocks: - - 10.0.0.0/24 + cidrBlocks: ["10.128.0.0/12"] + pods: + cidrBlocks: ["192.168.0.0/16"] + serviceDomain: "cluster.local" infrastructureRef: apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: DockerCluster name: "target-cluster" + namespace: default controlPlaneRef: kind: KubeadmControlPlane apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 name: "target-cluster-control-plane" + namespace: default +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +kind: DockerCluster +metadata: + name: "target-cluster" + namespace: default diff --git a/manifests/function/k8scontrol-capd/controlplane.yaml b/manifests/function/k8scontrol-capd/controlplane.yaml index a095ac80e..e7c6a7809 100644 --- a/manifests/function/k8scontrol-capd/controlplane.yaml +++ b/manifests/function/k8scontrol-capd/controlplane.yaml @@ -3,6 +3,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: DockerMachineTemplate metadata: name: "target-cluster-control-plane" + namespace: default spec: template: spec: @@ -14,53 +15,26 @@ kind: KubeadmControlPlane apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 metadata: name: "target-cluster-control-plane" + namespace: default spec: replicas: ${ CONTROL_PLANE_MACHINE_COUNT } infrastructureTemplate: kind: DockerMachineTemplate apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 name: "target-cluster-control-plane" + namespace: default kubeadmConfigSpec: clusterConfiguration: - apiServer: - certSANs: - - localhost - - 127.0.0.1 controllerManager: - extraArgs: - enable-hostpath-provisioner: "true" - files: - - path: /calico.sh - owner: root:root - permissions: "0755" - content: | - #!/bin/sh -x - su - root -c "sleep 10; kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://docs.projectcalico.org/v3.12/manifests/calico.yaml" + extraArgs: {enable-hostpath-provisioner: 'true'} + apiServer: + certSANs: [localhost, 127.0.0.1] initConfiguration: nodeRegistration: criSocket: /var/run/containerd/containerd.sock - kubeletExtraArgs: - eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0% + kubeletExtraArgs: {eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'} joinConfiguration: nodeRegistration: criSocket: /var/run/containerd/containerd.sock - kubeletExtraArgs: - eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0% - postKubeadmCommands: - - sh /calico.sh + kubeletExtraArgs: {eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'} version: "v1.18.6" ---- -apiVersion: cluster.x-k8s.io/v1alpha3 -kind: MachineHealthCheck -metadata: - name: "target-cluster-mhc-0" -spec: - clusterName: "target-cluster" - maxUnhealthy: 100% - selector: - matchLabels: - nodepool: "pool1" - unhealthyConditions: - - type: E2ENodeUnhealthy - status: "True" - timeout: 30s diff --git a/manifests/function/workers-capd/workers.yaml b/manifests/function/workers-capd/workers.yaml index add9d5e37..68a8ff61c 100644 --- a/manifests/function/workers-capd/workers.yaml +++ b/manifests/function/workers-capd/workers.yaml @@ -1,25 +1,22 @@ ---- apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: DockerMachineTemplate metadata: name: "target-cluster-md-0" + namespace: default spec: template: - spec: - extraMounts: - - containerPath: "/var/run/docker.sock" - hostPath: "/var/run/docker.sock" + spec: {} --- apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 kind: KubeadmConfigTemplate metadata: name: "target-cluster-md-0" + namespace: default spec: template: spec: joinConfiguration: nodeRegistration: - criSocket: /var/run/containerd/containerd.sock kubeletExtraArgs: {eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'} --- apiVersion: cluster.x-k8s.io/v1alpha3 @@ -32,18 +29,17 @@ spec: selector: matchLabels: template: - metadata: - labels: - "nodepool": "pool1" spec: clusterName: "target-cluster" - version: "v1.18.6" + version: "v1.18.6" bootstrap: configRef: name: "target-cluster-md-0" + namespace: default apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 kind: KubeadmConfigTemplate infrastructureRef: name: "target-cluster-md-0" + namespace: default apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: DockerMachineTemplate