Housekeeping;Add separate storage nodepool
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2023-04-06 13:29:29 +02:00
parent 5c18869d60
commit c385baf630
6 changed files with 138 additions and 61 deletions

View File

@ -39,7 +39,7 @@
mode: 0600 mode: 0600
vars: vars:
_template: _template:
name: argocd-gitrepo-mc-gitopsconfig name: gitrepo-mc-gitopsconfig
namespace: argo-cd namespace: argo-cd
url: https://git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.Config.git url: https://git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.Config.git
notify: notify:

View File

@ -52,13 +52,12 @@
version: "{{ components.clusterapi.workload.version.k8s }}" version: "{{ components.clusterapi.workload.version.k8s }}"
vip: "{{ vapp['workloadcluster.vip'] }}" vip: "{{ vapp['workloadcluster.vip'] }}"
- name: Generate kustomization template - name: Generate cluster-template kustomization manifest
ansible.builtin.template: ansible.builtin.template:
src: kustomization.cluster-template.j2 src: kustomization.cluster-template.j2
dest: /opt/metacluster/cluster-api/infrastructure-vsphere/{{ components.clusterapi.management.version.infrastructure_vsphere }}/kustomization.yaml dest: /opt/metacluster/cluster-api/infrastructure-vsphere/{{ components.clusterapi.management.version.infrastructure_vsphere }}/kustomization.yaml
vars: vars:
_template: _template:
additionaldisk: "{{ vapp['workloadcluster.additionaldisk'] }}"
network: network:
fqdn: "{{ vapp['metacluster.fqdn'] }}" fqdn: "{{ vapp['metacluster.fqdn'] }}"
dnsserver: "{{ vapp['guestinfo.dnsserver'] }}" dnsserver: "{{ vapp['guestinfo.dnsserver'] }}"
@ -105,7 +104,8 @@
clustersize: >- clustersize: >-
{{ { {{ {
'controlplane': vapp['deployment.type'] | regex_findall('^cp(\d)+') | first, 'controlplane': vapp['deployment.type'] | regex_findall('^cp(\d)+') | first,
'workers': vapp['deployment.type'] | regex_findall('w(\d)+$') | first 'worker': vapp['deployment.type'] | regex_findall('w(\d)+$') | first,
'workerstorage': vapp['deployment.type'] | regex_findall('ws(\d)+') | first
} }} } }}
- name: Generate workload cluster manifest - name: Generate workload cluster manifest
@ -114,7 +114,7 @@
clusterctl generate cluster \ clusterctl generate cluster \
{{ vapp['workloadcluster.name'] | lower }} \ {{ vapp['workloadcluster.name'] | lower }} \
--control-plane-machine-count {{ clustersize.controlplane }} \ --control-plane-machine-count {{ clustersize.controlplane }} \
--worker-machine-count {{ clustersize.workers }} \ --worker-machine-count {{ clustersize.worker }} \
--from ./custom-cluster-template.yaml \ --from ./custom-cluster-template.yaml \
--config ./clusterctl.yaml \ --config ./clusterctl.yaml \
--kubeconfig {{ kubeconfig.path }} --kubeconfig {{ kubeconfig.path }}
@ -138,6 +138,23 @@
-f {{ capi_clustermanifest.path }}/new-cluster.yaml \ -f {{ capi_clustermanifest.path }}/new-cluster.yaml \
-o {{ capi_clustermanifest.path }}/manifests -o {{ capi_clustermanifest.path }}/manifests
- name: Generate nodepool kustomization manifest
ansible.builtin.template:
src: kustomization.nodepool.j2
dest: "{{ capi_clustermanifest.path }}/kustomization.yaml"
vars:
_template:
cluster:
name: "{{ vapp['workloadcluster.name'] }}"
nodepool:
size: "{{ clustersize.workerstorage }}"
additionaldisk: "{{ vapp['workloadcluster.additionaldisk'] }}"
- name: Store nodepool manifest
ansible.builtin.copy:
dest: "{{ capi_clustermanifest.path }}/manifests/nodepool-worker-storage.yaml"
content: "{{ lookup('kubernetes.core.kustomize', dir=capi_clustermanifest.path) }}"
- name: Create in-cluster IpPool - name: Create in-cluster IpPool
ansible.builtin.template: ansible.builtin.template:
src: ippool.j2 src: ippool.j2
@ -181,7 +198,7 @@
mode: 0600 mode: 0600
vars: vars:
_template: _template:
name: argocd-gitrepo-mc-gitopsclusterapi name: gitrepo-mc-gitopsclusterapi
namespace: argo-cd namespace: argo-cd
url: https://git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.ClusterAPI.git url: https://git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.ClusterAPI.git
notify: notify:

View File

@ -75,7 +75,7 @@
mode: 0600 mode: 0600
vars: vars:
_template: _template:
name: argocd-gitrepo-wl-gitopsconfig name: gitrepo-wl-gitopsconfig
namespace: argo-cd namespace: argo-cd
url: https://git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git url: https://git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git
notify: notify:

View File

@ -25,18 +25,6 @@ patchesStrategicMerge:
spec: spec:
clusterConfiguration: clusterConfiguration:
imageRepository: registry.{{ _template.network.fqdn }}/kubeadm imageRepository: registry.{{ _template.network.fqdn }}/kubeadm
diskSetup:
filesystems:
- device: /dev/sdb1
filesystem: ext4
label: blockstorage
partitions:
- device: /dev/sdb
layout: true
tableType: gpt
mounts:
- - LABEL=blockstorage
- /mnt/blockstorage
- |- - |-
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate kind: KubeadmConfigTemplate
@ -98,8 +86,6 @@ patchesStrategicMerge:
spec: spec:
template: template:
spec: spec:
additionalDisksGiB:
- {{ _template.additionaldisk }}
network: network:
devices: devices:
- dhcp4: false - dhcp4: false
@ -176,28 +162,6 @@ patchesJson6902:
value: {{ cmd }} value: {{ cmd }}
{% endfor %} {% endfor %}
- target:
group: cluster.x-k8s.io
version: v1beta1
kind: MachineDeployment
name: \${CLUSTER_NAME}-md-0
patch: |-
- op: replace
path: /metadata/name
value: ${CLUSTER_NAME}-worker
- op: replace
path: /spec/template/spec/bootstrap/configRef/name
value: ${CLUSTER_NAME}-worker
- target:
group: bootstrap.cluster.x-k8s.io
version: v1beta1
kind: KubeadmConfigTemplate
name: \${CLUSTER_NAME}-md-0
patch: |-
- op: replace
path: /metadata/name
value: ${CLUSTER_NAME}-worker
- target: - target:
group: infrastructure.cluster.x-k8s.io group: infrastructure.cluster.x-k8s.io
version: v1beta1 version: v1beta1
@ -228,3 +192,25 @@ patchesJson6902:
- op: replace - op: replace
path: /spec/controlPlaneRef/name path: /spec/controlPlaneRef/name
value: ${CLUSTER_NAME}-master value: ${CLUSTER_NAME}-master
- target:
group: cluster.x-k8s.io
version: v1beta1
kind: MachineDeployment
name: \${CLUSTER_NAME}-md-0
patch: |-
- op: replace
path: /metadata/name
value: ${CLUSTER_NAME}-worker
- op: replace
path: /spec/template/spec/bootstrap/configRef/name
value: ${CLUSTER_NAME}-worker
- target:
group: bootstrap.cluster.x-k8s.io
version: v1beta1
kind: KubeadmConfigTemplate
name: \${CLUSTER_NAME}-md-0
patch: |-
- op: replace
path: /metadata/name
value: ${CLUSTER_NAME}-worker

View File

@ -0,0 +1,74 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- manifests/kubeadmconfigtemplate-{{ _template.cluster.name }}-worker.yaml
- manifests/machinedeployment-{{ _template.cluster.name }}-worker.yaml
- manifests/vspheremachinetemplate-{{ _template.cluster.name }}-worker.yaml
patchesStrategicMerge:
- |-
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: {{ _template.cluster.name }}-worker
namespace: default
spec:
template:
spec:
diskSetup:
filesystems:
- device: /dev/sdb1
filesystem: ext4
label: blockstorage
partitions:
- device: /dev/sdb
layout: true
tableType: gpt
mounts:
- - LABEL=blockstorage
- /mnt/blockstorage
patchesJson6902:
- target:
group: bootstrap.cluster.x-k8s.io
version: v1beta1
kind: KubeadmConfigTemplate
name: {{ _template.cluster.name }}-worker
patch: |-
- op: replace
path: /metadata/name
value: {{ _template.cluster.name }}-worker-storage
- target:
group: cluster.x-k8s.io
version: v1beta1
kind: MachineDeployment
name: {{ _template.cluster.name }}-worker
patch: |-
- op: replace
path: /metadata/name
value: {{ _template.cluster.name }}-worker-storage
- op: replace
path: /spec/template/spec/bootstrap/configRef/name
value: {{ _template.cluster.name }}-worker-storage
- op: replace
path: /spec/template/spec/infrastructureRef/name
value: {{ _template.cluster.name }}-worker-storage
- op: replace
path: /spec/replicas
value: {{ _template.nodepool.size }}
- target:
group: infrastructure.cluster.x-k8s.io
version: v1beta1
kind: VSphereMachineTemplate
name: {{ _template.cluster.name }}-worker
patch: |-
- op: replace
path: /metadata/name
value: {{ _template.cluster.name }}-worker-storage
- op: add
path: /spec/template/spec
value:
additionalDisksGiB:
- {{ _template.nodepool.additionaldisk }}

View File

@ -1,11 +1,11 @@
DeploymentConfigurations: DeploymentConfigurations:
- Id: cp1w1 - Id: cp1w1ws0
Label: 'Workload-cluster: 1 control-plane node/1 worker node' Label: 'Workload-cluster: 1 control-plane node/1 worker node'
Description: 1 control-plane node/1 worker node Description: 1 control-plane node/1 worker node
- Id: cp1w2 - Id: cp1w1ws1
Label: 'Workload-cluster: 1 control-plane node/2 worker nodes' Label: 'Workload-cluster: 1 control-plane node/1 worker node/1 worker-storage node'
Description: 1 control-plane node/2 worker nodes Description: 1 control-plane node/2 worker nodes
- Id: core - Id: core
@ -28,8 +28,8 @@ PropertyCategories:
- Key: deployment.type - Key: deployment.type
Type: string Type: string
Value: Value:
- cp1w1 - cp1w1ws0
- cp1w2 - cp1w1ws1
- core - core
UserConfigurable: false UserConfigurable: false
@ -128,8 +128,8 @@ PropertyCategories:
Description: '' Description: ''
DefaultValue: 'workload-{{ hostname.suffix }}' DefaultValue: 'workload-{{ hostname.suffix }}'
Configurations: Configurations:
- cp1w1 - cp1w1ws0
- cp1w2 - cp1w1ws1
UserConfigurable: true UserConfigurable: true
- Key: workloadcluster.vip - Key: workloadcluster.vip
@ -138,8 +138,8 @@ PropertyCategories:
Description: Workload-cluster control plane endpoint virtual IP address Description: Workload-cluster control plane endpoint virtual IP address
DefaultValue: '0.0.0.0' DefaultValue: '0.0.0.0'
Configurations: Configurations:
- cp1w1 - cp1w1ws0
- cp1w2 - cp1w1ws1
UserConfigurable: true UserConfigurable: true
- Key: ippool.startip - Key: ippool.startip
@ -148,8 +148,8 @@ PropertyCategories:
Description: All nodes for the workload-cluster will be provisioned within this IP pool Description: All nodes for the workload-cluster will be provisioned within this IP pool
DefaultValue: '0.0.0.0' DefaultValue: '0.0.0.0'
Configurations: Configurations:
- cp1w1 - cp1w1ws0
- cp1w2 - cp1w1ws1
UserConfigurable: true UserConfigurable: true
- Key: ippool.endip - Key: ippool.endip
@ -158,8 +158,8 @@ PropertyCategories:
Description: All nodes for the workload-cluster will be provisioned within this IP pool Description: All nodes for the workload-cluster will be provisioned within this IP pool
DefaultValue: '0.0.0.0' DefaultValue: '0.0.0.0'
Configurations: Configurations:
- cp1w1 - cp1w1ws0
- cp1w2 - cp1w1ws1
UserConfigurable: true UserConfigurable: true
- Key: workloadcluster.nodesize - Key: workloadcluster.nodesize
@ -171,18 +171,18 @@ PropertyCategories:
- MEDIUM: 4 vCPU/8GB RAM - MEDIUM: 4 vCPU/8GB RAM
DefaultValue: 'small' DefaultValue: 'small'
Configurations: Configurations:
- cp1w1 - cp1w1ws0
- cp1w2 - cp1w1ws1
UserConfigurable: true UserConfigurable: true
- Key: workloadcluster.additionaldisk - Key: workloadcluster.additionaldisk
Type: int(0..120) Type: int(0..120)
Label: Workload-cluster block storage disk size* Label: Workload-cluster block storage disk size*
Description: 'All worker-nodes for the workload-cluster will be provisioned with an additional disk of the specified size' Description: 'All worker-storage nodes for the workload-cluster will be provisioned with an additional disk of the specified size'
DefaultValue: '20' DefaultValue: '20'
Configurations: Configurations:
- cp1w1 - cp1w1ws0
- cp1w2 - cp1w1ws1
UserConfigurable: true UserConfigurable: true
- Name: 4) Common - Name: 4) Common