Initial commit: Add tinkerbell-k0s cluster templates
This commit is contained in:
6
tinkerbell-k0s-standalone/Chart.yaml
Normal file
6
tinkerbell-k0s-standalone/Chart.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: tinkerbell-k0s-standalone
|
||||
description: K0s cluster on Tinkerbell infrastructure
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.33.4"
|
||||
24
tinkerbell-k0s-standalone/templates/cluster.yaml
Normal file
24
tinkerbell-k0s-standalone/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 | quote }}
|
||||
port: {{ .Values.controlPlaneEndpoint.port }}
|
||||
controlPlaneRef:
|
||||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
|
||||
kind: K0sControlPlane
|
||||
name: {{ .Release.Name }}-cp
|
||||
infrastructureRef:
|
||||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
|
||||
kind: TinkerbellCluster
|
||||
name: {{ .Release.Name }}
|
||||
39
tinkerbell-k0s-standalone/templates/k0scontrolplane.yaml
Normal file
39
tinkerbell-k0s-standalone/templates/k0scontrolplane.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
|
||||
kind: K0sControlPlane
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-cp
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
replicas: {{ .Values.controlPlaneNumber }}
|
||||
version: {{ .Values.k0s.version }}
|
||||
k0sConfigSpec:
|
||||
args:
|
||||
{{- toYaml .Values.k0s.args | nindent 6 }}
|
||||
k0s:
|
||||
apiVersion: k0s.k0sproject.io/v1beta1
|
||||
kind: ClusterConfig
|
||||
metadata:
|
||||
name: k0s
|
||||
spec:
|
||||
telemetry:
|
||||
enabled: {{ .Values.k0s.telemetry.enabled }}
|
||||
api:
|
||||
extraArgs:
|
||||
{{- toYaml .Values.k0s.api.extraArgs | nindent 12 }}
|
||||
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 }}
|
||||
machineTemplate:
|
||||
infrastructureRef:
|
||||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
|
||||
kind: TinkerbellMachineTemplate
|
||||
name: {{ .Release.Name }}-cp
|
||||
namespace: {{ .Release.Namespace }}
|
||||
@@ -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-standalone/templates/machinedeployment.yaml
Normal file
34
tinkerbell-k0s-standalone/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 }}
|
||||
@@ -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 | quote }}
|
||||
port: {{ .Values.controlPlaneEndpoint.port }}
|
||||
@@ -0,0 +1,22 @@
|
||||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
|
||||
kind: TinkerbellMachineTemplate
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-cp
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
bootOptions:
|
||||
bootMode: {{ .Values.controlPlane.bootMode }}
|
||||
{{- if and (eq .Values.controlPlane.bootMode "isoboot") .Values.controlPlane.isoURL }}
|
||||
isoURL: {{ .Values.controlPlane.isoURL }}
|
||||
{{- end }}
|
||||
hardwareAffinity:
|
||||
required:
|
||||
- labelSelector:
|
||||
matchLabels:
|
||||
{{- toYaml .Values.controlPlane.hardwareAffinity.matchLabels | nindent 16 }}
|
||||
{{- if .Values.controlPlane.templateOverride }}
|
||||
templateOverride: |
|
||||
{{- .Values.controlPlane.templateOverride | nindent 8 }}
|
||||
{{- end }}
|
||||
@@ -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 }}
|
||||
60
tinkerbell-k0s-standalone/values.yaml
Normal file
60
tinkerbell-k0s-standalone/values.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
# Cluster parameters
|
||||
controlPlaneNumber: 1 # @schema description: The number of control plane nodes; type: integer; minimum: 1; maximum: 5
|
||||
workersNumber: 1 # @schema description: The number of worker nodes; type: integer; minimum: 0
|
||||
|
||||
clusterIdentity: # @schema description: Cluster identity reference, auto-populated; type: object
|
||||
name: "" # @schema description: Cluster identity secret name, auto-populated; type: string
|
||||
|
||||
# Cluster network configuration
|
||||
clusterNetwork: # @schema description: Cluster network configuration; type: object
|
||||
pods: # @schema description: Pod network configuration; type: object
|
||||
cidrBlocks: # @schema description: Pod CIDR blocks; type: array
|
||||
- 10.244.0.0/16
|
||||
services: # @schema description: Service network configuration; type: object
|
||||
cidrBlocks: # @schema description: Service CIDR blocks; type: array
|
||||
- 10.96.0.0/12
|
||||
|
||||
# Control plane endpoint
|
||||
controlPlaneEndpoint: # @schema description: Control plane endpoint configuration; type: object
|
||||
host: "" # @schema description: Control plane VIP address; type: string
|
||||
port: 6443 # @schema description: Control plane API port; type: integer
|
||||
|
||||
# Control plane machine configuration
|
||||
controlPlane: # @schema description: Control plane machine configuration; type: object
|
||||
bootMode: netboot # @schema description: Boot mode; type: string; enum: [netboot, isoboot]
|
||||
isoURL: "" # @schema description: ISO URL for isoboot mode; type: string
|
||||
hardwareAffinity: # @schema description: Hardware affinity for control plane; type: object
|
||||
matchLabels: # @schema description: Labels to match; type: object
|
||||
tinkerbell.org/role: control-plane
|
||||
templateOverride: "" # @schema description: Tinkerbell workflow template override; type: string
|
||||
|
||||
# Worker machine configuration
|
||||
worker: # @schema description: Worker machine configuration; type: object
|
||||
bootMode: netboot # @schema description: Boot mode; type: string; enum: [netboot, isoboot]
|
||||
isoURL: "" # @schema description: ISO URL for isoboot mode; type: string
|
||||
hardwareAffinity: # @schema description: Hardware affinity for workers; type: object
|
||||
matchLabels: # @schema description: Labels to match; type: object
|
||||
tinkerbell.org/role: worker
|
||||
templateOverride: "" # @schema description: Tinkerbell workflow template override; type: string
|
||||
args: # @schema description: Arguments to pass to k0s worker; type: array
|
||||
- --enable-cloud-provider
|
||||
|
||||
# K0s parameters
|
||||
k0s: # @schema description: K0s parameters; type: object
|
||||
version: v1.33.4+k0s.0 # @schema description: K0s version; type: string
|
||||
args: # @schema description: Arguments to pass to k0s controller; type: array
|
||||
- --enable-worker
|
||||
- --no-taints
|
||||
- --enable-dynamic-config
|
||||
- --disable-components=konnectivity-server
|
||||
api: # @schema description: Kubernetes API server parameters; type: object
|
||||
extraArgs: # @schema description: Extra arguments for API server; type: object
|
||||
anonymous-auth: "true"
|
||||
kubelet-preferred-address-types: "ExternalIP,InternalIP,Hostname"
|
||||
network: # @schema description: Network configuration for K0s; type: object
|
||||
provider: calico # @schema description: Network provider; type: string; enum: [calico, kuberouter, custom]
|
||||
calico: # @schema description: Calico configuration; type: object
|
||||
mode: vxlan # @schema description: Calico backend mode; type: string; enum: [vxlan, ipip, bird]
|
||||
ipAutodetectionMethod: first-found # @schema description: Method for detecting node IP; type: string
|
||||
telemetry: # @schema description: Telemetry configuration; type: object
|
||||
enabled: false # @schema description: Enable telemetry; type: boolean
|
||||
Reference in New Issue
Block a user