Skip to content

Commit

Permalink
Added some templating in the yaml and added updateCloudProviderConfig…
Browse files Browse the repository at this point in the history
… sections

Signed-off-by: Mohamed Belgaied Hassine <belgaied2@hotmail.com>
  • Loading branch information
belgaied2 committed Nov 26, 2024
1 parent 736693c commit ecb14c6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
33 changes: 20 additions & 13 deletions templates/cluster-template-kubeadm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ spec:
clusterNetwork:
pods:
cidrBlocks:
- ${POD_CIDR}
- ${POD_CIDR:-"10.42.0.0/16"}
services:
cidrBlocks:
- ${SERVICE_CIDR}
- ${SERVICE_CIDR:-"10.43.0.0/16"}
serviceDomain: cluster.local
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
Expand All @@ -36,13 +36,20 @@ metadata:
name: ${CLUSTER_NAME}-hv
namespace: ${NAMESPACE}
spec:
targetNamespace: default
targetNamespace: ${TARGET_HARVESTER_NAMESPACE}
loadBalancerConfig:
ipamType: dhcp
server: ${HARVESTER_ENDPOINT}
identitySecret:
namespace: ${NAMESPACE}
name: hv-identity-secret
${UPDATE_CLOUD_PROVIDER:- updateCloudProviderConfig:
cloudConfigCredentialsSecretKey: cloud-config
cloudConfigCredentialsSecretName: cloud-config
manifestsConfigMapKey: harvester-cloud-provider-deploy.yaml
manifestsConfigMapName: harvester-csi-driver-addon
manifestsConfigMapNamespace: ${NAMESPACE}
}
---
apiVersion: v1
kind: Secret
Expand All @@ -58,7 +65,7 @@ metadata:
namespace: ${NAMESPACE}
name: ${CLUSTER_NAME}-control-plane
spec:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
replicas: ${CONTROL_PLANE_MACHINE_COUNT:-3}
kubeadmConfigSpec:
initConfiguration:
nodeRegistration:
Expand All @@ -77,7 +84,7 @@ spec:
kind: HarvesterMachineTemplate
name: ${CLUSTER_NAME}-cp-machine
namespace: ${NAMESPACE}
version: v1.26.6
version: ${KUBERNETES_VERSION}
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
Expand All @@ -99,7 +106,7 @@ metadata:
name: ${CLUSTER_NAME}-workers
spec:
clusterName: ${CLUSTER_NAME}
replicas: ${WORKER_MACHINE_COUNT}
replicas: ${WORKER_MACHINE_COUNT:-2}
selector:
matchLabels:
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
Expand All @@ -117,7 +124,7 @@ spec:
kind: HarvesterMachineTemplate
name: ${CLUSTER_NAME}-wk-machine
namespace: ${NAMESPACE}
version: v1.26.6
version: ${KUBERNETES_VERSION}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: HarvesterMachineTemplate
Expand All @@ -129,14 +136,14 @@ spec:
spec:
cpu: 1
memory: 4Gi
sshUser: ubuntu
sshUser: ${VM_SSH_USER:-"ubuntu"}
sshKeyPair: ${SSH_KEYPAIR}
networks:
- default/untagged
- ${VM_NETWORK}
volumes:
- volumeType: image
imageName: ${VM_IMAGE_NAME}
volumeSize: 50Gi
volumeSize: ${VM_DISK_SIZE}
bootOrder: 0
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
Expand All @@ -149,14 +156,14 @@ spec:
spec:
cpu: 2
memory: 8Gi
sshUser: ubuntu
sshUser: ${VM_SSH_USER:-"ubuntu"}
sshKeyPair: ${SSH_KEYPAIR}
networks:
- default/untagged
- ${VM_NETWORK}
volumes:
- volumeType: image
imageName: ${VM_IMAGE_NAME}
volumeSize: 50Gi
volumeSize: ${VM_DISK_SIZE}
bootOrder: 0
---
apiVersion: addons.cluster.x-k8s.io/v1beta1
Expand Down
9 changes: 8 additions & 1 deletion templates/cluster-template-rke2-dhcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ spec:
listeners:
- name: rke2-server
port: 9345
protocol: TCP
protocol: TCk
backendPort: 9345
server: ${HARVESTER_ENDPOINT}
identitySecret:
namespace: ${NAMESPACE}
name: hv-identity-secret
{UPDATE_CLOUD_PROVIDER:- updateCloudProviderConfig:
cloudConfigCredentialsSecretKey: cloud-config
cloudConfigCredentialsSecretName: cloud-config
manifestsConfigMapKey: harvester-cloud-provider-deploy.yaml
manifestsConfigMapName: harvester-csi-driver-addon
manifestsConfigMapNamespace: ${NAMESPACE}
}
---
apiVersion: v1
kind: Secret
Expand Down
7 changes: 7 additions & 0 deletions templates/cluster-template-rke2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ spec:
identitySecret:
namespace: ${NAMESPACE}
name: hv-identity-secret
{UPDATE_CLOUD_PROVIDER:- updateCloudProviderConfig:
cloudConfigCredentialsSecretKey: cloud-config
cloudConfigCredentialsSecretName: cloud-config
manifestsConfigMapKey: harvester-cloud-provider-deploy.yaml
manifestsConfigMapName: harvester-csi-driver-addon
manifestsConfigMapNamespace: ${NAMESPACE}
}
---
apiVersion: v1
kind: Secret
Expand Down

0 comments on commit ecb14c6

Please sign in to comment.