Initial commit: Add tinkerbell-k0s cluster templates
This commit is contained in:
24
tinkerbell-k0s-hcp/templates/cluster.yaml
Normal file
24
tinkerbell-k0s-hcp/templates/cluster.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: cluster.x-k8s.io/v1beta1
|
||||
kind: Cluster
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
clusterNetwork:
|
||||
pods:
|
||||
cidrBlocks:
|
||||
{{- toYaml .Values.clusterNetwork.pods.cidrBlocks | nindent 8 }}
|
||||
services:
|
||||
cidrBlocks:
|
||||
{{- toYaml .Values.clusterNetwork.services.cidrBlocks | nindent 8 }}
|
||||
controlPlaneEndpoint:
|
||||
host: {{ .Values.controlPlaneEndpoint.host | default .Values.k0smotron.externalAddress | quote }}
|
||||
port: {{ .Values.k0smotron.service.apiPort }}
|
||||
controlPlaneRef:
|
||||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
|
||||
kind: K0smotronControlPlane
|
||||
name: {{ .Release.Name }}-cp
|
||||
infrastructureRef:
|
||||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
|
||||
kind: TinkerbellCluster
|
||||
name: {{ .Release.Name }}
|
||||
55
tinkerbell-k0s-hcp/templates/k0smotroncontrolplane.yaml
Normal file
55
tinkerbell-k0s-hcp/templates/k0smotroncontrolplane.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
|
||||
kind: K0smotronControlPlane
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-cp
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
version: {{ .Values.k0s.version }}
|
||||
replicas: {{ .Values.controlPlaneNumber }}
|
||||
{{- with .Values.k0smotron.persistence }}
|
||||
persistence:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.k0smotron.externalAddress }}
|
||||
externalAddress: {{ .Values.k0smotron.externalAddress }}
|
||||
{{- end }}
|
||||
{{- with .Values.k0smotron.etcd }}
|
||||
etcd:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
service:
|
||||
type: {{ .Values.k0smotron.service.type }}
|
||||
apiPort: {{ .Values.k0smotron.service.apiPort }}
|
||||
konnectivityPort: {{ .Values.k0smotron.service.konnectivityPort }}
|
||||
{{- with .Values.k0smotron.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.k0smotron.k0sConfig }}
|
||||
k0sConfig:
|
||||
apiVersion: k0s.k0sproject.io/v1beta1
|
||||
kind: ClusterConfig
|
||||
metadata:
|
||||
name: k0s
|
||||
spec:
|
||||
telemetry:
|
||||
enabled: {{ .Values.k0s.telemetry.enabled }}
|
||||
{{- with .Values.k0s.api }}
|
||||
api:
|
||||
{{- with .extraArgs }}
|
||||
extraArgs:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
network:
|
||||
provider: {{ .Values.k0s.network.provider }}
|
||||
podCIDR: {{ index .Values.clusterNetwork.pods.cidrBlocks 0 }}
|
||||
serviceCIDR: {{ index .Values.clusterNetwork.services.cidrBlocks 0 }}
|
||||
{{- if eq .Values.k0s.network.provider "calico" }}
|
||||
calico:
|
||||
mode: {{ .Values.k0s.network.calico.mode }}
|
||||
{{- if .Values.k0s.network.calico.ipAutodetectionMethod }}
|
||||
ipAutodetectionMethod: {{ .Values.k0s.network.calico.ipAutodetectionMethod }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
15
tinkerbell-k0s-hcp/templates/k0sworkerconfigtemplate.yaml
Normal file
15
tinkerbell-k0s-hcp/templates/k0sworkerconfigtemplate.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
{{- if gt (int .Values.workersNumber) 0 }}
|
||||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
|
||||
kind: K0sWorkerConfigTemplate
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-worker
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
version: {{ .Values.k0s.version }}
|
||||
{{- if .Values.worker.args }}
|
||||
args:
|
||||
{{- toYaml .Values.worker.args | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
34
tinkerbell-k0s-hcp/templates/machinedeployment.yaml
Normal file
34
tinkerbell-k0s-hcp/templates/machinedeployment.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- if gt (int .Values.workersNumber) 0 }}
|
||||
apiVersion: cluster.x-k8s.io/v1beta1
|
||||
kind: MachineDeployment
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-worker
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
cluster.x-k8s.io/cluster-name: {{ .Release.Name }}
|
||||
pool: worker
|
||||
spec:
|
||||
clusterName: {{ .Release.Name }}
|
||||
replicas: {{ .Values.workersNumber }}
|
||||
selector:
|
||||
matchLabels:
|
||||
cluster.x-k8s.io/cluster-name: {{ .Release.Name }}
|
||||
pool: worker
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
cluster.x-k8s.io/cluster-name: {{ .Release.Name }}
|
||||
pool: worker
|
||||
spec:
|
||||
clusterName: {{ .Release.Name }}
|
||||
version: {{ .Values.k0s.version | replace "+k0s.0" "" | replace "+k0s.1" "" }}
|
||||
bootstrap:
|
||||
configRef:
|
||||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
|
||||
kind: K0sWorkerConfigTemplate
|
||||
name: {{ .Release.Name }}-worker
|
||||
infrastructureRef:
|
||||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
|
||||
kind: TinkerbellMachineTemplate
|
||||
name: {{ .Release.Name }}-worker
|
||||
{{- end }}
|
||||
9
tinkerbell-k0s-hcp/templates/tinkerbellcluster.yaml
Normal file
9
tinkerbell-k0s-hcp/templates/tinkerbellcluster.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
|
||||
kind: TinkerbellCluster
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
controlPlaneEndpoint:
|
||||
host: {{ .Values.controlPlaneEndpoint.host | default .Values.k0smotron.externalAddress | quote }}
|
||||
port: {{ .Values.k0smotron.service.apiPort }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if gt (int .Values.workersNumber) 0 }}
|
||||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
|
||||
kind: TinkerbellMachineTemplate
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-worker
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
bootOptions:
|
||||
bootMode: {{ .Values.worker.bootMode }}
|
||||
{{- if and (eq .Values.worker.bootMode "isoboot") .Values.worker.isoURL }}
|
||||
isoURL: {{ .Values.worker.isoURL }}
|
||||
{{- end }}
|
||||
hardwareAffinity:
|
||||
required:
|
||||
- labelSelector:
|
||||
matchLabels:
|
||||
{{- toYaml .Values.worker.hardwareAffinity.matchLabels | nindent 16 }}
|
||||
{{- if .Values.worker.templateOverride }}
|
||||
templateOverride: |
|
||||
{{- .Values.worker.templateOverride | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user