Skip to content

Commit

Permalink
Add KubeVirt provider
Browse files Browse the repository at this point in the history
Signed-off-by: michal.gubricky <[email protected]>
  • Loading branch information
michal-gubricky committed Jun 25, 2024
1 parent 2605f0f commit fc274d3
Show file tree
Hide file tree
Showing 18 changed files with 334 additions and 0 deletions.
5 changes: 5 additions & 0 deletions providers/kubevirt/alpha/1-29/cluster-addon-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
values: |
metrics-server:
commonLabels:
domain: "{{ .Cluster.spec.controlPlaneEndpoint.host }}"
clusterAddonVersion: "v1"
23 changes: 23 additions & 0 deletions providers/kubevirt/alpha/1-29/cluster-addon/.helmignore
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/
9 changes: 9 additions & 0 deletions providers/kubevirt/alpha/1-29/cluster-addon/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- name: metrics-server
repository: https://kubernetes-sigs.github.io/metrics-server/
version: 3.12.1
- name: cilium
repository: https://helm.cilium.io/
version: 1.15.4
digest: sha256:0f2643fe4bad1a49d555cc630f24ee9582d82f5807b7ca832a0791fcc35495e1
generated: "2024-05-28T09:13:21.475025057+02:00"
13 changes: 13 additions & 0 deletions providers/kubevirt/alpha/1-29/cluster-addon/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
dependencies:
- alias: metrics-server
name: metrics-server
repository: https://kubernetes-sigs.github.io/metrics-server/
version: 3.12.1
- alias: cilium
name: cilium
repository: https://helm.cilium.io/
version: 1.15.4
name: kubevirt-alpha-1-29-cluster-addon
type: application
version: v1
Binary file not shown.
Binary file not shown.
22 changes: 22 additions & 0 deletions providers/kubevirt/alpha/1-29/cluster-addon/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
metrics-server:
fullnameOverride: metrics-server
replicas: 1
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1

service:
labels:
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "Metrics-server"

defaultArgs:
- --cert-dir=/tmp
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
- --kubelet-use-node-status-port
- --metric-resolution=15s

args:
- --kubelet-insecure-tls
23 changes: 23 additions & 0 deletions providers/kubevirt/alpha/1-29/cluster-class/.helmignore
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/
7 changes: 7 additions & 0 deletions providers/kubevirt/alpha/1-29/cluster-class/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
description: |
This chart installs and configures:
* KubeVirt Alpha Cluster Class
name: kubevirt-alpha-1-29-cluster-class
type: application
version: v1
62 changes: 62 additions & 0 deletions providers/kubevirt/alpha/1-29/cluster-class/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cluster-class.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "cluster-class.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cluster-class.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cluster-class.labels" -}}
helm.sh/chart: {{ include "cluster-class.chart" . }}
{{ include "cluster-class.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cluster-class.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cluster-class.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cluster-class.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cluster-class.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
metadata:
name: {{ .Release.Name }}-{{ .Chart.Version }}
spec:
controlPlane:
ref:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}-control-plane
machineInfrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}-control-plane
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtClusterTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}-cluster
workers:
machineDeployments:
- class: default-worker
template:
bootstrap:
ref:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}-default-worker
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}-default-worker
variables:
- name: image
required: false
schema:
openAPIV3Schema:
type: string
default: "quay.io/capk/ubuntu-2204-container-disk:v1.29.5"
example: "quay.io/capk/ubuntu-2204-container-disk:v1.29.5"
description: "Container image used by worker and control plane nodes"
patches:
- name: image
description: Overrides image data for worker and control plane nodes
enabledIf: {{ `"{{ if .image }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
matchResources:
controlPlane: true
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: replace
path: /spec/template/spec/virtualMachineTemplate/spec/template/spec/volumes
valueFrom:
template: |
- name: containervolume
containerDisk:
image: '{{"{{"}} .image {{"}}"}}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: {{ .Release.Name }}-{{ .Chart.Version }}-default-worker
spec:
template:
spec:
joinConfiguration:
nodeRegistration:
kubeletExtraArgs: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
metadata:
name: {{ .Release.Name }}-{{ .Chart.Version }}-control-plane
spec:
template:
spec:
kubeadmConfigSpec:
initConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
joinConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtClusterTemplate
metadata:
name: {{ .Release.Name }}-{{ .Chart.Version }}-cluster
spec:
template:
spec:
controlPlaneServiceTemplate:
spec:
type: LoadBalancer
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
metadata:
name: {{ .Release.Name }}-{{ .Chart.Version }}-control-plane
spec:
template:
spec:
virtualMachineBootstrapCheck:
checkStrategy: ssh
virtualMachineTemplate:
spec:
runStrategy: Always
template:
spec:
domain:
cpu:
cores: {{ .Values.cpu.cores }}
devices:
disks:
- disk:
bus: virtio
name: containervolume
networkInterfaceMultiqueue: true
memory:
guest: {{ .Values.memory }}
evictionStrategy: External
volumes:
- containerDisk:
image: {{ .Values.image.url }}
name: containervolume
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
metadata:
name: {{ .Release.Name }}-{{ .Chart.Version }}-default-worker
spec:
template:
spec:
virtualMachineBootstrapCheck:
checkStrategy: ssh
virtualMachineTemplate:
spec:
runStrategy: Always
template:
spec:
domain:
cpu:
cores: {{ .Values.cpu.cores }}
devices:
disks:
- disk:
bus: virtio
name: containervolume
networkInterfaceMultiqueue: true
memory:
guest: {{ .Values.memory }}
evictionStrategy: External
volumes:
- containerDisk:
image: {{ .Values.image.url }}
name: containervolume
6 changes: 6 additions & 0 deletions providers/kubevirt/alpha/1-29/cluster-class/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
image:
url: quay.io/capk/ubuntu-2204-container-disk:v1.29.5

cpu:
cores: 2
memory: 4Gi
6 changes: 6 additions & 0 deletions providers/kubevirt/alpha/1-29/csctl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: csctl.clusterstack.x-k8s.io/v1alpha1
config:
kubernetesVersion: v1.29.5
clusterStackName: alpha
provider:
type: kubevirt

0 comments on commit fc274d3

Please sign in to comment.