-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from a13x5/vsphere-hosted-template
Add vSphere hosted CP template
- Loading branch information
Showing
12 changed files
with
462 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v2 | ||
name: vsphere-hosted-cp | ||
description: | | ||
An HMC template to deploy a k8s cluster on vSphere with control plane components | ||
within the management cluster. | ||
type: application | ||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.0.1 | ||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "1.30.4+k0s.0" | ||
annotations: | ||
hmc.mirantis.com/type: deployment | ||
hmc.mirantis.com/infrastructure-providers: vsphere | ||
hmc.mirantis.com/controlplane-providers: k0s | ||
hmc.mirantis.com/bootstrap-providers: k0s |
19 changes: 19 additions & 0 deletions
19
templates/cluster/vsphere-hosted-cp/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{- define "cluster.name" -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{- define "vspheremachinetemplate.name" -}} | ||
{{- include "cluster.name" . }}-mt | ||
{{- end }} | ||
|
||
{{- define "k0smotroncontrolplane.name" -}} | ||
{{- include "cluster.name" . }}-cp | ||
{{- end }} | ||
|
||
{{- define "k0sworkerconfigtemplate.name" -}} | ||
{{- include "cluster.name" . }}-machine-config | ||
{{- end }} | ||
|
||
{{- define "machinedeployment.name" -}} | ||
{{- include "cluster.name" . }}-md | ||
{{- end }} |
17 changes: 17 additions & 0 deletions
17
templates/cluster/vsphere-hosted-cp/templates/cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: Cluster | ||
metadata: | ||
name: {{ include "cluster.name" . }} | ||
spec: | ||
{{- with .Values.clusterNetwork }} | ||
clusterNetwork: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
controlPlaneRef: | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: K0smotronControlPlane | ||
name: {{ include "k0smotroncontrolplane.name" . }} | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: VSphereCluster | ||
name: {{ include "cluster.name" . }} |
86 changes: 86 additions & 0 deletions
86
templates/cluster/vsphere-hosted-cp/templates/k0smotroncontrolplane.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: K0smotronControlPlane | ||
metadata: | ||
name: {{ include "k0smotroncontrolplane.name" . }} | ||
spec: | ||
replicas: {{ .Values.controlPlaneNumber }} | ||
version: {{ .Values.k0s.version | replace "+" "-" }} | ||
{{- with .Values.k0smotron.service }} | ||
service: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
controllerPlaneFlags: | ||
- "--enable-cloud-provider=true" | ||
- "--debug=true" | ||
k0sConfig: | ||
apiVersion: k0s.k0sproject.io/v1beta1 | ||
kind: ClusterConfig | ||
metadata: | ||
name: k0s | ||
spec: | ||
network: | ||
provider: calico | ||
calico: | ||
mode: vxlan | ||
extensions: | ||
helm: | ||
repositories: | ||
- name: vsphere-cpi | ||
url: https://kubernetes.github.io/cloud-provider-vsphere | ||
- name: mirantis | ||
url: https://charts.mirantis.com | ||
charts: | ||
- name: vsphere-cpi | ||
chartname: vsphere-cpi/vsphere-cpi | ||
version: 1.31.0 | ||
order: 1 | ||
namespace: kube-system | ||
values: | | ||
config: | ||
enabled: true | ||
vcenter: {{ .Values.vsphere.server }} | ||
datacenter: {{ .Values.vsphere.datacenter }} | ||
username: "{{ .Values.vsphere.username }}" | ||
password: "{{ .Values.vsphere.password }}" | ||
daemonset: | ||
affinity: null | ||
tolerations: | ||
- effect: NoSchedule | ||
key: node.cloudprovider.kubernetes.io/uninitialized | ||
value: "true" | ||
- effect: NoSchedule | ||
key: node-role.kubernetes.io/master | ||
operator: Exists | ||
- effect: NoSchedule | ||
key: node-role.kubernetes.io/control-plane | ||
operator: Exists | ||
- effect: NoSchedule | ||
key: node.kubernetes.io/not-ready | ||
operator: Exists | ||
- key: CriticalAddonsOnly | ||
effect: NoExecute | ||
operator: Exists | ||
- name: vsphere-csi | ||
chartname: mirantis/vsphere-csi-driver | ||
version: 0.0.1 | ||
order: 2 | ||
namespace: kube-system | ||
values: | | ||
vcenterConfig: | ||
enabled: true | ||
clusterID: {{ include "cluster.name" . }} | ||
vcenter: {{ .Values.vsphere.server }} | ||
user: "{{ .Values.vsphere.username }}" | ||
password: "{{ .Values.vsphere.password }}" | ||
datacenters: {{ .Values.vsphere.datacenter }} | ||
controller: | ||
nodeAffinity: null | ||
node: | ||
kubeletPath: /var/lib/k0s/kubelet | ||
defaultStorageClass: | ||
enabled: true | ||
images: | ||
driver: | ||
tag: v3.1.2 | ||
syncer: | ||
tag: v3.1.2 |
14 changes: 14 additions & 0 deletions
14
templates/cluster/vsphere-hosted-cp/templates/k0sworkerconfigtemplate.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: K0sWorkerConfigTemplate | ||
metadata: | ||
name: {{ include "k0sworkerconfigtemplate.name" . }} | ||
spec: | ||
template: | ||
spec: | ||
version: {{ .Values.k0s.version }} | ||
files: | ||
- path: /home/{{ .Values.ssh.user }}/.ssh/authorized_keys | ||
permissions: "0600" | ||
content: "{{ trim .Values.ssh.publicKey }}" | ||
preStartCommands: | ||
- chown {{ .Values.ssh.user }} /home/{{ .Values.ssh.user }}/.ssh/authorized_keys |
26 changes: 26 additions & 0 deletions
26
templates/cluster/vsphere-hosted-cp/templates/machinedeployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: MachineDeployment | ||
metadata: | ||
name: {{ include "machinedeployment.name" . }} | ||
spec: | ||
clusterName: {{ include "cluster.name" . }} | ||
replicas: {{ .Values.workersNumber }} | ||
selector: | ||
matchLabels: | ||
cluster.x-k8s.io/cluster-name: {{ include "cluster.name" . }} | ||
template: | ||
metadata: | ||
labels: | ||
cluster.x-k8s.io/cluster-name: {{ include "cluster.name" . }} | ||
spec: | ||
version: {{ regexReplaceAll "\\+k0s.+$" .Values.k0s.version "" }} | ||
clusterName: {{ include "cluster.name" . }} | ||
bootstrap: | ||
configRef: | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: K0sWorkerConfigTemplate | ||
name: {{ include "k0sworkerconfigtemplate.name" . }} | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: VSphereMachineTemplate | ||
name: {{ include "vspheremachinetemplate.name" . }} |
13 changes: 13 additions & 0 deletions
13
templates/cluster/vsphere-hosted-cp/templates/vspherecluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: VSphereCluster | ||
metadata: | ||
name: {{ include "cluster.name" . }} | ||
spec: | ||
identityRef: | ||
kind: VSphereClusterIdentity | ||
name: {{ .Values.clusterIdentity.name }} | ||
controlPlaneEndpoint: | ||
host: {{ .Values.controlPlaneEndpointIP }} | ||
port: 6443 | ||
server: {{ .Values.vsphere.server }} | ||
thumbprint: {{ .Values.vsphere.thumbprint }} |
25 changes: 25 additions & 0 deletions
25
templates/cluster/vsphere-hosted-cp/templates/vspheremachinetemplate.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: VSphereMachineTemplate | ||
metadata: | ||
name: {{ include "vspheremachinetemplate.name" . }} | ||
spec: | ||
template: | ||
spec: | ||
cloneMode: linkedClone | ||
datacenter: {{ .Values.vsphere.datacenter }} | ||
datastore: {{ .Values.vsphere.datastore }} | ||
diskGiB: {{ .Values.rootVolumeSize }} | ||
folder: {{ .Values.vsphere.folder }} | ||
memoryMiB: {{ .Values.memory }} | ||
network: | ||
devices: | ||
- dhcp4: true | ||
networkName: {{ .Values.network }} | ||
numCPUs: {{ .Values.cpus }} | ||
os: Linux | ||
powerOffMode: hard | ||
resourcePool: {{ .Values.vsphere.resourcePool }} | ||
server: {{ .Values.vsphere.server }} | ||
storagePolicyName: "" | ||
template: {{ .Values.vmTemplate }} | ||
thumbprint: {{ .Values.vsphere.thumbprint }} |
Oops, something went wrong.