Initial commit: Add tinkerbell-k0s cluster templates
This commit is contained in:
6
tinkerbell-k0s-hcp/Chart.yaml
Normal file
6
tinkerbell-k0s-hcp/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-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 }}
|
||||
60
tinkerbell-k0s-hcp/values.yaml
Normal file
60
tinkerbell-k0s-hcp/values.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
# Cluster parameters
|
||||
controlPlaneNumber: 1 # @schema description: The number of control plane replicas (pods); 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 (optional override)
|
||||
controlPlaneEndpoint: # @schema description: Control plane endpoint configuration; type: object
|
||||
host: "" # @schema description: Optional fixed host (defaults to k0smotron.externalAddress); 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
|
||||
|
||||
# K0smotron hosted control plane parameters
|
||||
k0smotron: # @schema description: K0smotron hosted control plane parameters; type: object
|
||||
externalAddress: "" # @schema description: External address for NodePort/ClusterIP (management cluster node IP); type: string
|
||||
persistence: # @schema description: Persistence configuration for control plane; type: object
|
||||
type: emptyDir # @schema description: Persistence type (emptyDir, hostPath, pvc); type: string; enum: [emptyDir, hostPath, pvc]
|
||||
etcd: # @schema description: Etcd configuration; type: object
|
||||
persistence: # @schema description: Etcd persistence configuration; type: object
|
||||
storageClass: "" # @schema description: Storage class for etcd PVC (required for local storage); type: string
|
||||
size: 1Gi # @schema description: Size of etcd volume; type: string
|
||||
service: # @schema description: Service configuration for control plane; type: object
|
||||
type: NodePort # @schema description: Service type; type: string; enum: [LoadBalancer, NodePort, ClusterIP]
|
||||
apiPort: 30443 # @schema description: API port (use 30000-32767 for NodePort); type: integer
|
||||
konnectivityPort: 30132 # @schema description: Konnectivity port (use 30000-32767 for NodePort); type: integer
|
||||
annotations: {} # @schema description: Service annotations; type: object
|
||||
k0sConfig: true # @schema description: Enable custom k0s configuration; type: boolean
|
||||
|
||||
# K0s parameters
|
||||
k0s: # @schema description: K0s parameters; type: object
|
||||
version: v1.33.4+k0s.0 # @schema description: K0s version; type: string
|
||||
api: # @schema description: Kubernetes API server parameters; type: object
|
||||
extraArgs: # @schema description: Extra arguments for API server; type: object
|
||||
kubelet-preferred-address-types: "ExternalIP,Hostname,InternalDNS,ExternalDNS"
|
||||
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