rename old

This commit is contained in:
behrooz
2025-08-18 10:57:50 +03:30
parent 80e9650141
commit 5af8a4195f
58 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj

View File

@@ -0,0 +1,26 @@
apiVersion: v2
appVersion: 0.21.1
description: vcluster - Virtual Kubernetes Clusters
home: https://vcluster.com
icon: https://static.loft.sh/branding/logos/vcluster/vertical/vcluster_vertical.svg
keywords:
- developer
- development
- sharing
- share
- multi-tenancy
- tenancy
- cluster
- space
- namespace
- vcluster
- vclusters
maintainers:
- email: info@loft.sh
name: Loft Labs, Inc.
url: https://twitter.com/loft_sh
name: vcluster
sources:
- https://github.com/loft-sh/vcluster
type: application
version: 0.21.1

View File

@@ -0,0 +1,64 @@
# vcluster
## **[GitHub](https://github.com/loft-sh/vcluster)** • **[Website](https://www.vcluster.com)** • **[Quickstart](https://www.vcluster.com/docs/getting-started/setup)** • **[Documentation](https://www.vcluster.com/docs/what-are-virtual-clusters)** • **[Blog](https://loft.sh/blog)** • **[Twitter](https://twitter.com/loft_sh)** • **[Slack](https://slack.loft.sh/)**
Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.
## Prerequisites
- Kubernetes 1.18+
- Helm 3.10.0+
## Get Helm Repository Info
```bash
helm repo add loft-sh https://charts.loft.sh
helm repo update
```
See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation.
## Install Helm Chart
```bash
helm upgrade [RELEASE_NAME] loft-sh/vcluster -n [RELEASE_NAMESPACE] --create-namespace --install
```
See [vcluster docs](https://vcluster.com/docs) for configuration options.
See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation.
## Connect to the vcluster
In order to connect to the installed vcluster, please install [vcluster cli](https://www.vcluster.com/docs/getting-started/setup) and run:
```bash
vcluster connect [RELEASE_NAME] -n [RELEASE_NAMESPACE]
```
## Uninstall Helm Chart
```bash
helm uninstall [RELEASE_NAME]
```
This removes all the Kubernetes components associated with the chart and deletes the release.
See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation.
### Why Virtual Kubernetes Clusters?
- **Cluster Scoped Resources**: much more powerful than simple namespaces (virtual clusters allow users to use CRDs, namespaces, cluster roles etc.)
- **Ease of Use**: usable in any Kubernetes cluster and created in seconds either via a single command or [cluster-api](https://github.com/loft-sh/cluster-api-provider-vcluster)
- **Cost Efficient**: much cheaper and efficient than "real" clusters (single pod and shared resources just like for namespaces)
- **Lightweight**: built upon the ultra-fast k3s distribution with minimal overhead per virtual cluster (other distributions work as well)
- **Strict isolation**: complete separate Kubernetes control plane and access point for each vcluster while still being able to share certain services of the underlying host cluster
- **Cluster Wide Permissions**: allow users to install apps which require cluster-wide permissions while being limited to actually just one namespace within the host cluster
- **Great for Testing**: allow you to test different Kubernetes versions inside a single host cluster which may have a different version than the virtual clusters
Learn more on [www.vcluster.com](https://vcluster.com).
![vcluster Intro](https://github.com/loft-sh/vcluster/raw/main/docs/static/media/vcluster-comparison.png)
Learn more in the [documentation](https://vcluster.com/docs/what-are-virtual-clusters).

View File

@@ -0,0 +1,4 @@
mirrors:
"45.159.150.146:4158":
endpoint:
- http://45.159.150.146:4158

View File

@@ -0,0 +1,33 @@
{{/*
is deploy etcd enabled?
*/}}
{{- define "vcluster.database.embedded.enabled" -}}
{{- $backingStores := 0 -}}
{{- if .Values.controlPlane.backingStore.etcd.embedded.enabled -}}
{{- $backingStores = add1 $backingStores -}}
{{- end -}}
{{- if .Values.controlPlane.backingStore.etcd.deploy.enabled -}}
{{- $backingStores = add1 $backingStores -}}
{{- end -}}
{{- if .Values.controlPlane.backingStore.database.embedded.enabled -}}
{{- $backingStores = add1 $backingStores -}}
{{- end -}}
{{- if .Values.controlPlane.backingStore.database.external.enabled -}}
{{- $backingStores = add1 $backingStores -}}
{{- end -}}
{{- if gt $backingStores 1 -}}
{{- fail "you can only enable one backingStore at the same time" -}}
{{- else if or (eq $backingStores 0) .Values.controlPlane.backingStore.database.embedded.enabled -}}
{{- true -}}
{{- end -}}
{{- end -}}
{{/*
migrate from deployed etcd?
*/}}
{{- define "vcluster.etcd.embedded.migrate" -}}
{{- if and .Values.controlPlane.backingStore.etcd.embedded.enabled .Values.controlPlane.backingStore.etcd.embedded.migrateFromDeployedEtcd -}}
{{- true -}}
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,52 @@
{{/*
Define a common coredns config
*/}}
{{- define "vcluster.corefile" -}}
Corefile: |-
{{- if .Values.controlPlane.coredns.overwriteConfig }}
{{ .Values.controlPlane.coredns.overwriteConfig | indent 8 }}
{{- else }}
.:1053 {
errors
health
ready
{{- if and .Values.controlPlane.coredns.embedded .Values.networking.resolveDNS }}
vcluster
{{- end }}
{{- if .Values.networking.advanced.proxyKubelets.byHostname }}
rewrite name regex .*\.nodes\.vcluster\.com kubernetes.default.svc.cluster.local
{{- end }}
kubernetes cluster.local in-addr.arpa ip6.arpa {
{{- if .Values.controlPlane.coredns.embedded }}
kubeconfig /data/vcluster/admin.conf
{{- end }}
pods insecure
{{- if .Values.networking.advanced.fallbackHostCluster }}
fallthrough cluster.local in-addr.arpa ip6.arpa
{{- else }}
fallthrough in-addr.arpa ip6.arpa
{{- end }}
}
hosts /etc/NodeHosts {
ttl 60
reload 15s
fallthrough
}
prometheus :9153
{{- if .Values.networking.advanced.fallbackHostCluster }}
forward . {{`{{.HOST_CLUSTER_DNS}}`}}
{{- else if .Values.policies.networkPolicy.enabled }}
forward . /etc/resolv.conf {{ .Values.policies.networkPolicy.fallbackDns }} {
policy sequential
}
{{- else }}
forward . /etc/resolv.conf
{{- end }}
cache 30
loop
loadbalance
}
import /etc/coredns/custom/*.server
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,33 @@
{{- define "vcluster.distro.env" -}}
{{- if and (eq (include "vcluster.distro" .) "k3s") .Values.controlPlane.distro.k3s.env -}}
{{ toYaml .Values.controlPlane.distro.k3s.env }}
{{- else if and (eq (include "vcluster.distro" .) "k8s") .Values.controlPlane.distro.k8s.env -}}
{{ toYaml .Values.controlPlane.distro.k8s.env }}
{{- else if and (eq (include "vcluster.distro" .) "k0s") .Values.controlPlane.distro.k0s.env -}}
{{ toYaml .Values.controlPlane.distro.k0s.env }}
{{- end -}}
{{- end -}}
{{/*
vCluster Distro
*/}}
{{- define "vcluster.distro" -}}
{{- $distros := 0 -}}
{{- if .Values.controlPlane.distro.k3s.enabled -}}
k3s
{{- $distros = add1 $distros -}}
{{- end -}}
{{- if .Values.controlPlane.distro.k0s.enabled -}}
k0s
{{- $distros = add1 $distros -}}
{{- end -}}
{{- if .Values.controlPlane.distro.k8s.enabled -}}
k8s
{{- $distros = add1 $distros -}}
{{- end -}}
{{- if eq $distros 0 -}}
k8s
{{- else if gt $distros 1 -}}
{{- fail "you can only enable one distro at the same time" -}}
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,17 @@
{{- define "vcluster.controlPlane.image" -}}
{{- $tag := .Chart.Version -}}
{{- if .Values.controlPlane.statefulSet.image.tag -}}
{{- $tag = .Values.controlPlane.statefulSet.image.tag -}}
{{- end -}}
{{- include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "tag" $tag "registry" .Values.controlPlane.statefulSet.image.registry "repository" .Values.controlPlane.statefulSet.image.repository) -}}
{{- end -}}
{{- define "vcluster.image" -}}
{{- if .defaultImageRegistry -}}
{{ .defaultImageRegistry }}/{{ .repository }}:{{ .tag }}
{{- else if .registry -}}
{{ .registry }}/{{ .repository }}:{{ .tag }}
{{- else -}}
{{ .repository }}:{{ .tag }}
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,307 @@
{{- define "vcluster.initContainers" -}}
{{- if eq (include "vcluster.distro" .) "k3s" -}}
{{ include "vcluster.k3s.initContainers" . }}
{{- else if eq (include "vcluster.distro" .) "k8s" -}}
{{ include "vcluster.k8s.initContainers" . }}
{{- else if eq (include "vcluster.distro" .) "k0s" -}}
{{ include "vcluster.k0s.initContainers" . }}
{{- end -}}
{{- end -}}
{{- define "vcluster.k8s.capabilities.version" -}}
{{/* We need to workaround here for unit tests because Capabilities.KubeVersion.Version is not supported, so we use .Chart.Version */}}
{{- if hasPrefix "test-" .Chart.Version -}}
{{- regexFind "^v[0-9]+\\.[0-9]+\\.[0-9]+" (trimPrefix "test-" .Chart.Version) -}}
{{- else -}}
{{- regexFind "^v[0-9]+\\.[0-9]+\\.[0-9]+" .Capabilities.KubeVersion.Version -}}
{{- end -}}
{{- end -}}
{{/* Bump $defaultTag value whenever k8s version is bumped */}}
{{- define "vcluster.k8s.controllerManager.image.tag" -}}
{{- $defaultTag := "v1.31.1" -}}
{{- if and (not (empty .Values.controlPlane.distro.k8s.version)) (eq .Values.controlPlane.distro.k8s.controllerManager.image.tag $defaultTag) -}}
{{ .Values.controlPlane.distro.k8s.version }}
{{- else -}}
{{- if not (eq .Values.controlPlane.distro.k8s.controllerManager.image.tag $defaultTag) -}}
{{ .Values.controlPlane.distro.k8s.controllerManager.image.tag }}
{{- else if not (empty (include "vcluster.k8s.capabilities.version" .)) -}}
{{ include "vcluster.k8s.capabilities.version" . }}
{{- else -}}
{{ .Values.controlPlane.distro.k8s.controllerManager.image.tag }}
{{- end -}}
{{- end -}}
{{- end -}}
{{/* Bump $defaultTag value whenever k8s version is bumped */}}
{{- define "vcluster.k8s.apiServer.image.tag" -}}
{{- $defaultTag := "v1.31.1" -}}
{{- if and (not (empty .Values.controlPlane.distro.k8s.version)) (eq .Values.controlPlane.distro.k8s.apiServer.image.tag $defaultTag) -}}
{{ .Values.controlPlane.distro.k8s.version}}
{{- else -}}
{{- if not (eq .Values.controlPlane.distro.k8s.apiServer.image.tag $defaultTag) -}}
{{ .Values.controlPlane.distro.k8s.apiServer.image.tag }}
{{- else if not (empty (include "vcluster.k8s.capabilities.version" .)) -}}
{{ include "vcluster.k8s.capabilities.version" . }}
{{- else -}}
{{ .Values.controlPlane.distro.k8s.apiServer.image.tag }}
{{- end -}}
{{- end -}}
{{- end -}}
{{/* Bump $defaultTag value whenever k8s version is bumped */}}
{{- define "vcluster.k8s.scheduler.image.tag" -}}
{{- $defaultTag := "v1.31.1" -}}
{{- if and (not (empty .Values.controlPlane.distro.k8s.version)) (eq .Values.controlPlane.distro.k8s.scheduler.image.tag $defaultTag) -}}
{{ .Values.controlPlane.distro.k8s.version}}
{{- else -}}
{{- if not (eq .Values.controlPlane.distro.k8s.scheduler.image.tag $defaultTag) -}}
{{ .Values.controlPlane.distro.k8s.scheduler.image.tag }}
{{- else if not (empty (include "vcluster.k8s.capabilities.version" .)) -}}
{{ include "vcluster.k8s.capabilities.version" . }}
{{- else -}}
{{ .Values.controlPlane.distro.k8s.scheduler.image.tag }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- define "vcluster.k8s.initContainers" -}}
{{- include "vcluster.oldPlugins.initContainers" . }}
{{- include "vcluster.plugins.initContainers" . }}
# this is needed because the k8s containers are distroless and thus we don't have any
# way of copying the binaries otherwise
- name: vcluster-copy
image: {{ include "vcluster.controlPlane.image" . | quote }}
volumeMounts:
- mountPath: /binaries
name: binaries
command:
- /bin/sh
args:
- -c
- "cp /vcluster /binaries/vcluster"
{{- if .Values.controlPlane.statefulSet.imagePullPolicy }}
imagePullPolicy: {{ .Values.controlPlane.statefulSet.imagePullPolicy }}
{{- end }}
securityContext:
{{ toYaml .Values.controlPlane.distro.k8s.securityContext | indent 4 }}
resources:
{{ toYaml .Values.controlPlane.distro.k8s.resources | indent 4 }}
{{- if .Values.controlPlane.distro.k8s.controllerManager.enabled }}
- name: kube-controller-manager
image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.k8s.controllerManager.image.registry "repository" .Values.controlPlane.distro.k8s.controllerManager.image.repository "tag" (include "vcluster.k8s.controllerManager.image.tag" .)) }}"
volumeMounts:
- mountPath: /binaries
name: binaries
command:
- /binaries/vcluster
args:
- cp
- /usr/local/bin/kube-controller-manager
- /binaries/kube-controller-manager
{{- if .Values.controlPlane.distro.k8s.controllerManager.imagePullPolicy }}
imagePullPolicy: {{ .Values.controlPlane.distro.k8s.controllerManager.imagePullPolicy }}
{{- end }}
securityContext:
{{ toYaml .Values.controlPlane.distro.k8s.securityContext | indent 4 }}
resources:
{{ toYaml .Values.controlPlane.distro.k8s.resources | indent 4 }}
{{- end }}
{{- if .Values.controlPlane.advanced.virtualScheduler.enabled }}
- name: kube-scheduler-manager
image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.k8s.scheduler.image.registry "repository" .Values.controlPlane.distro.k8s.scheduler.image.repository "tag" (include "vcluster.k8s.scheduler.image.tag" .)) }}"
volumeMounts:
- mountPath: /binaries
name: binaries
command:
- /binaries/vcluster
args:
- cp
- /usr/local/bin/kube-scheduler
- /binaries/kube-scheduler
{{- if .Values.controlPlane.distro.k8s.scheduler.imagePullPolicy }}
imagePullPolicy: {{ .Values.controlPlane.distro.k8s.scheduler.imagePullPolicy }}
{{- end }}
securityContext:
{{ toYaml .Values.controlPlane.distro.k8s.securityContext | indent 4 }}
resources:
{{ toYaml .Values.controlPlane.distro.k8s.resources | indent 4 }}
{{- end }}
{{- if .Values.controlPlane.distro.k8s.apiServer.enabled }}
- name: kube-apiserver
image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.k8s.apiServer.image.registry "repository" .Values.controlPlane.distro.k8s.apiServer.image.repository "tag" (include "vcluster.k8s.apiServer.image.tag" .)) }}"
volumeMounts:
- mountPath: /binaries
name: binaries
command:
- /binaries/vcluster
args:
- cp
- /usr/local/bin/kube-apiserver
- /binaries/kube-apiserver
{{- if .Values.controlPlane.distro.k8s.apiServer.imagePullPolicy }}
imagePullPolicy: {{ .Values.controlPlane.distro.k8s.apiServer.imagePullPolicy }}
{{- end }}
securityContext:
{{ toYaml .Values.controlPlane.distro.k8s.securityContext | indent 4 }}
resources:
{{ toYaml .Values.controlPlane.distro.k8s.resources | indent 4 }}
{{- end }}
{{- end -}}
{{- define "vcluster.k3s.initContainers" -}}
{{- include "vcluster.oldPlugins.initContainers" . }}
{{- include "vcluster.plugins.initContainers" . }}
- name: vcluster
image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.k3s.image.registry "repository" .Values.controlPlane.distro.k3s.image.repository "tag" .Values.controlPlane.distro.k3s.image.tag) }}"
command:
- /bin/sh
args:
- -c
- "cp /bin/k3s /binaries/k3s"
{{- if .Values.controlPlane.distro.k3s.imagePullPolicy }}
imagePullPolicy: {{ .Values.controlPlane.distro.k3s.imagePullPolicy }}
{{- end }}
securityContext:
{{ toYaml .Values.controlPlane.distro.k3s.securityContext | indent 4 }}
volumeMounts:
- name: binaries
mountPath: /binaries
resources:
{{ toYaml .Values.controlPlane.distro.k3s.resources | indent 4 }}
{{- end -}}
{{- define "vcluster.k0s.initContainers" -}}
{{- include "vcluster.oldPlugins.initContainers" . }}
{{- include "vcluster.plugins.initContainers" . }}
- name: vcluster
image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.k0s.image.registry "repository" .Values.controlPlane.distro.k0s.image.repository "tag" .Values.controlPlane.distro.k0s.image.tag) }}"
command:
- /bin/sh
args:
- -c
- "cp /usr/local/bin/k0s /binaries/k0s"
{{- if .Values.controlPlane.distro.k0s.imagePullPolicy }}
imagePullPolicy: {{ .Values.controlPlane.distro.k0s.imagePullPolicy }}
{{- end }}
securityContext:
{{ toYaml .Values.controlPlane.distro.k0s.securityContext | indent 4 }}
volumeMounts:
- name: binaries
mountPath: /binaries
resources:
{{ toYaml .Values.controlPlane.distro.k0s.resources | indent 4 }}
{{- end -}}
{{/*
Plugin init container definition
*/}}
{{- define "vcluster.plugins.initContainers" -}}
{{- range $key, $container := .Values.plugins }}
{{- if not $container.image }}
{{- continue }}
{{- end }}
- {{- if $.Values.controlPlane.advanced.defaultImageRegistry }}
image: {{ $.Values.controlPlane.advanced.defaultImageRegistry }}/{{ $container.image }}
{{- else }}
image: {{ $container.image }}
{{- end }}
{{- if $container.name }}
name: {{ $container.name | quote }}
{{- else }}
name: {{ $key | quote }}
{{- end }}
{{- if $container.imagePullPolicy }}
imagePullPolicy: {{ $container.imagePullPolicy }}
{{- end }}
{{- if or $container.command $container.args }}
{{- if $container.command }}
command:
{{- range $commandIndex, $command := $container.command }}
- {{ $command | quote }}
{{- end }}
{{- end }}
{{- if $container.args }}
args:
{{- range $argIndex, $arg := $container.args }}
- {{ $arg | quote }}
{{- end }}
{{- end }}
{{- else }}
command: ["sh"]
args: ["-c", "cp -r /plugin /plugins/{{ $key }}"]
{{- end }}
{{- if $container.securityContext }}
securityContext:
{{ toYaml $container.securityContext | indent 4 }}
{{- end }}
{{- if $container.volumeMounts }}
volumeMounts:
{{ toYaml $container.volumeMounts | indent 4 }}
{{- else }}
volumeMounts:
- mountPath: /plugins
name: plugins
{{- end }}
{{- if $container.resources }}
resources:
{{ toYaml $container.resources | indent 4 }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Old Plugin init container definition
*/}}
{{- define "vcluster.oldPlugins.initContainers" -}}
{{- range $key, $container := .Values.plugin }}
{{- if or (ne $container.version "v2") (not $container.image) -}}
{{- continue -}}
{{- end -}}
- {{- if $.Values.controlPlane.advanced.defaultImageRegistry }}
image: {{ $.Values.controlPlane.advanced.defaultImageRegistry }}/{{ $container.image }}
{{- else }}
image: {{ $container.image }}
{{- end }}
{{- if $container.name }}
name: {{ $container.name | quote }}
{{- else }}
name: {{ $key | quote }}
{{- end }}
{{- if $container.imagePullPolicy }}
imagePullPolicy: {{ $container.imagePullPolicy }}
{{- end }}
{{- if or $container.command $container.args }}
{{- if $container.command }}
command:
{{- range $commandIndex, $command := $container.command }}
- {{ $command | quote }}
{{- end }}
{{- end }}
{{- if $container.args }}
args:
{{- range $argIndex, $arg := $container.args }}
- {{ $arg | quote }}
{{- end }}
{{- end }}
{{- else }}
command: ["sh"]
args: ["-c", "cp -r /plugin /plugins/{{ $key }}"]
{{- end }}
securityContext:
{{ toYaml $container.securityContext | indent 4 }}
{{- if $container.volumeMounts }}
volumeMounts:
{{ toYaml $container.volumeMounts | indent 4 }}
{{- else }}
volumeMounts:
- mountPath: /plugins
name: plugins
{{- end }}
{{- if $container.resources }}
resources:
{{ toYaml $container.resources | indent 4 }}
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,41 @@
{{/*
ControlPlane Kind
*/}}
{{- define "vcluster.kind" -}}
{{ if or (include "vcluster.persistence.volumeClaim.enabled" .) .Values.controlPlane.backingStore.etcd.embedded.enabled }}StatefulSet{{ else }}Deployment{{ end }}
{{- end -}}
{{/*
StatefulSet Persistence Options
*/}}
{{- define "vcluster.persistence" -}}
{{- if .Values.controlPlane.statefulSet.persistence.volumeClaimTemplates }}
volumeClaimTemplates:
{{ toYaml .Values.controlPlane.statefulSet.persistence.volumeClaimTemplates | indent 2 }}
{{- else if include "vcluster.persistence.volumeClaim.enabled" . }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: {{ .Values.controlPlane.statefulSet.persistence.volumeClaim.accessModes }}
{{- if .Values.controlPlane.statefulSet.persistence.volumeClaim.storageClass }}
storageClassName: {{ .Values.controlPlane.statefulSet.persistence.volumeClaim.storageClass }}
{{- end }}
resources:
requests:
storage: {{ .Values.controlPlane.statefulSet.persistence.volumeClaim.size }}
{{- end }}
{{- end -}}
{{/*
is persistence enabled?
*/}}
{{- define "vcluster.persistence.volumeClaim.enabled" -}}
{{- if .Values.controlPlane.statefulSet.persistence.volumeClaimTemplates -}}
{{- true -}}
{{- else if eq (toString .Values.controlPlane.statefulSet.persistence.volumeClaim.enabled) "true" -}}
{{- true -}}
{{- else if and (eq (toString .Values.controlPlane.statefulSet.persistence.volumeClaim.enabled) "auto") (or (include "vcluster.database.embedded.enabled" .) .Values.controlPlane.backingStore.etcd.embedded.enabled) -}}
{{- true -}}
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,126 @@
{{/*
Plugin volume mount definition
*/}}
{{- define "vcluster.plugins.volumeMounts" -}}
{{- $pluginFound := false -}}
{{- range $key, $container := .Values.plugin }}
{{- if or (ne $container.version "v2") (not $container.image) }}
{{- continue }}
{{- end }}
{{ $pluginFound = true }}
- mountPath: /plugins
name: plugins
{{- break }}
{{- end }}
{{- if eq $pluginFound false }}
{{- range $key, $container := .Values.plugins }}
{{- if not $container.image }}
{{- continue }}
{{- end }}
- mountPath: /plugins
name: plugins
{{- break }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Plugin volume definition
*/}}
{{- define "vcluster.plugins.volumes" -}}
{{- $pluginFound := false -}}
{{- range $key, $container := .Values.plugin }}
{{- if or (ne $container.version "v2") (not $container.image) }}
{{- continue }}
{{- end }}
{{ $pluginFound = true }}
- name: plugins
emptyDir: {}
{{- break }}
{{- end }}
{{- if eq $pluginFound false }}
{{- range $key, $container := .Values.plugins }}
{{- if not $container.image }}
{{- continue }}
{{- end }}
- name: plugins
emptyDir: {}
{{- break }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Sidecar container definition for the legacy syncer parts
*/}}
{{- define "vcluster.legacyPlugins.containers" -}}
{{- $counter := -1 -}}
{{- range $key, $container := .Values.plugin }}
{{- if eq $container.version "v2" }}
{{ continue }}
{{- end }}
{{- $counter = add1 $counter }}
- {{- if $.Values.controlPlane.advanced.defaultImageRegistry }}
image: {{ $.Values.controlPlane.advanced.defaultImageRegistry }}/{{ $container.image }}
{{- else }}
image: {{ $container.image }}
{{- end }}
{{- if $container.name }}
name: {{ $container.name | quote }}
{{- else }}
name: {{ $key | quote }}
{{- end }}
{{- if $container.imagePullPolicy }}
imagePullPolicy: {{ $container.imagePullPolicy }}
{{- end }}
{{- if $container.workingDir }}
workingDir: {{ $container.workingDir }}
{{- end }}
{{- if $container.command }}
command:
{{- range $commandIndex, $command := $container.command }}
- {{ $command | quote }}
{{- end }}
{{- end }}
{{- if $container.args }}
args:
{{- range $argIndex, $arg := $container.args }}
- {{ $arg | quote }}
{{- end }}
{{- end }}
{{- if $container.terminationMessagePath }}
terminationMessagePath: {{ $container.terminationMessagePath }}
{{- end }}
{{- if $container.terminationMessagePolicy }}
terminationMessagePolicy: {{ $container.terminationMessagePolicy }}
{{- end }}
env:
- name: VCLUSTER_PLUGIN_ADDRESS
value: "localhost:{{ add 14000 $counter }}"
- name: VCLUSTER_PLUGIN_NAME
value: "{{ $key }}"
{{- if $container.env }}
{{ toYaml $container.env | indent 4 }}
{{- end }}
envFrom:
{{ toYaml $container.envFrom | indent 4 }}
securityContext:
{{ toYaml $container.securityContext | indent 4 }}
lifecycle:
{{ toYaml $container.lifecycle | indent 4 }}
livenessProbe:
{{ toYaml $container.livenessProbe | indent 4 }}
readinessProbe:
{{ toYaml $container.readinessProbe | indent 4 }}
startupProbe:
{{ toYaml $container.startupProbe | indent 4 }}
volumeDevices:
{{ toYaml $container.volumeDevices | indent 4 }}
volumeMounts:
{{ toYaml $container.volumeMounts | indent 4 }}
{{- if $container.resources }}
resources:
{{ toYaml $container.resources | indent 4 }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,214 @@
{{- define "vcluster.clusterRoleName" -}}
{{- printf "vc-%s-v-%s" .Release.Name .Release.Namespace | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "vcluster.clusterRoleNameMultinamespace" -}}
{{- printf "vc-mn-%s-v-%s" .Release.Name .Release.Namespace | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Whether to create a cluster role or not
*/}}
{{- define "vcluster.createClusterRole" -}}
{{- if eq (toString .Values.rbac.clusterRole.enabled) "true" -}}
{{- true -}}
{{- else if eq (toString .Values.rbac.clusterRole.enabled) "auto" -}}
{{- if or
.Values.rbac.clusterRole.overwriteRules
(not (empty (include "vcluster.rbac.clusterRoleExtraRules" . )))
(not (empty (include "vcluster.plugin.clusterRoleExtraRules" . )))
(not (empty (include "vcluster.generic.clusterRoleExtraRules" . )))
.Values.networking.replicateServices.fromHost
.Values.pro
.Values.sync.toHost.storageClasses.enabled
.Values.experimental.isolatedControlPlane.enabled
.Values.sync.toHost.persistentVolumes.enabled
.Values.sync.toHost.priorityClasses.enabled
.Values.sync.fromHost.priorityClasses.enabled
.Values.sync.toHost.volumeSnapshotContents.enabled
.Values.sync.fromHost.volumeSnapshotClasses.enabled
.Values.controlPlane.advanced.virtualScheduler.enabled
.Values.sync.fromHost.ingressClasses.enabled
.Values.sync.fromHost.runtimeClasses.enabled
(eq (toString .Values.sync.fromHost.storageClasses.enabled) "true")
(eq (toString .Values.sync.fromHost.csiNodes.enabled) "true")
(eq (toString .Values.sync.fromHost.csiDrivers.enabled) "true")
(eq (toString .Values.sync.fromHost.csiStorageCapacities.enabled) "true")
.Values.sync.fromHost.nodes.enabled
.Values.sync.toHost.customResources
.Values.sync.fromHost.customResources
.Values.integrations.kubeVirt.enabled
.Values.integrations.externalSecrets.enabled
(and .Values.integrations.metricsServer.enabled .Values.integrations.metricsServer.nodes)
.Values.experimental.multiNamespaceMode.enabled -}}
{{- true -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Role rules defined on global level
*/}}
{{- define "vcluster.rbac.roleExtraRules" -}}
{{- if .Values.rbac.role.extraRules }}
{{- range $ruleIndex, $rule := .Values.rbac.role.extraRules }}
- {{ toJson $rule }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Role rules defined by plugins
*/}}
{{- define "vcluster.plugin.roleExtraRules" -}}
{{- range $key, $container := .Values.plugin }}
{{- if $container.rbac }}
{{- if $container.rbac.role }}
{{- if $container.rbac.role.extraRules }}
{{- range $ruleIndex, $rule := $container.rbac.role.extraRules }}
- {{ toJson $rule }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- range $key, $container := .Values.plugins }}
{{- if $container.rbac }}
{{- if $container.rbac.role }}
{{- if $container.rbac.role.extraRules }}
{{- range $ruleIndex, $rule := $container.rbac.role.extraRules }}
- {{ toJson $rule }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Cluster role rules defined by plugins
*/}}
{{- define "vcluster.plugin.clusterRoleExtraRules" -}}
{{- range $key, $container := .Values.plugin }}
{{- if $container.rbac }}
{{- if $container.rbac.clusterRole }}
{{- if $container.rbac.clusterRole.extraRules }}
{{- range $ruleIndex, $rule := $container.rbac.clusterRole.extraRules }}
- {{ toJson $rule }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- range $key, $container := .Values.plugins }}
{{- if $container.rbac }}
{{- if $container.rbac.clusterRole }}
{{- if $container.rbac.clusterRole.extraRules }}
{{- range $ruleIndex, $rule := $container.rbac.clusterRole.extraRules }}
- {{ toJson $rule }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Role rules defined in generic syncer
*/}}
{{- define "vcluster.generic.roleExtraRules" -}}
{{- if .Values.experimental.genericSync.role }}
{{- if .Values.experimental.genericSync.role.extraRules }}
{{- range $ruleIndex, $rule := .Values.experimental.genericSync.role.extraRules }}
- {{ toJson $rule }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Role rules defined in generic syncer
*/}}
{{- define "vcluster.customResources.roleExtraRules" -}}
{{- if .Values.sync.toHost.customResources }}
{{- range $crdName, $rule := .Values.sync.toHost.customResources }}
{{- if $rule.enabled }}
- resources: [ "{{ (splitn "." 2 $crdName)._0 }}" ]
apiGroups: [ "{{ (splitn "." 2 $crdName)._1 }}" ]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Cluster role rules defined in generic syncer
*/}}
{{- define "vcluster.customResources.clusterRoleExtraRules" -}}
{{- if .Values.sync.fromHost.customResources }}
{{- range $crdName, $rule := .Values.sync.fromHost.customResources }}
{{- if $rule.enabled }}
- resources: [ "{{ (splitn "." 2 $crdName)._0 }}" ]
apiGroups: [ "{{ (splitn "." 2 $crdName)._1 }}" ]
verbs: ["get", "list", "watch"]
{{- end }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Cluster role rules defined in generic syncer
*/}}
{{- define "vcluster.generic.clusterRoleExtraRules" -}}
{{- if .Values.experimental.genericSync.clusterRole }}
{{- if .Values.experimental.genericSync.clusterRole.extraRules }}
{{- range $ruleIndex, $rule := .Values.experimental.genericSync.clusterRole.extraRules }}
- {{ toJson $rule }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Cluster Role rules defined on global level
*/}}
{{- define "vcluster.rbac.clusterRoleExtraRules" -}}
{{- if .Values.rbac.clusterRole.extraRules }}
{{- range $ruleIndex, $rule := .Values.rbac.clusterRole.extraRules }}
- {{ toJson $rule }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Whether to create a role and role binding to access the platform API key secret
*/}}
{{- define "vcluster.rbac.createPlatformSecretRole" -}}
{{- $createRBAC := dig "platform" "apiKey" "createRBAC" true .Values.external -}}
{{- if and $createRBAC (ne (include "vcluster.rbac.platformSecretNamespace" .) .Release.Namespace) }}
{{- true -}}
{{- end }}
{{- end -}}
{{/*
Namespace containing the vCluster platform secret
*/}}
{{- define "vcluster.rbac.platformSecretNamespace" -}}
{{- dig "platform" "apiKey" "namespace" .Release.Namespace .Values.external | default .Release.Namespace -}}
{{- end -}}
{{/*
Name specifies the secret name containing the vCluster platform licenses and tokens
*/}}
{{- define "vcluster.rbac.platformSecretName" -}}
{{- dig "platform" "apiKey" "secretName" "vcluster-platform-api-key" .Values.external | quote -}}
{{- end -}}
{{- define "vcluster.rbac.platformRoleName" -}}
{{- printf "vc-%s-v-%s-platform-role" .Release.Name .Release.Namespace | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "vcluster.rbac.platformRoleBindingName" -}}
{{- printf "vc-%s-v-%s-platform-role-binding" .Release.Name .Release.Namespace | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View File

@@ -0,0 +1,137 @@
{{- if (include "vcluster.createClusterRole" . ) -}}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "vcluster.clusterRoleName" . }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.advanced.globalMetadata.annotations }}
annotations:
{{ toYaml .Values.controlPlane.advanced.globalMetadata.annotations | indent 4 }}
{{- end }}
rules:
{{- if .Values.rbac.clusterRole.overwriteRules }}
{{ toYaml .Values.rbac.clusterRole.overwriteRules | indent 2 }}
{{- else }}
{{- if .Values.pro }}
- apiGroups: ["cluster.loft.sh", "storage.loft.sh"]
resources: ["features", "virtualclusters"]
verbs: ["get", "list", "watch"]
- apiGroups: ["management.loft.sh"]
resources: ["virtualclusterinstances"]
verbs: ["get"]
{{- end }}
{{- if or .Values.pro .Values.sync.fromHost.nodes.enabled }}
- apiGroups: [""]
resources: ["pods", "nodes", "nodes/status", "nodes/metrics", "nodes/stats", "nodes/proxy"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- if .Values.experimental.isolatedControlPlane.enabled }}
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- if and .Values.sync.fromHost.nodes.enabled .Values.sync.fromHost.nodes.syncBackChanges }}
- apiGroups: [""]
resources: ["nodes", "nodes/status"]
verbs: ["update", "patch"]
{{- end }}
{{- if .Values.controlPlane.advanced.virtualScheduler.enabled }}
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses", "csinodes", "csidrivers", "csistoragecapacities"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- if eq (toString .Values.sync.fromHost.storageClasses.enabled) "true" }}
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- if eq (toString .Values.sync.fromHost.csiNodes.enabled) "true" }}
- apiGroups: ["storage.k8s.io"]
resources: ["csinodes"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- if eq (toString .Values.sync.fromHost.csiDrivers.enabled) "true" }}
- apiGroups: ["storage.k8s.io"]
resources: ["csidrivers"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- if eq (toString .Values.sync.fromHost.csiStorageCapacities.enabled) "true" }}
- apiGroups: ["storage.k8s.io"]
resources: ["csistoragecapacities"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- if .Values.sync.toHost.persistentVolumes.enabled }}
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["create", "delete", "patch", "update", "get", "watch", "list"]
{{- end }}
{{- if .Values.sync.fromHost.ingressClasses.enabled }}
- apiGroups: ["networking.k8s.io"]
resources: ["ingressclasses"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- if .Values.sync.fromHost.runtimeClasses.enabled }}
- apiGroups: ["nodes.k8s.io"]
resources: ["runtimeclasses"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- if .Values.sync.toHost.storageClasses.enabled }}
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["create", "delete", "patch", "update", "get", "watch", "list"]
{{- end }}
{{- if or .Values.sync.toHost.priorityClasses.enabled .Values.sync.fromHost.priorityClasses.enabled }}
- apiGroups: ["scheduling.k8s.io"]
resources: ["priorityclasses"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- if .Values.sync.fromHost.volumeSnapshotClasses.enabled }}
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotclasses"]
verbs: ["get", "list", "watch"]
{{- end }}
{{- if .Values.sync.toHost.volumeSnapshotContents.enabled }}
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- if .Values.networking.replicateServices.fromHost }}
- apiGroups: [""]
resources: ["services", "endpoints"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- if .Values.experimental.multiNamespaceMode.enabled }}
- apiGroups: [""]
resources: ["namespaces", "serviceaccounts"]
verbs: ["create", "delete", "patch", "update", "get", "watch", "list"]
{{- end }}
{{- if (and .Values.integrations.metricsServer.enabled .Values.integrations.metricsServer.nodes) }}
- apiGroups: ["metrics.k8s.io"]
resources: ["nodes"]
verbs: ["get", "list"]
{{- end }}
{{- if or (and .Values.integrations.kubeVirt.enabled .Values.integrations.kubeVirt.webhook.enabled) (and .Values.integrations.externalSecrets.enabled .Values.integrations.externalSecrets.webhook.enabled ) }}
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["validatingwebhookconfigurations", "mutatingwebhookconfigurations"]
verbs: ["get", "list", "watch"]
{{- end }}
{{- if or .Values.integrations.kubeVirt.enabled .Values.integrations.externalSecrets.enabled .Values.sync.toHost.customResources .Values.sync.fromHost.customResources }}
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["get", "list", "watch"]
{{- end }}
{{- if and .Values.integrations.externalSecrets.enabled .Values.integrations.externalSecrets.sync.clusterStores.enabled }}
- apiGroups: ["external-secrets.io"]
resources: ["clustersecretstores"]
verbs: ["get", "list", "watch"]
{{- end }}
{{- include "vcluster.customResources.clusterRoleExtraRules" . | indent 2 }}
{{- include "vcluster.plugin.clusterRoleExtraRules" . | indent 2 }}
{{- include "vcluster.generic.clusterRoleExtraRules" . | indent 2 }}
{{- include "vcluster.rbac.clusterRoleExtraRules" . | indent 2 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,27 @@
{{- if (include "vcluster.createClusterRole" . ) -}}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "vcluster.clusterRoleName" . }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.advanced.globalMetadata.annotations }}
annotations:
{{ toYaml .Values.controlPlane.advanced.globalMetadata.annotations | indent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
{{- if .Values.controlPlane.advanced.serviceAccount.name }}
name: {{ .Values.controlPlane.advanced.serviceAccount.name }}
{{- else }}
name: vc-{{ .Release.Name }}
{{- end }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ template "vcluster.clusterRoleName" . }}
apiGroup: rbac.authorization.k8s.io
{{- end }}

View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: Secret
metadata:
name: "vc-config-{{ .Release.Name }}"
namespace: {{ .Release.Namespace }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.advanced.globalMetadata.annotations }}
annotations:
{{ toYaml .Values.controlPlane.advanced.globalMetadata.annotations | indent 4 }}
{{- end }}
type: Opaque
data:
config.yaml: {{ .Values | toYaml | b64enc | quote }}

View File

@@ -0,0 +1,288 @@
{{- if and .Values.controlPlane.coredns.enabled (not .Values.experimental.isolatedControlPlane.headless) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: vc-coredns-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
{{- if .Values.controlPlane.advanced.globalMetadata.annotations }}
annotations:
{{ toYaml .Values.controlPlane.advanced.globalMetadata.annotations | indent 4 }}
{{- end }}
data:
{{- if .Values.controlPlane.coredns.overwriteManifests }}
coredns.yaml: |-
{{ .Values.controlPlane.coredns.overwriteManifests | indent 4 }}
{{- else if .Values.controlPlane.coredns.embedded }}
{{ include "vcluster.corefile" . | indent 2 }}
coredns.yaml: |-
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
NodeHosts: ""
---
apiVersion: v1
kind: Service
metadata:
name: kube-dns
namespace: kube-system
annotations:
prometheus.io/port: "9153"
prometheus.io/scrape: "true"
{{- if .Values.controlPlane.coredns.service.annotations }}
{{ toYaml .Values.controlPlane.coredns.service.annotations | indent 8 }}
{{- end }}
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "CoreDNS"
{{- if .Values.controlPlane.coredns.service.labels }}
{{ toYaml .Values.controlPlane.coredns.service.labels | indent 8 }}
{{- end }}
spec:
{{ toYaml .Values.controlPlane.coredns.service.spec | indent 6 }}
{{- if not .Values.controlPlane.coredns.service.spec.ports }}
ports:
- name: dns
port: 53
targetPort: 1053
protocol: UDP
- name: dns-tcp
port: 53
targetPort: 1053
protocol: TCP
- name: metrics
port: 9153
protocol: TCP
{{- end }}
{{- else }}
coredns.yaml: |-
apiVersion: v1
kind: ServiceAccount
metadata:
name: coredns
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:coredns
rules:
- apiGroups:
- ""
resources:
- endpoints
- services
- pods
- namespaces
verbs:
- list
- watch
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:coredns
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:coredns
subjects:
- kind: ServiceAccount
name: coredns
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
{{ include "vcluster.corefile" . | indent 6 }}
NodeHosts: ""
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: coredns
namespace: kube-system
{{- if .Values.controlPlane.coredns.deployment.annotations }}
annotations:
{{ toYaml .Values.controlPlane.coredns.deployment.annotations | indent 8 }}
{{- end }}
labels:
k8s-app: kube-dns
kubernetes.io/name: "CoreDNS"
{{- if .Values.controlPlane.coredns.deployment.labels }}
{{ toYaml .Values.controlPlane.coredns.deployment.labels | indent 8 }}
{{- end }}
spec:
replicas: {{ .Values.controlPlane.coredns.deployment.replicas }}
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
selector:
matchLabels:
k8s-app: kube-dns
template:
metadata:
{{- if .Values.controlPlane.coredns.deployment.pods.annotations }}
annotations:
{{ toYaml .Values.controlPlane.coredns.deployment.pods.annotations | indent 12 }}
{{- end }}
labels:
k8s-app: kube-dns
{{- if .Values.controlPlane.coredns.deployment.pods.labels }}
{{ toYaml .Values.controlPlane.coredns.deployment.pods.labels | indent 12 }}
{{- end }}
spec:
priorityClassName: {{ .Values.controlPlane.coredns.priorityClassName | quote }}
serviceAccountName: coredns
nodeSelector:
kubernetes.io/os: linux
{{- if .Values.controlPlane.coredns.deployment.nodeSelector }}
{{ toYaml .Values.controlPlane.coredns.deployment.nodeSelector | indent 12 }}
{{- end }}
{{- if .Values.controlPlane.coredns.deployment.affinity }}
affinity:
{{ toYaml .Values.controlPlane.coredns.deployment.affinity | indent 12 }}
{{- end }}
{{- if .Values.controlPlane.coredns.deployment.tolerations }}
tolerations:
{{ toYaml .Values.controlPlane.coredns.deployment.tolerations | indent 12 }}
{{- end }}
{{- if .Values.controlPlane.coredns.deployment.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.controlPlane.coredns.deployment.topologySpreadConstraints | indent 12 }}
{{- end }}
{{- if .Values.policies.podSecurityStandard }}
securityContext:
seccompProfile:
type: RuntimeDefault
{{- end }}
containers:
- name: coredns
{{- if .Values.controlPlane.coredns.deployment.image }}
{{- if .Values.controlPlane.advanced.defaultImageRegistry }}
image: {{ .Values.controlPlane.advanced.defaultImageRegistry }}/{{ .Values.controlPlane.coredns.deployment.image }}
{{- else }}
image: {{ .Values.controlPlane.coredns.deployment.image }}
{{- end }}
{{- else }}
image: {{`{{.IMAGE}}`}}
{{- end }}
imagePullPolicy: IfNotPresent
{{- if .Values.controlPlane.coredns.deployment.resources }}
resources:
{{ toYaml .Values.controlPlane.coredns.deployment.resources | indent 16 }}
{{- end }}
args: [ "-conf", "/etc/coredns/Corefile" ]
volumeMounts:
- name: config-volume
mountPath: /etc/coredns
readOnly: true
- name: custom-config-volume
mountPath: /etc/coredns/custom
readOnly: true
securityContext:
runAsNonRoot: true
runAsUser: {{`{{.RUN_AS_USER}}`}}
runAsGroup: {{`{{.RUN_AS_GROUP}}`}}
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
- ALL
readOnlyRootFilesystem: true
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /ready
port: 8181
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 2
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
dnsPolicy: Default
volumes:
- name: config-volume
configMap:
name: coredns
items:
- key: Corefile
path: Corefile
- key: NodeHosts
path: NodeHosts
- name: custom-config-volume
configMap:
name: coredns-custom
optional: true
---
apiVersion: v1
kind: Service
metadata:
name: kube-dns
namespace: kube-system
annotations:
prometheus.io/port: "9153"
prometheus.io/scrape: "true"
{{- if .Values.controlPlane.coredns.service.annotations }}
{{ toYaml .Values.controlPlane.coredns.service.annotations | indent 8 }}
{{- end }}
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "CoreDNS"
{{- if .Values.controlPlane.coredns.service.labels }}
{{ toYaml .Values.controlPlane.coredns.service.labels | indent 8 }}
{{- end }}
spec:
{{ toYaml .Values.controlPlane.coredns.service.spec | indent 6 }}
{{- if not .Values.controlPlane.coredns.service.spec.selector }}
selector:
k8s-app: kube-dns
{{- end }}
{{- if not .Values.controlPlane.coredns.service.spec.ports }}
ports:
- name: dns
port: 53
targetPort: 1053
protocol: UDP
- name: dns-tcp
port: 53
targetPort: 1053
protocol: TCP
- name: metrics
port: 9153
protocol: TCP
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,36 @@
{{- if not .Values.experimental.isolatedControlPlane.headless }}
{{- if or .Values.controlPlane.backingStore.etcd.deploy.enabled (include "vcluster.etcd.embedded.migrate" .) }}
{{- if .Values.controlPlane.backingStore.etcd.deploy.headlessService.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-etcd-headless
namespace: {{ .Release.Namespace }}
labels:
app: vcluster-etcd
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- $annotations := merge dict .Values.controlPlane.advanced.globalMetadata.annotations .Values.controlPlane.backingStore.etcd.deploy.headlessService.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
publishNotReadyAddresses: true
ports:
- name: etcd
port: 2379
targetPort: 2379
protocol: TCP
- name: peer
port: 2380
targetPort: 2380
protocol: TCP
clusterIP: None
selector:
app: vcluster-etcd
release: "{{ .Release.Name }}"
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,35 @@
{{- if not .Values.experimental.isolatedControlPlane.headless }}
{{- if or .Values.controlPlane.backingStore.etcd.deploy.enabled (include "vcluster.etcd.embedded.migrate" .) }}
{{- if .Values.controlPlane.backingStore.etcd.deploy.service.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-etcd
namespace: {{ .Release.Namespace }}
labels:
app: vcluster-etcd
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- $annotations := merge dict .Values.controlPlane.advanced.globalMetadata.annotations .Values.controlPlane.backingStore.etcd.deploy.service.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
type: ClusterIP
ports:
- name: etcd
port: 2379
targetPort: 2379
protocol: TCP
- name: peer
port: 2380
targetPort: 2380
protocol: TCP
selector:
app: vcluster-etcd
release: {{ .Release.Name }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,213 @@
{{- if not .Values.experimental.isolatedControlPlane.headless }}
{{- if or .Values.controlPlane.backingStore.etcd.deploy.enabled (include "vcluster.etcd.embedded.migrate" .) }}
{{- if .Values.controlPlane.backingStore.etcd.deploy.statefulSet.enabled }}
{{- $externalEtcd := .Values.controlPlane.backingStore.etcd.deploy.statefulSet }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Release.Name }}-etcd
namespace: {{ .Release.Namespace }}
labels:
app: vcluster-etcd
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if $externalEtcd.labels }}
{{ toYaml $externalEtcd.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.advanced.globalMetadata.annotations $externalEtcd.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
replicas: {{ $externalEtcd.highAvailability.replicas }}
podManagementPolicy: {{ $externalEtcd.scheduling.podManagementPolicy }}
serviceName: {{ .Release.Name }}-etcd-headless
{{- if eq $externalEtcd.persistence.volumeClaim.retentionPolicy "Delete" }}
{{- if ge (int .Capabilities.KubeVersion.Minor) 27 }}
persistentVolumeClaimRetentionPolicy:
whenDeleted: {{ $externalEtcd.persistence.volumeClaim.retentionPolicy }}
{{- end }}
{{- end }}
selector:
matchLabels:
app: vcluster-etcd
release: {{ .Release.Name }}
{{- if $externalEtcd.persistence.volumeClaimTemplates }}
volumeClaimTemplates:
{{ toYaml $externalEtcd.persistence.volumeClaimTemplates | indent 4 }}
{{- else if $externalEtcd.persistence.volumeClaim.enabled }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: {{ $externalEtcd.persistence.volumeClaim.accessModes }}
{{- if $externalEtcd.persistence.volumeClaim.storageClass }}
storageClassName: {{ $externalEtcd.persistence.volumeClaim.storageClass }}
{{- end }}
resources:
requests:
storage: {{ $externalEtcd.persistence.volumeClaim.size }}
{{- end }}
template:
metadata:
{{- if $externalEtcd.pods.annotations }}
annotations:
{{ toYaml $externalEtcd.pods.annotations | indent 8 }}
{{- end }}
labels:
app: vcluster-etcd
release: {{ .Release.Name }}
{{- range $k, $v := $externalEtcd.pods.labels }}
{{ $k }}: {{ $v | quote }}
{{- end }}
spec:
terminationGracePeriodSeconds: 10
{{- if $externalEtcd.scheduling.affinity }}
affinity:
{{ toYaml $externalEtcd.scheduling.affinity | indent 8 }}
{{- else }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
# if possible avoid scheduling more than one pod on one node
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- vcluster-etcd
- key: release
operator: In
values:
- {{ .Release.Name }}
topologyKey: "kubernetes.io/hostname"
# if possible avoid scheduling pod onto node that is in the same zone as one or more vcluster pods are running
- weight: 50
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- vcluster-etcd
- key: release
operator: In
values:
- {{ .Release.Name }}
topologyKey: topology.kubernetes.io/zone
{{- end }}
{{- if $externalEtcd.scheduling.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml $externalEtcd.scheduling.topologySpreadConstraints | indent 8 }}
{{- end }}
nodeSelector:
{{ toYaml $externalEtcd.scheduling.nodeSelector | indent 8 }}
tolerations:
{{ toYaml $externalEtcd.scheduling.tolerations | indent 8 }}
automountServiceAccountToken: false
{{- if .Values.controlPlane.advanced.serviceAccount.name }}
serviceAccountName: {{ .Values.controlPlane.advanced.serviceAccount.name }}
{{- else }}
serviceAccountName: vc-{{ .Release.Name }}
{{- end }}
volumes:
- name: certs
secret:
secretName: {{ .Release.Name }}-certs
{{- if $externalEtcd.persistence.addVolumes }}
{{ toYaml $externalEtcd.persistence.addVolumes | indent 8 }}
{{- end }}
{{- if not $externalEtcd.persistence.volumeClaim.enabled }}
- name: data
emptyDir: {}
{{- end }}
{{- if $externalEtcd.scheduling.priorityClassName }}
priorityClassName: {{ $externalEtcd.scheduling.priorityClassName }}
{{- end }}
{{- if $externalEtcd.security.podSecurityContext }}
securityContext:
{{ toYaml $externalEtcd.security.podSecurityContext | indent 8 }}
{{- end }}
enableServiceLinks: {{ .Values.controlPlane.backingStore.etcd.deploy.statefulSet.enableServiceLinks }}
containers:
- name: etcd
image: '{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" $externalEtcd.image.registry "repository" $externalEtcd.image.repository "tag" $externalEtcd.image.tag) }}'
command:
- etcd
- '--cert-file=/run/config/pki/etcd-server.crt'
- '--client-cert-auth=true'
- '--data-dir=/var/lib/etcd'
- '--advertise-client-urls=https://$(NAME).{{ .Release.Name }}-etcd-headless.{{ .Release.Namespace }}:2379'
- '--initial-advertise-peer-urls=https://$(NAME).{{ .Release.Name }}-etcd-headless.{{ .Release.Namespace }}:2380'
{{- $releaseName := .Release.Name -}}
{{- $releaseNamespace := .Release.Namespace }}
- '--initial-cluster={{ range $index := untilStep 0 (int $externalEtcd.highAvailability.replicas) 1 }}{{ if (ne (int $index) 0) }},{{ end }}{{ $releaseName }}-etcd-{{ $index }}=https://{{ $releaseName }}-etcd-{{ $index }}.{{ $releaseName }}-etcd-headless.{{ $releaseNamespace }}:2380{{ end }}'
- '--initial-cluster-token={{ .Release.Name }}'
- '--initial-cluster-state=new'
- '--listen-client-urls=https://0.0.0.0:2379'
- '--listen-metrics-urls=http://0.0.0.0:2381'
- '--listen-peer-urls=https://0.0.0.0:2380'
- '--key-file=/run/config/pki/etcd-server.key'
- '--name=$(NAME)'
- '--peer-cert-file=/run/config/pki/etcd-peer.crt'
- '--peer-client-cert-auth=true'
- '--peer-key-file=/run/config/pki/etcd-peer.key'
- '--peer-trusted-ca-file=/run/config/pki/etcd-ca.crt'
- '--snapshot-count=10000'
- '--trusted-ca-file=/run/config/pki/etcd-ca.crt'
{{- range $f := $externalEtcd.extraArgs }}
- {{ $f | quote }}
{{- end }}
{{- if $externalEtcd.security.containerSecurityContext }}
securityContext:
{{ toYaml $externalEtcd.security.containerSecurityContext | indent 10 }}
{{- end }}
env:
- name: NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
{{- if $externalEtcd.env }}
{{ toYaml $externalEtcd.env | indent 10 }}
{{- end }}
volumeMounts:
- name: data
mountPath: /var/lib/etcd
- mountPath: /run/config/pki
name: certs
readOnly: true
{{- if $externalEtcd.persistence.addVolumeMounts }}
{{ toYaml $externalEtcd.persistence.addVolumeMounts | indent 10 }}
{{- end }}
resources:
{{ toYaml $externalEtcd.resources | indent 10 }}
livenessProbe:
httpGet:
path: /health
port: 2381
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 15
periodSeconds: 10
successThreshold: 1
failureThreshold: 8
startupProbe:
httpGet:
path: /health
port: 2381
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 15
periodSeconds: 10
successThreshold: 1
failureThreshold: 24
{{- if $externalEtcd.imagePullPolicy }}
imagePullPolicy: {{ $externalEtcd.imagePullPolicy }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,43 @@
{{- if not .Values.experimental.isolatedControlPlane.headless }}
{{- if eq (include "vcluster.kind" .) "StatefulSet" }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-headless
namespace: {{ .Release.Namespace }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.advanced.headlessService.labels }}
{{ toYaml .Values.controlPlane.advanced.headlessService.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.advanced.headlessService.annotations .Values.controlPlane.advanced.globalMetadata.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
publishNotReadyAddresses: true
ports:
- name: https
port: 443
targetPort: 8443
protocol: TCP
{{- if .Values.controlPlane.backingStore.etcd.embedded.enabled }}
- name: etcd
port: 2379
targetPort: 2379
protocol: TCP
- name: peer
port: 2380
targetPort: 2380
protocol: TCP
{{- end }}
clusterIP: None
selector:
app: vcluster
release: "{{ .Release.Name }}"
{{- end }}
{{- end }}

View File

@@ -0,0 +1,38 @@
{{- if .Values.controlPlane.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
{{- $annotations := merge dict .Values.controlPlane.ingress.annotations .Values.controlPlane.advanced.globalMetadata.annotations }}
{{- if $annotations }}
annotations:
{{- toYaml $annotations | nindent 4 }}
{{- end }}
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.ingress.labels }}
{{ toYaml .Values.controlPlane.ingress.labels | indent 4 }}
{{- end }}
spec:
ingressClassName: nginx
{{- if .Values.controlPlane.ingress.spec }}
{{ toYaml .Values.controlPlane.ingress.spec | indent 2 }}
{{- end }}
{{- if not .Values.controlPlane.ingress.spec.rules }}
rules:
- host: {{ .Values.controlPlane.ingress.host | quote }}
http:
paths:
- backend:
service:
name: {{ .Release.Name }}
port:
name: https
path: /
pathType: {{ .Values.controlPlane.ingress.pathType }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,49 @@
{{- if or (eq (toString .Values.policies.limitRange.enabled) "true") (eq (toString .Values.policies.resourceQuota.enabled) "true") }}
{{- if not (eq (toString .Values.policies.limitRange.enabled) "false") }}
apiVersion: v1
kind: LimitRange
metadata:
name: vc-{{ .Release.Name }}
{{- if .Values.experimental.syncSettings.targetNamespace }}
namespace: {{ .Values.experimental.syncSettings.targetNamespace }}
{{- else }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.policies.limitRange.labels }}
{{ toYaml .Values.policies.limitRange.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.advanced.globalMetadata.annotations .Values.policies.limitRange.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
limits:
- default:
{{- range $key, $val := .Values.policies.limitRange.default }}
{{ $key }}: {{ $val | quote }}
{{- end }}
defaultRequest:
{{- range $key, $val := .Values.policies.limitRange.defaultRequest }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- if .Values.policies.limitRange.min }}
min:
{{- range $key, $val := .Values.policies.limitRange.min }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
{{- if .Values.policies.limitRange.max }}
max:
{{- range $key, $val := .Values.policies.limitRange.max }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
type: Container
{{- end }}
{{- end }}

View File

@@ -0,0 +1,7 @@
{{- if .Values.experimental.deploy.host.manifests }}
{{ .Values.experimental.deploy.host.manifests }}
{{- end }}
{{- if .Values.experimental.deploy.host.manifestsTemplate }}
---
{{ tpl .Values.experimental.deploy.host.manifestsTemplate . }}
{{- end }}

View File

@@ -0,0 +1,106 @@
{{- if .Values.policies.networkPolicy.enabled }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: vc-work-{{ .Release.Name }}
{{- if .Values.experimental.syncSettings.targetNamespace }}
namespace: {{ .Values.experimental.syncSettings.targetNamespace }}
{{- else }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.policies.networkPolicy.labels }}
{{ toYaml .Values.policies.networkPolicy.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.advanced.globalMetadata.annotations .Values.policies.networkPolicy.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
podSelector:
matchLabels:
vcluster.loft.sh/managed-by: {{ .Release.Name }}
egress:
# Allows outgoing connections to the vcluster control plane
- ports:
- port: 443
- port: 8443
to:
- podSelector:
matchLabels:
release: {{ .Release.Name }}
# Allows outgoing connections to DNS server
- ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
# Allows outgoing connections to the internet or
# other vcluster workloads
- to:
- podSelector:
matchLabels:
vcluster.loft.sh/managed-by: {{ .Release.Name }}
- ipBlock:
cidr: {{ .Values.policies.networkPolicy.outgoingConnections.ipBlock.cidr }}
except:
{{- range .Values.policies.networkPolicy.outgoingConnections.ipBlock.except }}
- {{ . }}
{{- end }}
policyTypes:
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: vc-cp-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.policies.networkPolicy.labels }}
{{ toYaml .Values.policies.networkPolicy.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.advanced.globalMetadata.annotations .Values.policies.networkPolicy.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
podSelector:
matchLabels:
release: {{ .Release.Name }}
egress:
# Allows outgoing connections to all pods with
# port 443, 8443 or 6443. This is needed for host Kubernetes
# access
- ports:
- port: 443
- port: 8443
- port: 6443
# Allows outgoing connections to all vcluster workloads
# or kube system dns server
- to:
- podSelector: {}
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: 'kube-system'
podSelector:
matchLabels:
k8s-app: kube-dns
{{- if .Values.policies.networkPolicy.outgoingConnections.platform }}
- podSelector:
matchLabels:
app: loft
namespaceSelector: {}
{{- end }}
policyTypes:
- Egress
{{- end }}

View File

@@ -0,0 +1,31 @@
{{- if include "vcluster.rbac.createPlatformSecretRole" . }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "vcluster.rbac.platformRoleName" . }}
namespace: {{ include "vcluster.rbac.platformSecretNamespace" .}}
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]
resourceNames:
- {{ include "vcluster.rbac.platformSecretName" . }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "vcluster.rbac.platformRoleBindingName" . }}
namespace: {{ include "vcluster.rbac.platformSecretNamespace" .}}
subjects:
- kind: ServiceAccount
{{- if .Values.controlPlane.advanced.serviceAccount.name }}
name: {{ .Values.controlPlane.advanced.serviceAccount.name }}
{{- else }}
name: vc-{{ .Release.Name }}
{{- end }}
namespace: {{ include "vcluster.rbac.platformSecretNamespace" .}}
roleRef:
kind: Role
name: {{ include "vcluster.rbac.platformRoleName" . }}
apiGroup: rbac.authorization.k8s.io
{{- end }}

View File

@@ -0,0 +1,44 @@
{{- if or (eq (toString .Values.policies.resourceQuota.enabled) "true") (eq (toString .Values.policies.limitRange.enabled) "true") }}
{{- if not (eq (toString .Values.policies.resourceQuota.enabled) "false") }}
apiVersion: v1
kind: ResourceQuota
metadata:
name: vc-{{ .Release.Name }}
{{- if .Values.experimental.syncSettings.targetNamespace }}
namespace: {{ .Values.experimental.syncSettings.targetNamespace }}
{{- else }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.policies.resourceQuota.labels }}
{{ toYaml .Values.policies.resourceQuota.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.advanced.globalMetadata.annotations .Values.policies.resourceQuota.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
{{- if .Values.policies.resourceQuota.quota }}
hard:
{{- range $key, $val := .Values.policies.resourceQuota.quota }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
{{- if .Values.policies.resourceQuota.scopeSelector.matchExpressions }}
scopeSelector:
matchExpressions:
{{- toYaml .Values.policies.resourceQuota.scopeSelector.matchExpressions | nindent 6 }}
{{- end }}
{{- if .Values.policies.resourceQuota.scopes }}
scopes:
{{- toYaml .Values.policies.resourceQuota.scopes | nindent 4 }}
{{- end}}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,114 @@
{{- if .Values.rbac.role.enabled }}
{{- if .Values.experimental.multiNamespaceMode.enabled }}
kind: ClusterRole
{{- else -}}
kind: Role
{{- end }}
apiVersion: rbac.authorization.k8s.io/v1
metadata:
{{- if .Values.experimental.multiNamespaceMode.enabled }}
name: {{ template "vcluster.clusterRoleNameMultinamespace" . }}
{{- else }}
name: vc-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.advanced.globalMetadata.annotations }}
annotations:
{{ toYaml .Values.controlPlane.advanced.globalMetadata.annotations | indent 4 }}
{{- end }}
rules:
{{- if .Values.rbac.role.overwriteRules }}
{{ toYaml .Values.rbac.role.overwriteRules | indent 2 }}
{{- else }}
- apiGroups: [""]
resources: ["configmaps", "secrets", "services", "pods", "pods/attach", "pods/portforward", "pods/exec", "persistentvolumeclaims"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
- apiGroups: [""]
resources: ["pods/status", "pods/ephemeralcontainers"]
verbs: ["patch", "update"]
- apiGroups: ["apps"]
resources: ["statefulsets", "replicasets", "deployments"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["endpoints", "events", "pods/log"]
verbs: ["get", "list", "watch"]
{{- if or .Values.sync.toHost.endpoints.enabled .Values.experimental.isolatedControlPlane.headless }}
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["create", "delete", "patch", "update"]
{{- end }}
{{- if gt (int .Values.controlPlane.statefulSet.highAvailability.replicas) 1 }}
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- if (and .Values.integrations.metricsServer.enabled .Values.integrations.metricsServer.pods) }}
- apiGroups: ["metrics.k8s.io"]
resources: ["pods"]
verbs: ["get", "list"]
{{- end }}
{{- if .Values.sync.toHost.ingresses.enabled}}
- apiGroups: ["networking.k8s.io"]
resources: ["ingresses"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- if .Values.sync.toHost.networkPolicies.enabled }}
- apiGroups: ["networking.k8s.io"]
resources: ["networkpolicies"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- if .Values.sync.toHost.volumeSnapshots.enabled }}
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- if .Values.sync.toHost.serviceAccounts.enabled }}
- apiGroups: [""]
resources: ["serviceaccounts"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- if .Values.sync.toHost.podDisruptionBudgets.enabled }}
- apiGroups: ["policy"]
resources: ["poddisruptionbudgets"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- if .Values.integrations.kubeVirt.enabled }}
- apiGroups: ["subresources.kubevirt.io"]
resources: ["*"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
- apiGroups: ["pool.kubevirt.io"]
resources: ["virtualmachinepools", "virtualmachinepools/status"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
- apiGroups: ["clone.kubevirt.io"]
resources: ["virtualmachineclones", "virtualmachineclones/status"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
- apiGroups: ["cdi.kubevirt.io"]
resources: ["datavolumes", "datavolumes/status"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
- apiGroups: ["kubevirt.io"]
resources: ["virtualmachines", "virtualmachines/status", "virtualmachineinstances", "virtualmachineinstances/status", "virtualmachineinstancemigrations", "virtualmachineinstancemigrations/status"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- if .Values.integrations.externalSecrets.enabled }}
{{- if .Values.integrations.externalSecrets.sync.externalSecrets.enabled }}
- apiGroups: ["external-secrets.io"]
resources: ["externalsecrets"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- if .Values.integrations.externalSecrets.sync.stores.enabled }}
- apiGroups: ["external-secrets.io"]
resources: ["secretstores"]
verbs: ["create", "delete", "patch", "update", "get", "list", "watch"]
{{- end }}
{{- end }}
{{- include "vcluster.customResources.roleExtraRules" . | indent 2 }}
{{- include "vcluster.plugin.roleExtraRules" . | indent 2 }}
{{- include "vcluster.generic.roleExtraRules" . | indent 2 }}
{{- include "vcluster.rbac.roleExtraRules" . | indent 2 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,41 @@
{{- if .Values.rbac.role.enabled }}
{{- if .Values.experimental.multiNamespaceMode.enabled }}
kind: ClusterRoleBinding
{{- else -}}
kind: RoleBinding
{{- end }}
apiVersion: rbac.authorization.k8s.io/v1
metadata:
{{- if .Values.experimental.multiNamespaceMode.enabled }}
name: {{ template "vcluster.clusterRoleNameMultinamespace" . }}
{{- else }}
name: vc-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.advanced.globalMetadata.annotations }}
annotations:
{{ toYaml .Values.controlPlane.advanced.globalMetadata.annotations | indent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
{{- if .Values.controlPlane.advanced.serviceAccount.name }}
name: {{ .Values.controlPlane.advanced.serviceAccount.name }}
{{- else }}
name: vc-{{ .Release.Name }}
{{- end }}
namespace: {{ .Release.Namespace }}
roleRef:
{{- if .Values.experimental.multiNamespaceMode.enabled }}
kind: ClusterRole
name: {{ template "vcluster.clusterRoleNameMultinamespace" . }}
{{- else }}
kind: Role
name: vc-{{ .Release.Name }}
{{- end }}
apiGroup: rbac.authorization.k8s.io
{{- end }}

View File

@@ -0,0 +1,44 @@
{{- if .Values.controlPlane.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: vc-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.serviceMonitor.labels }}
{{ toYaml .Values.controlPlane.serviceMonitor.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.serviceMonitor.annotations .Values.controlPlane.advanced.globalMetadata.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app: vcluster
release: "{{ .Release.Name }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: "{{ .Release.Service }}"
endpoints:
- interval: 30s
port: https
path: /metrics
scheme: https
tlsConfig:
ca:
secret:
name: vc-{{ .Release.Name }}
key: certificate-authority
cert:
secret:
name: vc-{{ .Release.Name }}
key: client-certificate
keySecret:
name: vc-{{ .Release.Name }}
key: client-key
{{- end }}

View File

@@ -0,0 +1,46 @@
{{- if .Values.controlPlane.service.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.service.labels }}
{{ toYaml .Values.controlPlane.service.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.advanced.globalMetadata.annotations .Values.controlPlane.service.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
{{ toYaml .Values.controlPlane.service.spec | indent 2 }}
{{- if not .Values.controlPlane.service.spec.ports }}
ports:
- name: https
port: 443
{{- if not .Values.experimental.isolatedControlPlane.headless }}
targetPort: 8443
{{- end }}
nodePort: {{ .Values.controlPlane.service.httpsNodePort }}
protocol: TCP
{{- if and .Values.networking.advanced.proxyKubelets.byHostname (not (eq .Values.controlPlane.service.spec.type "LoadBalancer")) }}
- name: kubelet
port: 10250
{{- if not .Values.experimental.isolatedControlPlane.headless }}
targetPort: 8443
{{- end }}
nodePort: {{ .Values.controlPlane.service.kubeletNodePort }}
protocol: TCP
{{- end }}
{{- end }}
{{- if and (not .Values.controlPlane.service.spec.selector) (not .Values.experimental.isolatedControlPlane.headless) }}
selector:
app: vcluster
release: {{ .Release.Name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,28 @@
{{- if .Values.controlPlane.advanced.serviceAccount.enabled }}
apiVersion: v1
kind: ServiceAccount
metadata:
{{- if .Values.controlPlane.advanced.serviceAccount.name }}
name: {{ .Values.controlPlane.advanced.serviceAccount.name | quote }}
{{- else }}
name: vc-{{ .Release.Name }}
{{- end }}
namespace: {{ .Release.Namespace }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.advanced.serviceAccount.labels }}
{{ toYaml .Values.controlPlane.advanced.serviceAccount.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.advanced.serviceAccount.annotations .Values.controlPlane.advanced.globalMetadata.annotations }}
{{- if $annotations }}
annotations:
{{- toYaml $annotations | nindent 4 }}
{{- end }}
{{- if .Values.controlPlane.advanced.serviceAccount.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.controlPlane.advanced.serviceAccount.imagePullSecrets | indent 2 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,240 @@
{{- if not .Values.experimental.isolatedControlPlane.headless }}
apiVersion: apps/v1
kind: {{ include "vcluster.kind" . }}
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name }}
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.statefulSet.labels }}
{{ toYaml .Values.controlPlane.statefulSet.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.statefulSet.annotations .Values.controlPlane.advanced.globalMetadata.annotations }}
{{- if $annotations }}
annotations:
{{ toYaml $annotations | indent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app: vcluster
release: {{ .Release.Name | quote }}
{{- if eq (include "vcluster.kind" .) "StatefulSet" }}
{{- if ge (int .Capabilities.KubeVersion.Minor) 27 }}
persistentVolumeClaimRetentionPolicy:
whenDeleted: {{ .Values.controlPlane.statefulSet.persistence.volumeClaim.retentionPolicy }}
{{- end }}
serviceName: {{ .Release.Name }}-headless
podManagementPolicy: {{ .Values.controlPlane.statefulSet.scheduling.podManagementPolicy }}
{{ include "vcluster.persistence" . | indent 2 }}
{{- else }}
strategy:
rollingUpdate:
maxSurge: 1
{{- if (eq (int .Values.controlPlane.statefulSet.highAvailability.replicas) 1) }}
maxUnavailable: 0
{{- else }}
maxUnavailable: 1
{{- end }}
type: RollingUpdate
{{- end }}
replicas: {{ .Values.controlPlane.statefulSet.highAvailability.replicas }}
template:
metadata:
annotations:
vClusterConfigHash: {{ .Values | toYaml | b64enc | sha256sum | quote }}
{{- if .Values.controlPlane.statefulSet.pods.annotations }}
{{ toYaml .Values.controlPlane.statefulSet.pods.annotations | indent 8 }}
{{- end }}
labels:
app: vcluster
release: {{ .Release.Name }}
{{- if .Values.controlPlane.statefulSet.pods.labels }}
{{ toYaml .Values.controlPlane.statefulSet.pods.labels | indent 8 }}
{{- end }}
spec:
terminationGracePeriodSeconds: 10
{{- if .Values.controlPlane.statefulSet.scheduling.priorityClassName }}
priorityClassName: {{ .Values.controlPlane.statefulSet.scheduling.priorityClassName }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.security.podSecurityContext }}
securityContext:
{{ toYaml .Values.controlPlane.statefulSet.security.podSecurityContext | indent 8 }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.scheduling.nodeSelector }}
nodeSelector:
{{ toYaml .Values.controlPlane.statefulSet.scheduling.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.scheduling.affinity }}
affinity:
{{ toYaml .Values.controlPlane.statefulSet.scheduling.affinity | indent 8 }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.scheduling.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.controlPlane.statefulSet.scheduling.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.scheduling.tolerations }}
tolerations:
{{ toYaml .Values.controlPlane.statefulSet.scheduling.tolerations | indent 8 }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.scheduling.priorityClassName }}
priorityClassName: {{ .Values.controlPlane.statefulSet.scheduling.priorityClassName }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.dnsPolicy }}
dnsPolicy: {{ .Values.controlPlane.statefulSet.dnsPolicy }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.dnsConfig }}
dnsConfig:
{{ toYaml .Values.controlPlane.statefulSet.dnsConfig | indent 8 }}
{{- end }}
{{- if .Values.controlPlane.advanced.serviceAccount.name }}
serviceAccountName: {{ .Values.controlPlane.advanced.serviceAccount.name }}
{{- else }}
serviceAccountName: vc-{{ .Release.Name }}
{{- end }}
volumes:
{{- include "vcluster.plugins.volumes" . | indent 8 }}
- name: helm-cache
emptyDir: {}
{{ toYaml .Values.controlPlane.statefulSet.persistence.binariesVolume | indent 8 }}
- name: tmp
emptyDir: {}
- name: certs
emptyDir: {}
{{- if eq (include "vcluster.distro" .) "k0s" }}
- name: run-k0s
emptyDir: {}
{{- end }}
{{- if eq (include "vcluster.distro" .) "k3s" }}
- name: k3s-config
emptyDir: {}
{{- end }}
- name: vcluster-config
secret:
secretName: vc-config-{{ .Release.Name }}
{{- if .Values.controlPlane.coredns.enabled }}
- name: coredns
configMap:
name: vc-coredns-{{ .Release.Name }}
# - name: custom-config-volume
# configMap:
# name: coredns-custom
# optional: true
{{- end }}
{{- if .Values.controlPlane.statefulSet.persistence.dataVolume }}
{{ toYaml .Values.controlPlane.statefulSet.persistence.dataVolume | indent 8 }}
{{- else if not (include "vcluster.persistence.volumeClaim.enabled" .) }}
- name: data
emptyDir: {}
{{- end }}
{{- if .Values.controlPlane.statefulSet.persistence.addVolumes }}
{{ toYaml .Values.controlPlane.statefulSet.persistence.addVolumes | indent 8 }}
{{- end }}
{{- if (not .Values.experimental.syncSettings.disableSync) }}
initContainers:
{{ include "vcluster.initContainers" . | indent 8 }}
{{- end }}
enableServiceLinks: {{ .Values.controlPlane.statefulSet.enableServiceLinks }}
containers:
- name: syncer
image: {{ include "vcluster.controlPlane.image" . | quote }}
imagePullPolicy: {{ .Values.controlPlane.statefulSet.imagePullPolicy }}
{{- if .Values.controlPlane.statefulSet.workingDir }}
workingDir: {{ .Values.controlPlane.statefulSet.workingDir }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.command }}
command:
{{ toYaml .Values.controlPlane.statefulSet.command | indent 12 }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.args }}
args:
{{ toYaml .Values.controlPlane.statefulSet.args | indent 12 }}
{{- end }}
{{- if .Values.controlPlane.statefulSet.probes.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: 8443
scheme: HTTPS
failureThreshold: 60
initialDelaySeconds: 60
periodSeconds: 2
{{- end }}
{{- if .Values.controlPlane.statefulSet.probes.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /readyz
port: 8443
scheme: HTTPS
failureThreshold: 60
periodSeconds: 2
{{- end }}
{{- if .Values.controlPlane.statefulSet.probes.startupProbe.enabled }}
startupProbe:
httpGet:
path: /readyz
port: 8443
scheme: HTTPS
failureThreshold: 300
periodSeconds: 6
{{- end }}
{{- if .Values.controlPlane.statefulSet.security.containerSecurityContext }}
securityContext:
{{ toYaml .Values.controlPlane.statefulSet.security.containerSecurityContext | indent 12 }}
{{- end }}
resources:
{{ toYaml .Values.controlPlane.statefulSet.resources | indent 12 }}
env:
- name: VCLUSTER_NAME
value: "{{ .Release.Name }}"
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- if .Values.controlPlane.statefulSet.env }}
{{ toYaml .Values.controlPlane.statefulSet.env | indent 12 }}
{{- end }}
{{ include "vcluster.distro.env" . | indent 12 }}
volumeMounts:
{{- include "vcluster.plugins.volumeMounts" . | indent 12 }}
- name: data
mountPath: /data
- name: binaries
mountPath: /binaries
- name: certs
mountPath: /pki
- name: helm-cache
mountPath: /.cache/helm
{{- if eq (include "vcluster.distro" .) "k0s" }}
- name: run-k0s
mountPath: /run/k0s
{{- end }}
{{- if eq (include "vcluster.distro" .) "k3s" }}
- name: k3s-config
mountPath: /etc/rancher
{{- end }}
- name: vcluster-config
mountPath: /var/vcluster
- name: tmp
mountPath: /tmp
{{- if .Values.controlPlane.coredns.enabled }}
- name: coredns
mountPath: /manifests/coredns
readOnly: true
{{- end }}
{{- if .Values.controlPlane.statefulSet.persistence.addVolumeMounts }}
{{ toYaml .Values.controlPlane.statefulSet.persistence.addVolumeMounts | indent 12 }}
{{- end }}
{{- include "vcluster.legacyPlugins.containers" . | indent 8 }}
{{- end }}

View File

@@ -0,0 +1,29 @@
{{- if .Values.controlPlane.advanced.workloadServiceAccount.enabled }}
apiVersion: v1
kind: ServiceAccount
metadata:
{{- if .Values.controlPlane.advanced.workloadServiceAccount.name }}
name: {{ .Values.controlPlane.advanced.workloadServiceAccount.name | quote }}
{{- else }}
name: vc-workload-{{ .Release.Name }}
{{- end }}
namespace: {{ .Release.Namespace }}
labels:
app: vcluster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.controlPlane.advanced.workloadServiceAccount.labels }}
{{ toYaml .Values.controlPlane.advanced.workloadServiceAccount.labels | indent 4 }}
{{- end }}
{{- $annotations := merge dict .Values.controlPlane.advanced.workloadServiceAccount.annotations .Values.controlPlane.advanced.globalMetadata.annotations }}
{{- if $annotations }}
annotations:
{{- toYaml $annotations | nindent 4 }}
{{- end }}
{{- $pullSecrets := concat .Values.controlPlane.advanced.serviceAccount.imagePullSecrets .Values.controlPlane.advanced.workloadServiceAccount.imagePullSecrets }}
{{- if $pullSecrets }}
imagePullSecrets:
{{ toYaml $pullSecrets | indent 2 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,14 @@
Add [unittest plugin](https://github.com/helm-unittest/helm-unittest) via:
```
helm plugin install https://github.com/helm-unittest/helm-unittest.git
```
Run tests via:
```
helm unittest chart
```
To update the `values.schema.json` run:
```
go run hack/schema/main.go
```

View File

@@ -0,0 +1,428 @@
suite: ClusterRoleBinding
templates:
- clusterrole.yaml
tests:
- it: disable by default
asserts:
- hasDocuments:
count: 0
- it: force enable
set:
rbac:
clusterRole:
enabled: true
asserts:
- hasDocuments:
count: 1
- it: force disable
set:
rbac:
clusterRole:
enabled: false
extraRules:
- apiGroups: [""]
resources: ["test123"]
verbs: ["test123"]
overwriteRules:
- apiGroups: [""]
resources: ["test"]
verbs: ["test"]
asserts:
- hasDocuments:
count: 0
- it: enable isolated control plane
set:
experimental:
isolatedControlPlane:
enabled: true
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 1
- contains:
path: rules
content:
apiGroups: [ "" ]
resources: [ "nodes" ]
verbs: [ "get", "watch", "list" ]
- it: enable scheduler
set:
controlPlane:
advanced:
virtualScheduler:
enabled: true
asserts:
- hasDocuments:
count: 1
- contains:
path: rules
content:
apiGroups: [ "storage.k8s.io" ]
resources: [ "storageclasses", "csinodes", "csidrivers", "csistoragecapacities" ]
verbs: [ "get", "watch", "list" ]
- it: enable csinodes
set:
sync:
fromHost:
csiNodes:
enabled: true
asserts:
- hasDocuments:
count: 1
- contains:
path: rules
content:
apiGroups: [ "storage.k8s.io" ]
resources: [ "csinodes" ]
verbs: [ "get", "watch", "list" ]
- it: enable by multi namespace mode
set:
rbac:
clusterRole:
enabled: auto
experimental:
multiNamespaceMode:
enabled: true
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 1
- contains:
path: rules
content:
apiGroups: [ "" ]
resources: [ "namespaces", "serviceaccounts" ]
verbs: [ "create", "delete", "patch", "update", "get", "watch", "list" ]
- it: override rules
set:
rbac:
clusterRole:
extraRules:
- apiGroups: [""]
resources: ["test123"]
verbs: ["test123"]
overwriteRules:
- apiGroups: [""]
resources: ["test"]
verbs: ["test"]
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 1
- contains:
path: rules
content:
apiGroups: [ "" ]
resources: [ "test" ]
verbs: [ "test" ]
- it: extra rules
set:
sync:
toHost:
priorityClasses:
enabled: true
rbac:
clusterRole:
extraRules:
- apiGroups: [ "" ]
resources: [ "test123" ]
verbs: [ "test123" ]
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 2
- contains:
path: rules
content:
apiGroups: [ "" ]
resources: [ "test123" ]
verbs: [ "test123" ]
- it: plugin rules
set:
plugin:
myTest:
rbac:
clusterRole:
extraRules:
- apiGroups: [ "" ]
resources: [ "test123" ]
verbs: [ "test123" ]
plugins:
myTest2:
rbac:
clusterRole:
extraRules:
- apiGroups: [ "" ]
resources: [ "test1234" ]
verbs: [ "test1234" ]
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 2
- contains:
path: rules
content:
apiGroups: [ "" ]
resources: [ "test123" ]
verbs: [ "test123" ]
- contains:
path: rules
content:
apiGroups: [ "" ]
resources: [ "test1234" ]
verbs: [ "test1234" ]
- it: replicate services
set:
networking:
replicateServices:
fromHost:
- from: test
to: other-test
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 1
- contains:
path: rules
content:
apiGroups: [ "" ]
resources: [ "services", "endpoints" ]
verbs: [ "get", "watch", "list" ]
- it: real nodes
set:
sync:
fromHost:
nodes:
enabled: true
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 1
- contains:
path: rules
content:
apiGroups: [ "" ]
resources: [ "pods", "nodes", "nodes/status", "nodes/metrics", "nodes/stats", "nodes/proxy" ]
verbs: [ "get", "watch", "list" ]
- it: virtual scheduler
set:
controlPlane:
advanced:
virtualScheduler:
enabled: true
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 1
- contains:
path: rules
content:
apiGroups: ["storage.k8s.io"]
resources: ["storageclasses", "csinodes", "csidrivers", "csistoragecapacities"]
verbs: ["get", "watch", "list"]
- it: legacy pro
set:
pro: true
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 3
- contains:
path: rules
content:
apiGroups: [ "" ]
resources: [ "pods", "nodes", "nodes/status", "nodes/metrics", "nodes/stats", "nodes/proxy" ]
verbs: [ "get", "watch", "list" ]
- contains:
path: rules
content:
apiGroups: [ "cluster.loft.sh", "storage.loft.sh" ]
resources: [ "features", "virtualclusters" ]
verbs: [ "get", "list", "watch" ]
- contains:
path: rules
content:
apiGroups: ["management.loft.sh"]
resources: ["virtualclusterinstances"]
verbs: ["get"]
- it: metrics proxy
set:
integrations:
metricsServer:
enabled: true
nodes: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- contains:
path: rules
content:
apiGroups: [ "metrics.k8s.io" ]
resources: [ "nodes" ]
verbs: [ "get", "list" ]
- it: externalSecrets
set:
integrations:
externalSecrets:
enabled: true
webhook:
enabled: false
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 1
- contains:
path: rules
content:
apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["get", "list", "watch"]
- it: kubeVirt
set:
integrations:
kubeVirt:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 2
- contains:
path: rules
content:
apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["get", "list", "watch"]
- contains:
path: rules
content:
apiGroups: ["admissionregistration.k8s.io"]
resources: ["validatingwebhookconfigurations", "mutatingwebhookconfigurations"]
verbs: ["get", "list", "watch"]
- it: crd sync to host
set:
sync:
toHost:
customResources:
test.test-group:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 1
- contains:
path: rules
content:
apiGroups: [ "apiextensions.k8s.io" ]
resources: [ "customresourcedefinitions" ]
verbs: [ "get", "list", "watch" ]
- it: crd sync from host
set:
sync:
fromHost:
customResources:
test.test-group:
enabled: true
scope: Cluster
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 2
- contains:
path: rules
content:
apiGroups: [ "test-group" ]
resources: [ "test" ]
verbs: [ "get", "list", "watch" ]
- contains:
path: rules
content:
apiGroups: [ "apiextensions.k8s.io" ]
resources: [ "customresourcedefinitions" ]
verbs: [ "get", "list", "watch" ]
- it: eso clusterstore sync
set:
integrations:
externalSecrets:
enabled: true
webhook:
enabled: true
sync:
clusterStores:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- contains:
path: rules
content:
apiGroups: ["admissionregistration.k8s.io"]
resources: ["validatingwebhookconfigurations", "mutatingwebhookconfigurations"]
verbs: ["get", "list", "watch"]
- contains:
path: rules
content:
apiGroups: [ "external-secrets.io" ]
resources: [ "clustersecretstores" ]
verbs: ["get", "list", "watch"]

View File

@@ -0,0 +1,141 @@
suite: ClusterRoleBinding
templates:
- clusterrolebinding.yaml
tests:
- it: disable by default
asserts:
- hasDocuments:
count: 0
- it: enable by multi namespace mode
set:
experimental:
multiNamespaceMode:
enabled: true
asserts:
- hasDocuments:
count: 1
- it: enable by from syncer
set:
sync:
fromHost:
ingressClasses:
enabled: true
asserts:
- hasDocuments:
count: 1
- it: enable by generic sync
set:
experimental:
genericSync:
clusterRole:
extraRules:
- apiGroups: [""]
resources: ["test"]
verbs: ["test"]
asserts:
- hasDocuments:
count: 1
- it: enable by plugins
set:
plugins:
test:
rbac:
clusterRole:
extraRules:
- apiGroups: [""]
resources: ["test"]
verbs: ["test"]
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- it: enable by plugin
set:
plugin:
test:
rbac:
clusterRole:
extraRules:
- apiGroups: [""]
resources: ["test"]
verbs: ["test"]
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- it: enable by legacy api key
set:
pro: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: ClusterRoleBinding
- equal:
path: metadata.name
value: vc-my-release-v-my-namespace
- notExists:
path: metadata.namespace
- it: enable by extra rules
set:
rbac:
clusterRole:
extraRules:
- apiGroups: [""]
resources: ["test"]
verbs: ["test"]
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: ClusterRoleBinding
- equal:
path: metadata.name
value: vc-my-release-v-my-namespace
- notExists:
path: metadata.namespace
- it: enable by overwrite rules
set:
rbac:
clusterRole:
overwriteRules:
- apiGroups: [""]
resources: ["test"]
verbs: ["test"]
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: ClusterRoleBinding
- equal:
path: metadata.name
value: vc-my-release-v-my-namespace
- notExists:
path: metadata.namespace

View File

@@ -0,0 +1,577 @@
suite: CoreDNS Configmap
templates:
- coredns-configmap.yaml
tests:
- it: should create configmap
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: vc-coredns-my-release
- equal:
path: metadata.namespace
value: my-namespace
- it: should create correct external coredns config
asserts:
- hasDocuments:
count: 1
- notExists:
path: data.Corefile
- equal:
path: data["coredns.yaml"]
value: |-
apiVersion: v1
kind: ServiceAccount
metadata:
name: coredns
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:coredns
rules:
- apiGroups:
- ""
resources:
- endpoints
- services
- pods
- namespaces
verbs:
- list
- watch
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:coredns
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:coredns
subjects:
- kind: ServiceAccount
name: coredns
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |-
.:1053 {
errors
health
ready
rewrite name regex .*\.nodes\.vcluster\.com kubernetes.default.svc.cluster.local
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
}
hosts /etc/NodeHosts {
ttl 60
reload 15s
fallthrough
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
loadbalance
}
import /etc/coredns/custom/*.server
NodeHosts: ""
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: coredns
namespace: kube-system
labels:
k8s-app: kube-dns
kubernetes.io/name: "CoreDNS"
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
selector:
matchLabels:
k8s-app: kube-dns
template:
metadata:
labels:
k8s-app: kube-dns
spec:
priorityClassName: ""
serviceAccountName: coredns
nodeSelector:
kubernetes.io/os: linux
topologySpreadConstraints:
- labelSelector:
matchLabels:
k8s-app: kube-dns
maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
containers:
- name: coredns
image: {{.IMAGE}}
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 1000m
memory: 170Mi
requests:
cpu: 20m
memory: 64Mi
args: [ "-conf", "/etc/coredns/Corefile" ]
volumeMounts:
- name: config-volume
mountPath: /etc/coredns
readOnly: true
- name: custom-config-volume
mountPath: /etc/coredns/custom
readOnly: true
securityContext:
runAsNonRoot: true
runAsUser: {{.RUN_AS_USER}}
runAsGroup: {{.RUN_AS_GROUP}}
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
- ALL
readOnlyRootFilesystem: true
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /ready
port: 8181
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 2
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
dnsPolicy: Default
volumes:
- name: config-volume
configMap:
name: coredns
items:
- key: Corefile
path: Corefile
- key: NodeHosts
path: NodeHosts
- name: custom-config-volume
configMap:
name: coredns-custom
optional: true
---
apiVersion: v1
kind: Service
metadata:
name: kube-dns
namespace: kube-system
annotations:
prometheus.io/port: "9153"
prometheus.io/scrape: "true"
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "CoreDNS"
spec:
type: ClusterIP
selector:
k8s-app: kube-dns
ports:
- name: dns
port: 53
targetPort: 1053
protocol: UDP
- name: dns-tcp
port: 53
targetPort: 1053
protocol: TCP
- name: metrics
port: 9153
protocol: TCP
- it: should create correct custom configmap
set:
controlPlane:
coredns:
embedded: true
overwriteManifests: |-
abc
asserts:
- hasDocuments:
count: 1
- equal:
path: data["coredns.yaml"]
value: |-
abc
- it: should create correct custom configmap
set:
controlPlane:
coredns:
embedded: true
overwriteConfig: |-
abc
asserts:
- hasDocuments:
count: 1
- equal:
path: data.Corefile
value: |-
abc
- it: should create correct embedded configmap
set:
controlPlane:
coredns:
embedded: true
asserts:
- hasDocuments:
count: 1
- equal:
path: data.Corefile
value: |-
.:1053 {
errors
health
ready
rewrite name regex .*\.nodes\.vcluster\.com kubernetes.default.svc.cluster.local
kubernetes cluster.local in-addr.arpa ip6.arpa {
kubeconfig /data/vcluster/admin.conf
pods insecure
fallthrough in-addr.arpa ip6.arpa
}
hosts /etc/NodeHosts {
ttl 60
reload 15s
fallthrough
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
loadbalance
}
import /etc/coredns/custom/*.server
- equal:
path: data["coredns.yaml"]
value: |-
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
NodeHosts: ""
---
apiVersion: v1
kind: Service
metadata:
name: kube-dns
namespace: kube-system
annotations:
prometheus.io/port: "9153"
prometheus.io/scrape: "true"
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "CoreDNS"
spec:
type: ClusterIP
ports:
- name: dns
port: 53
targetPort: 1053
protocol: UDP
- name: dns-tcp
port: 53
targetPort: 1053
protocol: TCP
- name: metrics
port: 9153
protocol: TCP
- it: should correctly apply affinity and tolerations
set:
controlPlane:
coredns:
deployment:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- coredns
topologyKey: kubernetes.io/hostname
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists
asserts:
- equal:
path: data["coredns.yaml"]
value: |-
apiVersion: v1
kind: ServiceAccount
metadata:
name: coredns
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:coredns
rules:
- apiGroups:
- ""
resources:
- endpoints
- services
- pods
- namespaces
verbs:
- list
- watch
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:coredns
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:coredns
subjects:
- kind: ServiceAccount
name: coredns
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |-
.:1053 {
errors
health
ready
rewrite name regex .*\.nodes\.vcluster\.com kubernetes.default.svc.cluster.local
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
}
hosts /etc/NodeHosts {
ttl 60
reload 15s
fallthrough
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
loadbalance
}
import /etc/coredns/custom/*.server
NodeHosts: ""
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: coredns
namespace: kube-system
labels:
k8s-app: kube-dns
kubernetes.io/name: "CoreDNS"
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
selector:
matchLabels:
k8s-app: kube-dns
template:
metadata:
labels:
k8s-app: kube-dns
spec:
priorityClassName: ""
serviceAccountName: coredns
nodeSelector:
kubernetes.io/os: linux
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- coredns
topologyKey: kubernetes.io/hostname
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists
topologySpreadConstraints:
- labelSelector:
matchLabels:
k8s-app: kube-dns
maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
containers:
- name: coredns
image: {{.IMAGE}}
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 1000m
memory: 170Mi
requests:
cpu: 20m
memory: 64Mi
args: [ "-conf", "/etc/coredns/Corefile" ]
volumeMounts:
- name: config-volume
mountPath: /etc/coredns
readOnly: true
- name: custom-config-volume
mountPath: /etc/coredns/custom
readOnly: true
securityContext:
runAsNonRoot: true
runAsUser: {{.RUN_AS_USER}}
runAsGroup: {{.RUN_AS_GROUP}}
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
- ALL
readOnlyRootFilesystem: true
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /ready
port: 8181
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 2
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
dnsPolicy: Default
volumes:
- name: config-volume
configMap:
name: coredns
items:
- key: Corefile
path: Corefile
- key: NodeHosts
path: NodeHosts
- name: custom-config-volume
configMap:
name: coredns-custom
optional: true
---
apiVersion: v1
kind: Service
metadata:
name: kube-dns
namespace: kube-system
annotations:
prometheus.io/port: "9153"
prometheus.io/scrape: "true"
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "CoreDNS"
spec:
type: ClusterIP
selector:
k8s-app: kube-dns
ports:
- name: dns
port: 53
targetPort: 1053
protocol: UDP
- name: dns-tcp
port: 53
targetPort: 1053
protocol: TCP
- name: metrics
port: 9153
protocol: TCP

View File

@@ -0,0 +1,125 @@
suite: External etcd headless Service
templates:
- etcd-headless-service.yaml
tests:
- it: check disabled
asserts:
- hasDocuments:
count: 0
- it: enable for k3s & defaults
release:
name: my-release
namespace: my-namespace
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
headlessService:
annotations:
test: test
distro:
k3s:
enabled: true
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: my-release-etcd-headless
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: metadata.annotations.test
value: test
- it: enable for k0s & defaults
release:
name: my-release
namespace: my-namespace
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
headlessService:
annotations:
test: test
distro:
k0s:
enabled: true
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: my-release-etcd-headless
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: metadata.annotations.test
value: test
- it: enable for k8s & defaults
release:
name: my-release
namespace: my-namespace
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
headlessService:
annotations:
test: test
distro:
k8s:
enabled: true
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: my-release-etcd-headless
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: metadata.annotations.test
value: test
- it: enable for k8s & defaults
release:
name: my-release
namespace: my-namespace
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
headlessService:
annotations:
test: test
distro:
k8s:
enabled: true
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: my-release-etcd-headless
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: metadata.annotations.test
value: test

View File

@@ -0,0 +1,38 @@
suite: External etcd Service
templates:
- etcd-service.yaml
tests:
- it: check disabled
asserts:
- hasDocuments:
count: 0
- it: enable for k8s & defaults
release:
name: my-release
namespace: my-namespace
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
service:
annotations:
test: test
distro:
k8s:
enabled: true
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: my-release-etcd
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: metadata.annotations.test
value: test

View File

@@ -0,0 +1,196 @@
suite: External etcd StatefulSet
templates:
- etcd-statefulset.yaml
tests:
- it: check disabled
asserts:
- hasDocuments:
count: 0
- it: check disabled headless
set:
controlPlane:
distro:
k8s:
enabled: true
experimental:
isolatedControlPlane:
headless: true
asserts:
- hasDocuments:
count: 0
- it: check default image registry
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
statefulSet:
image:
tag: "123"
advanced:
defaultImageRegistry: fabi.com
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.template.spec.containers[0].image
value: fabi.com/etcd:123
- it: disables serviceLinks for backingStore etcd pod
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
statefulSet:
enabled: true
enableServiceLinks: false
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.template.spec.enableServiceLinks
value: false
- it: change image registry
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
statefulSet:
image:
registry: fabi.com
tag: "123"
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.template.spec.containers[0].image
value: fabi.com/etcd:123
- it: check specified storage class is used
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
statefulSet:
persistence:
volumeClaim:
storageClass: test-sc
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.volumeClaimTemplates[0].spec.storageClassName
value: test-sc
- it: enabled for k3s & non persistent
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
statefulSet:
extraArgs:
- "extra-arg"
env:
- name: my-new-env
persistence:
volumeClaim:
enabled: false
addVolumes:
- name: my-new-volume
addVolumeMounts:
- name: my-new-volume
asserts:
- hasDocuments:
count: 1
- contains:
path: spec.template.spec.volumes
content:
name: "data"
emptyDir: {}
count: 1
- notExists:
path: spec.volumeClaimTemplates
- contains:
path: spec.template.spec.volumes
content:
name: "my-new-volume"
count: 1
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
name: "my-new-volume"
count: 1
- contains:
path: spec.template.spec.containers[0].env
content:
name: "my-new-env"
count: 1
- contains:
path: spec.template.spec.containers[0].command
content: "extra-arg"
count: 1
- it: enable for k8s & defaults
release:
name: my-release
namespace: my-namespace
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
statefulSet:
highAvailability:
replicas: 3
annotations:
test: test
distro:
k8s:
enabled: true
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: my-release-etcd
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: metadata.annotations.test
value: test
- equal:
path: spec.replicas
value: 3
- lengthEqual:
path: spec.volumeClaimTemplates
count: 1
- lengthEqual:
path: spec.template.spec.volumes
count: 1
- lengthEqual:
path: spec.template.spec.containers[0].volumeMounts
count: 2
- lengthEqual:
path: spec.template.spec.containers[0].env
count: 1
- notExists:
path: spec.template.spec.containers[0].args
- contains:
path: spec.template.spec.containers[0].command
content: "--initial-cluster=my-release-etcd-0=https://my-release-etcd-0.my-release-etcd-headless.my-namespace:2380,my-release-etcd-1=https://my-release-etcd-1.my-release-etcd-headless.my-namespace:2380,my-release-etcd-2=https://my-release-etcd-2.my-release-etcd-headless.my-namespace:2380"
count: 1

View File

@@ -0,0 +1,97 @@
suite: ControlPlane StatefulSet
templates:
- headless-service.yaml
tests:
- it: should not create control-plane
set:
experimental:
isolatedControlPlane:
headless: true
asserts:
- hasDocuments:
count: 0
- it: should create if k8s
set:
controlPlane:
distro:
k8s:
enabled: true
asserts:
- hasDocuments:
count: 1
- it: should not create if stateless
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
asserts:
- hasDocuments:
count: 0
- it: should not create if stateless 2
set:
controlPlane:
backingStore:
database:
external:
enabled: true
asserts:
- hasDocuments:
count: 0
- it: name
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: spec.ports
count: 1
- equal:
path: metadata.name
value: my-release-headless
- equal:
path: metadata.namespace
value: my-namespace
- it: embedded-etcd
set:
controlPlane:
backingStore:
etcd:
embedded:
enabled: true
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: spec.ports
count: 3
- equal:
path: spec.ports[1].name
value: etcd
- equal:
path: spec.ports[2].name
value: peer
- it: embedded-database
set:
controlPlane:
backingStore:
database:
embedded:
enabled: true
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: spec.ports
count: 1

View File

@@ -0,0 +1,56 @@
suite: ControlPlane Ingress
templates:
- ingress.yaml
tests:
- it: should not create ingress by default
asserts:
- hasDocuments:
count: 0
- it: ingress defaults
set:
controlPlane:
ingress:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: my-release
- equal:
path: metadata.namespace
value: my-namespace
- it: overwrite ingress tls
set:
controlPlane:
ingress:
enabled: true
host: my-host
spec:
tls:
- hosts:
- ingress-demo.example.com
secretName: ingress-demo-tls
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: spec.tls
count: 1
- equal:
path: spec.rules[0].host
value: my-host
- contains:
path: spec.tls
count: 1
content:
hosts:
- ingress-demo.example.com
secretName: ingress-demo-tls

View File

@@ -0,0 +1,94 @@
suite: LimitRange
templates:
- limitrange.yaml
tests:
- it: should not create limit range by default
asserts:
- hasDocuments:
count: 0
- it: check defaults
release:
name: my-release
namespace: my-namespace
set:
policies:
limitRange:
enabled: true
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: vc-my-release
- equal:
path: metadata.namespace
value: my-namespace
- lengthEqual:
path: spec.limits
count: 1
- it: check enabled
release:
name: my-release
namespace: my-namespace
set:
policies:
resourceQuota:
enabled: true
asserts:
- hasDocuments:
count: 1
- it: check disabled
release:
name: my-release
namespace: my-namespace
set:
policies:
resourceQuota:
enabled: true
limitRange:
enabled: false
asserts:
- hasDocuments:
count: 0
- it: check disabled both false
release:
name: my-release
namespace: my-namespace
set:
policies:
resourceQuota:
enabled: false
limitRange:
enabled: false
asserts:
- hasDocuments:
count: 0
- it: check disabled both false
release:
name: my-release
namespace: my-namespace
set:
policies:
limitRange:
enabled: true
min:
cpu: 1
max:
memory: 256Mi
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.limits[0].min.cpu
value: "1"
- equal:
path: spec.limits[0].max.memory
value: "256Mi"

View File

@@ -0,0 +1,94 @@
suite: Manifests
templates:
- manifests.yaml
tests:
- it: should not create manifests by default
asserts:
- hasDocuments:
count: 0
- it: check defaults
release:
name: my-release
namespace: my-namespace
set:
experimental:
deploy:
vcluster:
manifests: |-
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- image: nginx
name: nginx
asserts:
- hasDocuments:
count: 0
- it: check defaults
release:
name: my-release
namespace: my-namespace
set:
experimental:
deploy:
host:
manifests: |-
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- image: nginx
name: nginx
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: Pod
- equal:
path: spec.containers[0].name
value: nginx
- it: check defaults
release:
name: my-release
namespace: my-namespace
set:
experimental:
deploy:
host:
manifestsTemplate: |-
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: {{ .Release.Namespace }}
labels:
app: nginx
spec:
containers:
- image: nginx
name: nginx
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: Pod
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: spec.containers[0].name
value: nginx

View File

@@ -0,0 +1,49 @@
suite: NetworkPolicy
templates:
- networkpolicy.yaml
tests:
- it: should not create network policy by default
asserts:
- hasDocuments:
count: 0
- it: check defaults
release:
name: my-release
namespace: my-namespace
set:
policies:
networkPolicy:
enabled: true
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
equal:
path: metadata.name
value: vc-work-my-release
- documentIndex: 0
equal:
path: spec.egress[2].to[1].ipBlock.cidr
value: 0.0.0.0/0
- documentIndex: 1
equal:
path: metadata.name
value: vc-cp-my-release
- documentIndex: 0
equal:
path: metadata.namespace
value: my-namespace
- documentIndex: 1
equal:
path: metadata.namespace
value: my-namespace
- documentIndex: 0
lengthEqual:
path: spec.egress
count: 3
- documentIndex: 1
lengthEqual:
path: spec.egress
count: 2

View File

@@ -0,0 +1,114 @@
suite: Platform Secret Role
templates:
- platform-rbac.yaml
tests:
- it: check explicitly disabled
set:
external:
platform:
apiKey:
namespace: "some-other-namespace"
createRBAC: false
asserts:
- hasDocuments:
count: 0
- it: check disabled on empty namespace
set:
external:
platform:
apiKey:
namespace: ""
asserts:
- hasDocuments:
count: 0
- it: check disabled on implicit same namespace
set:
external:
platform:
apiKey:
secretName: "some-other-secret"
asserts:
- hasDocuments:
count: 0
- it: automatically create role for specific secret for reading & patching
set:
external:
platform:
apiKey:
secretName: "my-secret-name"
namespace: "some-other-namespace"
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
lengthEqual:
path: rules
count: 1
- documentIndex: 0
equal:
path: metadata.name
value: "vc-RELEASE-NAME-v-NAMESPACE-platform-role"
- documentIndex: 1
equal:
path: metadata.name
value: "vc-RELEASE-NAME-v-NAMESPACE-platform-role-binding"
- documentIndex: 0
contains:
path: rules
count: 1
content:
apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]
resourceNames: ["my-secret-name"]
- documentIndex: 1
contains:
path: subjects
count: 1
content:
kind: ServiceAccount
name: vc-RELEASE-NAME
namespace: some-other-namespace
- it: automatically create role for default secret for reading & patching
set:
external:
platform:
apiKey:
namespace: "some-other-namespace"
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
lengthEqual:
path: rules
count: 1
- documentIndex: 0
equal:
path: metadata.name
value: "vc-RELEASE-NAME-v-NAMESPACE-platform-role"
- documentIndex: 1
equal:
path: metadata.name
value: "vc-RELEASE-NAME-v-NAMESPACE-platform-role-binding"
- documentIndex: 0
contains:
path: rules
count: 1
content:
apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]
resourceNames: ["vcluster-platform-api-key"]
- documentIndex: 1
contains:
path: subjects
count: 1
content:
kind: ServiceAccount
name: vc-RELEASE-NAME
namespace: some-other-namespace

View File

@@ -0,0 +1,70 @@
suite: ResourceQuota
templates:
- resourcequota.yaml
tests:
- it: should not create resource quota by default
asserts:
- hasDocuments:
count: 0
- it: check defaults
release:
name: my-release
namespace: my-namespace
set:
policies:
resourceQuota:
enabled: true
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: vc-my-release
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: spec.hard["requests.cpu"]
value: "10"
- it: check enabled
release:
name: my-release
namespace: my-namespace
set:
policies:
limitRange:
enabled: true
asserts:
- hasDocuments:
count: 1
- it: check disabled
release:
name: my-release
namespace: my-namespace
set:
policies:
resourceQuota:
enabled: false
limitRange:
enabled: true
asserts:
- hasDocuments:
count: 0
- it: check disabled both false
release:
name: my-release
namespace: my-namespace
set:
policies:
resourceQuota:
enabled: false
limitRange:
enabled: false
asserts:
- hasDocuments:
count: 0

View File

@@ -0,0 +1,349 @@
suite: Role
templates:
- role.yaml
tests:
- it: check disabled
set:
rbac:
role:
enabled: false
asserts:
- hasDocuments:
count: 0
- it: check overwrite rules
set:
rbac:
role:
overwriteRules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["create"]
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 1
- contains:
path: rules
count: 1
content:
apiGroups: [""]
resources: ["configmaps"]
verbs: ["create"]
- it: check plugin extra rules
set:
plugin:
test123:
rbac:
role:
extraRules:
- apiGroups: [""]
resources: ["test123"]
verbs: ["test123"]
plugins:
test:
rbac:
role:
extraRules:
- apiGroups: [""]
resources: ["test"]
verbs: ["test"]
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 7
- contains:
path: rules
count: 1
content:
apiGroups: [""]
resources: ["test123"]
verbs: ["test123"]
- contains:
path: rules
count: 1
content:
apiGroups: [""]
resources: ["test"]
verbs: ["test"]
- it: check generic sync
set:
experimental:
genericSync:
role:
extraRules:
- apiGroups: [""]
resources: ["test"]
verbs: ["test"]
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 6
- contains:
path: rules
count: 1
content:
apiGroups: [""]
resources: ["test"]
verbs: ["test"]
- it: check extra rules
set:
rbac:
role:
extraRules:
- apiGroups: [""]
resources: ["test"]
verbs: ["test"]
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: rules
count: 6
- contains:
path: rules
count: 1
content:
apiGroups: [""]
resources: ["test"]
verbs: ["test"]
- it: check defaults
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: Role
- equal:
path: metadata.name
value: vc-my-release
- equal:
path: metadata.namespace
value: my-namespace
- it: multi-namespace mode
set:
experimental:
multiNamespaceMode:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: ClusterRole
- equal:
path: metadata.name
value: vc-mn-my-release-v-my-namespace
- it: metrics proxy
set:
integrations:
metricsServer:
enabled: true
pods: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: Role
- contains:
path: rules
content:
apiGroups: ["metrics.k8s.io"]
resources: ["pods"]
verbs: ["get", "list"]
- it: external secret test
set:
integrations:
externalSecrets:
enabled: true
sync:
externalSecrets:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: Role
- contains:
path: rules
content:
apiGroups: ["external-secrets.io"]
resources: ["externalsecrets"]
verbs:
["create", "delete", "patch", "update", "get", "list", "watch"]
- it: external secret test store sync
set:
integrations:
externalSecrets:
enabled: true
sync:
externalSecrets:
enabled: true
stores:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: Role
- contains:
path: rules
content:
apiGroups: ["external-secrets.io"]
resources: ["secretstores"]
verbs:
["create", "delete", "patch", "update", "get", "list", "watch"]
- it: kubeVirt test
set:
integrations:
kubeVirt:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: Role
- contains:
path: rules
content:
apiGroups: ["kubevirt.io"]
resources:
[
"virtualmachines",
"virtualmachines/status",
"virtualmachineinstances",
"virtualmachineinstances/status",
"virtualmachineinstancemigrations",
"virtualmachineinstancemigrations/status",
]
verbs:
["create", "delete", "patch", "update", "get", "list", "watch"]
- contains:
path: rules
content:
apiGroups: ["cdi.kubevirt.io"]
resources: ["datavolumes", "datavolumes/status"]
verbs:
["create", "delete", "patch", "update", "get", "list", "watch"]
- contains:
path: rules
content:
apiGroups: ["clone.kubevirt.io"]
resources: ["virtualmachineclones", "virtualmachineclones/status"]
verbs:
["create", "delete", "patch", "update", "get", "list", "watch"]
- contains:
path: rules
content:
apiGroups: ["pool.kubevirt.io"]
resources: ["virtualmachinepools", "virtualmachinepools/status"]
verbs:
["create", "delete", "patch", "update", "get", "list", "watch"]
- it: crd sync
set:
sync:
toHost:
customResources:
test.my-group:
enabled: false
test.my-group-2:
enabled: true
tests.my-group-3.com:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: Role
- lengthEqual:
path: rules
count: 7
- contains:
path: rules
content:
apiGroups: ["my-group-2"]
resources: ["test"]
verbs:
["create", "delete", "patch", "update", "get", "list", "watch"]
- contains:
path: rules
content:
apiGroups: ["my-group-3.com"]
resources: ["tests"]
verbs:
["create", "delete", "patch", "update", "get", "list", "watch"]
- it: patches
set:
sync:
toHost:
customResources:
test.my-group-2:
enabled: true
patches:
- path: "test"
expression: "test"
release:
name: my-release
namespace: my-namespace
asserts:
- notFailedTemplate: {}
- it: patches 2
set:
sync:
toHost:
customResources:
test.my-group-2:
enabled: true
patches:
- path: "test"
reference:
apiVersion: "v1"
kind: "Secret"
release:
name: my-release
namespace: my-namespace
asserts:
- notFailedTemplate: {}

View File

@@ -0,0 +1,59 @@
suite: RoleBinding
templates:
- rolebinding.yaml
tests:
- it: check defaults
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: RoleBinding
- equal:
path: metadata.name
value: vc-my-release
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: subjects[0].name
value: vc-my-release
- equal:
path: roleRef.kind
value: Role
- equal:
path: roleRef.name
value: vc-my-release
- it: multi-namespace mode
set:
experimental:
multiNamespaceMode:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: ClusterRoleBinding
- equal:
path: metadata.name
value: vc-mn-my-release-v-my-namespace
- notExists:
path: metadata.namespace
- equal:
path: subjects[0].name
value: vc-my-release
- equal:
path: roleRef.kind
value: ClusterRole
- equal:
path: roleRef.name
value: vc-mn-my-release-v-my-namespace

View File

@@ -0,0 +1,33 @@
suite: ServiceMonitor
templates:
- service-monitor.yaml
tests:
- it: should not create service monitor by default
asserts:
- hasDocuments:
count: 0
- it: check defaults
release:
name: my-release
namespace: my-namespace
set:
controlPlane:
serviceMonitor:
enabled: true
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: vc-my-release
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: spec.selector.matchLabels.app
value: vcluster
- lengthEqual:
path: spec.endpoints
count: 1

View File

@@ -0,0 +1,118 @@
suite: ControlPlane Service
templates:
- service.yaml
tests:
- it: should not create service
set:
controlPlane:
service:
enabled: false
asserts:
- hasDocuments:
count: 0
- it: should not create kubelet port
set:
networking:
advanced:
proxyKubelets:
byHostname: false
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: spec.ports
count: 1
- contains:
path: spec.ports
content:
name: https
nodePort: 0
targetPort: 8443
protocol: TCP
port: 443
- it: should not create kubelet port 2
set:
controlPlane:
service:
spec:
type: LoadBalancer
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: spec.ports
count: 1
- contains:
path: spec.ports
content:
name: https
nodePort: 0
targetPort: 8443
protocol: TCP
port: 443
- it: should create kubelet port
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: spec.ports
count: 2
- contains:
path: spec.ports
content:
name: kubelet
nodePort: 0
targetPort: 8443
protocol: TCP
port: 10250
- it: service defaults
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: my-release
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: spec.type
value: ClusterIP
- equal:
path: spec.selector.app
value: vcluster
- lengthEqual:
path: spec.ports
count: 2
- it: isolated control plane
release:
name: my-release
namespace: my-namespace
set:
experimental:
isolatedControlPlane:
headless: true
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.type
value: ClusterIP
- lengthEqual:
path: spec.ports
count: 2
- notExists:
path: spec.ports[0].targetPort
- notExists:
path: spec.ports[1].targetPort
- notExists:
path: spec.selector

View File

@@ -0,0 +1,61 @@
suite: ControlPlane ServiceAccount
templates:
- serviceaccount.yaml
tests:
- it: should not create service account
set:
controlPlane:
advanced:
serviceAccount:
enabled: false
asserts:
- hasDocuments:
count: 0
- it: should create service account
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: vc-my-release
- equal:
path: metadata.namespace
value: my-namespace
- it: should create service account with name
set:
controlPlane:
advanced:
serviceAccount:
name: test
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: test
- it: should create image pull secrets
set:
controlPlane:
advanced:
serviceAccount:
imagePullSecrets:
- name: test1
workloadServiceAccount:
imagePullSecrets:
- name: test2
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: imagePullSecrets
count: 1
- equal:
path: imagePullSecrets[0].name
value: test1

View File

@@ -0,0 +1,897 @@
suite: ControlPlane StatefulSet
templates:
- statefulset.yaml
tests:
- it: should not create control-plane
set:
experimental:
isolatedControlPlane:
headless: true
asserts:
- hasDocuments:
count: 0
- it: image name
set:
controlPlane:
statefulSet:
image:
registry: "custom-registry.com"
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: custom-registry.com/loft-sh/vcluster-pro:0.0.1
- it: defaultImageRegistry
set:
controlPlane:
advanced:
defaultImageRegistry: docker.io
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: docker.io/loft-sh/vcluster-pro:0.0.1
- it: custom tag
set:
controlPlane:
statefulSet:
image:
repository: my-repo
tag: "custom-tag"
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/my-repo:custom-tag
- it: custom init container
set:
controlPlane:
distro:
k3s:
enabled: true
image:
registry: "ghcr.io"
repository: "test"
tag: "123"
asserts:
- equal:
path: spec.template.spec.initContainers[0].image
value: ghcr.io/test:123
- it: custom init container
set:
controlPlane:
distro:
k0s:
enabled: true
image:
registry: ""
repository: "k0s"
tag: "123"
asserts:
- equal:
path: spec.template.spec.initContainers[0].image
value: k0s:123
- it: disables serviceLinks for sts etcd pod
set:
controlPlane:
statefulSet:
enableServiceLinks: false
asserts:
- equal:
path: spec.template.spec.enableServiceLinks
value: false
- it: custom init container
set:
controlPlane:
distro:
k8s:
enabled: true
controllerManager:
image:
registry: ""
repository: "k8s-controller"
tag: "123"
apiServer:
image:
registry: ""
repository: "k8s-api"
tag: "456"
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: k8s-controller:123
- equal:
path: spec.template.spec.initContainers[2].image
value: k8s-api:456
- it: custom init container
set:
controlPlane:
distro:
k8s:
enabled: true
controllerManager:
image:
repository: "k8s-controller"
tag: "123"
apiServer:
image:
repository: "k8s-api"
tag: "456"
advanced:
defaultImageRegistry: "bbb.com"
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: bbb.com/k8s-controller:123
- equal:
path: spec.template.spec.initContainers[2].image
value: bbb.com/k8s-api:456
- it: name & defaults
release:
name: my-release
namespace: my-namespace
capabilities:
majorVersion: 1
minorVersion: 29
asserts:
- hasDocuments:
count: 1
- equal:
path: kind
value: StatefulSet
- lengthEqual:
path: spec.template.spec.containers
count: 1
- equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/loft-sh/vcluster-pro:0.0.1
- contains:
path: spec.template.spec.containers[0].env
content:
name: VCLUSTER_NAME
value: my-release
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
name: data
mountPath: /data
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
name: binaries
mountPath: /binaries
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
name: certs
mountPath: /pki
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
name: helm-cache
mountPath: /.cache/helm
- equal:
path: metadata.name
value: my-release
- equal:
path: metadata.namespace
value: my-namespace
- equal:
path: spec.podManagementPolicy
value: Parallel
- equal:
path: spec.persistentVolumeClaimRetentionPolicy.whenDeleted
value: Retain
- equal:
path: spec.replicas
value: 1
- equal:
path: spec.template.metadata.labels.app
value: vcluster
- equal:
path: spec.template.spec.terminationGracePeriodSeconds
value: 10
- equal:
path: spec.volumeClaimTemplates[0].spec.accessModes[0]
value: ReadWriteOnce
- equal:
path: spec.volumeClaimTemplates[0].spec.resources.requests.storage
value: 5Gi
- it: fail when both backing stores are enabled
set:
controlPlane:
backingStore:
etcd:
embedded:
enabled: true
deploy:
enabled: true
asserts:
- failedTemplate:
errorMessage: "you can only enable one backingStore at the same time"
- it: not persistent when external etcd is enabled
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
asserts:
- equal:
path: kind
value: Deployment
- notExists:
path: spec.volumeClaimTemplates
- it: not persistent when k8s and external database
set:
controlPlane:
distro:
k8s:
enabled: true
backingStore:
database:
external:
enabled: true
asserts:
- equal:
path: kind
value: Deployment
- notExists:
path: spec.volumeClaimTemplates
- it: persistent when embedded database
set:
controlPlane:
distro:
k8s:
enabled: true
backingStore:
database:
embedded:
enabled: true
asserts:
- equal:
path: kind
value: StatefulSet
- lengthEqual:
path: spec.volumeClaimTemplates
count: 1
- it: persistent when k8s and embedded etcd
set:
controlPlane:
backingStore:
etcd:
embedded:
enabled: true
distro:
k8s:
enabled: true
asserts:
- equal:
path: kind
value: StatefulSet
- lengthEqual:
path: spec.volumeClaimTemplates
count: 1
- it: persistent when embedded database
asserts:
- equal:
path: kind
value: StatefulSet
- lengthEqual:
path: spec.volumeClaimTemplates
count: 1
- it: plugin 1
set:
plugins:
test:
image: test
plugin:
test123:
version: v2
image: test
asserts:
- lengthEqual:
path: spec.template.spec.volumes
count: 7
- lengthEqual:
path: spec.template.spec.initContainers
count: 5
- it: plugin volumes 2
set:
controlPlane:
distro:
k0s:
enabled: true
plugin:
test:
version: v2
image: test
asserts:
- equal:
path: kind
value: StatefulSet
- lengthEqual:
path: spec.template.spec.volumes
count: 8
- lengthEqual:
path: spec.template.spec.initContainers
count: 2
- it: plugin volumes 3
set:
plugin:
test:
image: test
asserts:
- lengthEqual:
path: spec.template.spec.volumes
count: 6
- lengthEqual:
path: spec.template.spec.initContainers
count: 3
- it: add volumes
set:
controlPlane:
distro:
k3s:
enabled: true
statefulSet:
persistence:
addVolumes:
- name: myVolume
asserts:
- contains:
path: spec.template.spec.volumes
content:
name: myVolume
- lengthEqual:
path: spec.template.spec.volumes
count: 8
- it: enable k8s
set:
controlPlane:
distro:
k8s:
enabled: true
asserts:
- equal:
path: kind
value: StatefulSet
- lengthEqual:
path: spec.volumeClaimTemplates
count: 1
- it: enable k8s with deploy etcd
set:
controlPlane:
distro:
k8s:
enabled: true
backingStore:
etcd:
deploy:
enabled: true
asserts:
- equal:
path: kind
value: Deployment
- notExists:
path: spec.volumeClaimTemplates
- contains:
path: spec.template.spec.volumes
content:
name: data
emptyDir: {}
- it: enable k8s
release:
name: my-release
namespace: my-namespace
set:
controlPlane:
distro:
k8s:
enabled: true
statefulSet:
persistence:
volumeClaim:
enabled: false
volumeClaimTemplates:
- metadata:
name: data
spec:
resources:
requests:
storage: 5Gi
asserts:
- equal:
path: kind
value: StatefulSet
- equal:
path: spec.serviceName
value: my-release-headless
- contains:
path: spec.volumeClaimTemplates
content:
metadata:
name: data
spec:
resources:
requests:
storage: 5Gi
- it: enable k8s
set:
controlPlane:
distro:
k8s:
enabled: true
release:
name: my-release
namespace: my-namespace
asserts:
- equal:
path: kind
value: StatefulSet
- equal:
path: spec.serviceName
value: my-release-headless
- lengthEqual:
path: spec.volumeClaimTemplates
count: 1
- it: enable k8s with deploy etcd
set:
controlPlane:
distro:
k8s:
enabled: true
backingStore:
etcd:
deploy:
enabled: true
asserts:
- equal:
path: kind
value: Deployment
- notExists:
path: spec.volumeClaimTemplates
- contains:
path: spec.template.spec.volumes
content:
name: data
emptyDir: {}
- it: enable k0s
set:
controlPlane:
backingStore:
etcd:
deploy:
enabled: true
distro:
k0s:
enabled: true
asserts:
- equal:
path: kind
value: Deployment
- notExists:
path: spec.volumeClaimTemplates
- contains:
path: spec.template.spec.volumes
content:
name: data
emptyDir: {}
- it: append distro env
set:
controlPlane:
distro:
k3s:
enabled: true
env:
- name: KEY
value: VALUE
asserts:
- equal:
path: kind
value: StatefulSet
- contains:
path: spec.template.spec.containers[0].env
content:
name: KEY
value: VALUE
- it: should correctly set labels on the statefulset
set:
controlPlane:
statefulSet:
labels:
my-label: my-value
asserts:
- equal:
path: kind
value: StatefulSet
- equal:
path: metadata.labels["my-label"]
value: "my-value"
- it: binariesVolume - should set to emptyDir by default
asserts:
- contains:
path: spec.template.spec.volumes
content:
name: binaries
emptyDir: {}
- it: binariesVolume - should set the specified volume type correctly
set:
controlPlane:
statefulSet:
persistence:
binariesVolume:
- name: binaries
persistentVolumeClaim:
claimName: my-pvc
asserts:
- contains:
path: spec.template.spec.volumes
content:
name: binaries
persistentVolumeClaim:
claimName: my-pvc
- it: dataVolume - should set the specified data volume type correctly
set:
controlPlane:
statefulSet:
persistence:
dataVolume:
- name: data
persistentVolumeClaim:
claimName: my-custom-pvc
asserts:
- contains:
path: spec.template.spec.volumes
content:
name: data
persistentVolumeClaim:
claimName: my-custom-pvc
- it: k8s version not set, default tag images used for apiServer and controllerManager
chart:
version: "test-"
set:
controlPlane:
distro:
k8s:
enabled: true
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v1.31.1
- equal:
path: spec.template.spec.initContainers[2].image
value: registry.k8s.io/kube-apiserver:v1.31.1
- it: k8s capabilities set
chart:
version: "test-v1.29.3"
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v1.29.3
- equal:
path: spec.template.spec.initContainers[2].image
value: registry.k8s.io/kube-apiserver:v1.29.3
- it: k8s capabilities orbstack
chart:
version: "test-v1.29.3+orb1"
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v1.29.3
- equal:
path: spec.template.spec.initContainers[2].image
value: registry.k8s.io/kube-apiserver:v1.29.3
- it: k8s capabilities invalid
chart:
version: "test-invalid"
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v1.31.1
- it: k8s capabilities incomplete
chart:
version: "test-v1.22"
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v1.31.1
- it: k8s capabilities incomplete 2
chart:
version: "test-1.22.11"
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v1.31.1
- it: k8s capabilities incomplete 2
chart:
version: "test-v1.22.33"
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v1.22.33
- it: k8s version sets image tag for apiServer and controllerManager
set:
controlPlane:
distro:
k8s:
enabled: true
version: v1.35.999
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v1.35.999
- equal:
path: spec.template.spec.initContainers[2].image
value: registry.k8s.io/kube-apiserver:v1.35.999
- it: k8s version set but overridden by image tag for apiServer and controllerManager
set:
controlPlane:
distro:
k8s:
enabled: true
version: v1.30.999
apiServer:
image:
tag: v99912
controllerManager:
image:
tag: v23123
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v23123
- equal:
path: spec.template.spec.initContainers[2].image
value: registry.k8s.io/kube-apiserver:v99912
- it: k8s not version set but image tags for apiServer and controllerManager set
set:
controlPlane:
distro:
k8s:
enabled: true
apiServer:
image:
tag: v99914
controllerManager:
image:
tag: v23127
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v23127
- equal:
path: spec.template.spec.initContainers[2].image
value: registry.k8s.io/kube-apiserver:v99914
- it: k8s version not set, default tag images used for apiServer and controllerManager (virtual scheduler enabled)
chart:
version: "test-"
set:
controlPlane:
distro:
k8s:
enabled: true
advanced:
virtualScheduler:
enabled: true
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v1.31.1
- equal:
path: spec.template.spec.initContainers[2].image
value: registry.k8s.io/kube-scheduler:v1.31.1
- equal:
path: spec.template.spec.initContainers[3].image
value: registry.k8s.io/kube-apiserver:v1.31.1
- it: k8s version sets image tag for apiServer and controllerManager (virtual scheduler enabled)
set:
controlPlane:
distro:
k8s:
enabled: true
version: v1.35.999
advanced:
virtualScheduler:
enabled: true
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v1.35.999
- equal:
path: spec.template.spec.initContainers[2].image
value: registry.k8s.io/kube-scheduler:v1.35.999
- equal:
path: spec.template.spec.initContainers[3].image
value: registry.k8s.io/kube-apiserver:v1.35.999
- it: k8s version set but overridden by image tag for apiServer and controllerManager (virtual scheduler enabled)
set:
controlPlane:
distro:
k8s:
enabled: true
version: v1.30.999
apiServer:
image:
tag: v99912
controllerManager:
image:
tag: v23123
scheduler:
image:
tag: v123654
advanced:
virtualScheduler:
enabled: true
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v23123
- equal:
path: spec.template.spec.initContainers[2].image
value: registry.k8s.io/kube-scheduler:v123654
- equal:
path: spec.template.spec.initContainers[3].image
value: registry.k8s.io/kube-apiserver:v99912
- it: k8s not version set but image tags for apiServer and controllerManager set (virtual scheduler enabled)
set:
controlPlane:
distro:
k8s:
enabled: true
apiServer:
image:
tag: v99914
controllerManager:
image:
tag: v23127
scheduler:
image:
tag: v123656
advanced:
virtualScheduler:
enabled: true
asserts:
- equal:
path: spec.template.spec.initContainers[1].image
value: registry.k8s.io/kube-controller-manager:v23127
- equal:
path: spec.template.spec.initContainers[2].image
value: registry.k8s.io/kube-scheduler:v123656
- equal:
path: spec.template.spec.initContainers[3].image
value: registry.k8s.io/kube-apiserver:v99914
- it: custom dnsPolicy
set:
controlPlane:
statefulSet:
dnsPolicy: "ClusterFirst"
asserts:
- equal:
path: spec.template.spec.dnsPolicy
value: "ClusterFirst"
- it: custom dnsConfig
set:
controlPlane:
statefulSet:
dnsConfig:
nameservers:
- 192.0.2.1
searches:
- ns1.svc.cluster-domain.example
options:
- name: ndots
value: "2"
asserts:
- equal:
path: spec.template.spec.dnsConfig.nameservers[0]
value: "192.0.2.1"
- equal:
path: spec.template.spec.dnsConfig.searches[0]
value: "ns1.svc.cluster-domain.example"
- equal:
path: spec.template.spec.dnsConfig.options[0].name
value: "ndots"
- equal:
path: spec.template.spec.dnsConfig.options[0].value
value: "2"
- it: must use StatefulSet for embedded etcd
set:
controlPlane:
backingStore:
etcd:
embedded:
enabled: true
asserts:
- equal:
path: kind
value: StatefulSet
- it: must use StatefulSet for embedded etcd without persistence
set:
controlPlane:
backingStore:
etcd:
embedded:
enabled: true
statefulSet:
persistence:
volumeClaim:
enabled: false
binariesVolume:
- name: binaries
emptyDir:
medium: Memory
asserts:
- equal:
path: kind
value: StatefulSet
- it: sync custom resources
set:
sync:
toHost:
customResources:
test.cert-manager.io:
enabled: true
patches:
- path: spec.dnsNames[*]
expression: "value.startsWith('www.') ? value.slice(4) : value"
reverseExpression: '"www."+value'
asserts:
- equal:
path: kind
value: StatefulSet

View File

@@ -0,0 +1,64 @@
suite: Workload ServiceAccount
templates:
- workload-serviceaccount.yaml
tests:
- it: should not create service account
set:
controlPlane:
advanced:
workloadServiceAccount:
enabled: false
asserts:
- hasDocuments:
count: 0
- it: should create service account
release:
name: my-release
namespace: my-namespace
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: vc-workload-my-release
- equal:
path: metadata.namespace
value: my-namespace
- it: should create service account with name
set:
controlPlane:
advanced:
workloadServiceAccount:
name: test
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: test
- it: should create image pull secrets
set:
controlPlane:
advanced:
serviceAccount:
imagePullSecrets:
- name: test1
workloadServiceAccount:
imagePullSecrets:
- name: test2
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: imagePullSecrets
count: 2
- equal:
path: imagePullSecrets[0].name
value: test1
- equal:
path: imagePullSecrets[1].name
value: test2

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,964 @@
# Sync describes how to sync resources from the virtual cluster to host cluster and back.
sync:
# Configure resources to sync from the virtual cluster to the host cluster.
toHost:
# Services defines if services created within the virtual cluster should get synced to the host cluster.
services:
# Enabled defines if this option should be enabled.
enabled: true
# Endpoints defines if endpoints created within the virtual cluster should get synced to the host cluster.
endpoints:
# Enabled defines if this option should be enabled.
enabled: true
# PersistentVolumeClaims defines if persistent volume claims created within the virtual cluster should get synced to the host cluster.
persistentVolumeClaims:
# Enabled defines if this option should be enabled.
enabled: true
# ConfigMaps defines if config maps created within the virtual cluster should get synced to the host cluster.
configMaps:
enabled: true
# All defines if all resources of that type should get synced or only the necessary ones that are needed.
all: false
# Secrets defines if secrets created within the virtual cluster should get synced to the host cluster.
secrets:
enabled: true
# All defines if all resources of that type should get synced or only the necessary ones that are needed.
all: false
# Pods defines if pods created within the virtual cluster should get synced to the host cluster.
pods:
# Enabled defines if pod syncing should be enabled.
enabled: true
# TranslateImage maps an image to another image that should be used instead. For example this can be used to rewrite
# a certain image that is used within the virtual cluster to be another image on the host cluster
translateImage: {}
# EnforceTolerations will add the specified tolerations to all pods synced by the virtual cluster.
enforceTolerations: []
# UseSecretsForSATokens will use secrets to save the generated service account tokens by virtual cluster instead of using a
# pod annotation.
useSecretsForSATokens: false
# RewriteHosts is a special option needed to rewrite statefulset containers to allow the correct FQDN. virtual cluster will add
# a small container to each stateful set pod that will initially rewrite the /etc/hosts file to match the FQDN expected by
# the virtual cluster.
rewriteHosts:
# Enabled specifies if rewriting stateful set pods should be enabled.
enabled: true
# InitContainer holds extra options for the init container used by vCluster to rewrite the FQDN for stateful set pods.
initContainer:
# Image is the image virtual cluster should use to rewrite this FQDN.
image: "library/alpine:3.20"
# Resources are the resources that should be assigned to the init container for each stateful set init container.
resources:
# Limits are resource limits for the container
limits:
cpu: 30m
memory: 64Mi
# Requests are minimal resources that will be consumed by the container
requests:
cpu: 30m
memory: 64Mi
# Ingresses defines if ingresses created within the virtual cluster should get synced to the host cluster.
ingresses:
# Enabled defines if this option should be enabled.
enabled: false
# PriorityClasses defines if priority classes created within the virtual cluster should get synced to the host cluster.
priorityClasses:
# Enabled defines if this option should be enabled.
enabled: false
# NetworkPolicies defines if network policies created within the virtual cluster should get synced to the host cluster.
networkPolicies:
# Enabled defines if this option should be enabled.
enabled: false
# VolumeSnapshots defines if volume snapshots created within the virtual cluster should get synced to the host cluster.
volumeSnapshots:
# Enabled defines if this option should be enabled.
enabled: false
# VolumeSnapshotContents defines if volume snapshot contents created within the virtual cluster should get synced to the host cluster.
volumeSnapshotContents:
# Enabled defines if this option should be enabled.
enabled: false
# PodDisruptionBudgets defines if pod disruption budgets created within the virtual cluster should get synced to the host cluster.
podDisruptionBudgets:
# Enabled defines if this option should be enabled.
enabled: false
# ServiceAccounts defines if service accounts created within the virtual cluster should get synced to the host cluster.
serviceAccounts:
# Enabled defines if this option should be enabled.
enabled: false
# StorageClasses defines if storage classes created within the virtual cluster should get synced to the host cluster.
storageClasses:
# Enabled defines if this option should be enabled.
enabled: false
# PersistentVolumes defines if persistent volumes created within the virtual cluster should get synced to the host cluster.
persistentVolumes:
# Enabled defines if this option should be enabled.
enabled: false
# Configure what resources vCluster should sync from the host cluster to the virtual cluster.
fromHost:
# Events defines if events should get synced from the host cluster to the virtual cluster, but not back.
events:
# Enabled defines if this option should be enabled.
enabled: true
# CSIDrivers defines if csi drivers should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled.
csiDrivers:
# Enabled defines if this option should be enabled.
enabled: auto
# CSINodes defines if csi nodes should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled.
csiNodes:
# Enabled defines if this option should be enabled.
enabled: auto
# CSIStorageCapacities defines if csi storage capacities should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled.
csiStorageCapacities:
# Enabled defines if this option should be enabled.
enabled: auto
# StorageClasses defines if storage classes should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled.
storageClasses:
# Enabled defines if this option should be enabled.
enabled: auto
# IngressClasses defines if ingress classes should get synced from the host cluster to the virtual cluster, but not back.
ingressClasses:
# Enabled defines if this option should be enabled.
enabled: false
# RuntimeClasses defines if runtime classes should get synced from the host cluster to the virtual cluster, but not back.
runtimeClasses:
# Enabled defines if this option should be enabled.
enabled: false
# PriorityClasses defines if priority classes classes should get synced from the host cluster to the virtual cluster, but not back.
priorityClasses:
# Enabled defines if this option should be enabled.
enabled: false
# Nodes defines if nodes should get synced from the host cluster to the virtual cluster, but not back.
nodes:
# Enabled specifies if syncing real nodes should be enabled. If this is disabled, vCluster will create fake nodes instead.
enabled: false
# SyncBackChanges enables syncing labels and taints from the virtual cluster to the host cluster. If this is enabled someone within the virtual cluster will be able to change the labels and taints of the host cluster node.
syncBackChanges: false
# ClearImageStatus will erase the image status when syncing a node. This allows to hide images that are pulled by the node.
clearImageStatus: false
# Selector can be used to define more granular what nodes should get synced from the host cluster to the virtual cluster.
selector:
# All specifies if all nodes should get synced by vCluster from the host to the virtual cluster or only the ones where pods are assigned to.
all: false
labels: {}
# VolumeSnapshotClasses defines if volume snapshot classes created within the virtual cluster should get synced to the host cluster.
volumeSnapshotClasses:
# Enabled defines if this option should be enabled.
enabled: false
# Configure vCluster's control plane components and deployment.
controlPlane:
# Distro holds virtual cluster related distro options. A distro cannot be changed after vCluster is deployed.
distro:
# K8S holds K8s relevant configuration.
k8s:
# Enabled specifies if the K8s distro should be enabled. Only one distro can be enabled at the same time.
enabled: false
# Version specifies k8s components (scheduler, kube-controller-manager & apiserver) version.
# It is a shortcut for controlPlane.distro.k8s.apiServer.image.tag,
# controlPlane.distro.k8s.controllerManager.image.tag and
# controlPlane.distro.k8s.scheduler.image.tag
# If e.g. controlPlane.distro.k8s.version is set to v1.30.1 and
# controlPlane.distro.k8s.scheduler.image.tag
# (or controlPlane.distro.k8s.controllerManager.image.tag or controlPlane.distro.k8s.apiServer.image.tag)
# is set to v1.31.0,
# value from controlPlane.distro.k8s.<controlPlane-component>.image.tag will be used
# (where <controlPlane-component is apiServer, controllerManager and scheduler).
version: ""
# APIServer holds configuration specific to starting the api server.
apiServer:
enabled: true
# Command is the command to start the distro binary. This will override the existing command.
command: []
# ExtraArgs are additional arguments to pass to the distro binary.
extraArgs: []
# ImagePullPolicy is the pull policy for the distro image
imagePullPolicy: ""
# Image is the distro image
image:
# Registry is the registry of the container image, e.g. my-registry.com or ghcr.io. This setting can be globally
# overridden via the controlPlane.advanced.defaultImageRegistry option. Empty means docker hub.
registry: registry.k8s.io
# Repository is the repository of the container image, e.g. my-repo/my-image
repository: kube-apiserver
# Tag is the tag of the container image, e.g. latest
tag: "v1.31.1"
# ControllerManager holds configuration specific to starting the controller manager.
controllerManager:
enabled: true
# Command is the command to start the distro binary. This will override the existing command.
command: []
# ExtraArgs are additional arguments to pass to the distro binary.
extraArgs: []
# ImagePullPolicy is the pull policy for the distro image
imagePullPolicy: ""
# Image is the distro image
image:
# Registry is the registry of the container image, e.g. my-registry.com or ghcr.io. This setting can be globally
# overridden via the controlPlane.advanced.defaultImageRegistry option. Empty means docker hub.
registry: registry.k8s.io
# Repository is the repository of the container image, e.g. my-repo/my-image
repository: "kube-controller-manager"
# Tag is the tag of the container image, e.g. latest
tag: "v1.31.1"
# Scheduler holds configuration specific to starting the scheduler. Enable this via controlPlane.advanced.virtualScheduler.enabled
scheduler:
# Command is the command to start the distro binary. This will override the existing command.
command: []
# ExtraArgs are additional arguments to pass to the distro binary.
extraArgs: []
# ImagePullPolicy is the pull policy for the distro image
imagePullPolicy: ""
# Image is the distro image
image:
# Registry is the registry of the container image, e.g. my-registry.com or ghcr.io. This setting can be globally
# overridden via the controlPlane.advanced.defaultImageRegistry option. Empty means docker hub.
registry: registry.k8s.io
# Repository is the repository of the container image, e.g. my-repo/my-image
repository: "kube-scheduler"
# Tag is the tag of the container image, e.g. latest
tag: "v1.31.1"
# Env are extra environment variables to use for the main container and NOT the init container.
env: []
# Security options can be used for the distro init container
securityContext: {}
# Resources for the distro init container
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 40m
memory: 64Mi
# K3S holds K3s relevant configuration.
k3s:
# Enabled specifies if the K3s distro should be enabled. Only one distro can be enabled at the same time.
enabled: false
# Command is the command to start the distro binary. This will override the existing command.
command: []
# ExtraArgs are additional arguments to pass to the distro binary.
extraArgs: []
# ImagePullPolicy is the pull policy for the distro image
imagePullPolicy: ""
# Image is the distro image
image:
# Registry is the registry of the container image, e.g. my-registry.com or ghcr.io. This setting can be globally
# overridden via the controlPlane.advanced.defaultImageRegistry option. Empty means docker hub.
registry: ""
# Repository is the repository of the container image, e.g. my-repo/my-image
repository: "rancher/k3s"
# Tag is the tag of the container image, e.g. latest
tag: "v1.31.1-k3s1"
# Security options can be used for the distro init container
securityContext: {}
# Resources for the distro init container
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 40m
memory: 64Mi
# K0S holds k0s relevant configuration.
k0s:
# Enabled specifies if the k0s distro should be enabled. Only one distro can be enabled at the same time.
enabled: false
# Config allows you to override the k0s config passed to the k0s binary.
config: ""
# Command is the command to start the distro binary. This will override the existing command.
command: []
# ExtraArgs are additional arguments to pass to the distro binary.
extraArgs: []
# ImagePullPolicy is the pull policy for the distro image
imagePullPolicy: ""
# Image is the distro image
image:
# Registry is the registry of the container image, e.g. my-registry.com or ghcr.io. This setting can be globally
# overridden via the controlPlane.advanced.defaultImageRegistry option. Empty means docker hub.
registry: ""
# Repository is the repository of the container image, e.g. my-repo/my-image
repository: "k0sproject/k0s"
# Tag is the tag of the container image, e.g. latest
tag: "v1.30.2-k0s.0"
# Security options can be used for the distro init container
securityContext: {}
# Resources for the distro init container
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 40m
memory: 64Mi
# BackingStore defines which backing store to use for virtual cluster. If not defined will use embedded database as a default backing store.
backingStore:
# Database defines that a database backend should be used as the backend for the virtual cluster. This uses a project called kine under the hood which is a shim for bridging Kubernetes and relational databases.
database:
# Embedded defines that an embedded database (sqlite) should be used as the backend for the virtual cluster
embedded:
# Enabled defines if the database should be used.
enabled: false
# External defines that an external database should be used as the backend for the virtual cluster
external:
# Enabled defines if the database should be used.
enabled: false
# DataSource is the kine dataSource to use for the database. This depends on the database format.
# This is optional for the embedded database. Examples:
# * mysql: mysql://username:password@tcp(hostname:3306)/k3s
# * postgres: postgres://username:password@hostname:5432/k3s
dataSource: ""
# Connector specifies a secret located in a connected vCluster Platform that contains database server connection information
# to be used by Platform to create a database and database user for the vCluster.
# and non-privileged user. A kine endpoint should be created using the database and user on Platform registration.
# This is optional.
connector: ""
# CertFile is the cert file to use for the database. This is optional.
certFile: ""
# KeyFile is the key file to use for the database. This is optional.
keyFile: ""
# CaFile is the ca file to use for the database. This is optional.
caFile: ""
# Etcd defines that etcd should be used as the backend for the virtual cluster
etcd:
# Embedded defines to use embedded etcd as a storage backend for the virtual cluster
embedded:
# Enabled defines if the embedded etcd should be used.
enabled: false
# MigrateFromDeployedEtcd signals that vCluster should migrate from the deployed external etcd to embedded etcd.
migrateFromDeployedEtcd: false
# Deploy defines to use an external etcd that is deployed by the helm chart
deploy:
# Enabled defines that an external etcd should be deployed.
enabled: false
# StatefulSet holds options for the external etcd statefulSet.
statefulSet:
# Enabled defines if the statefulSet should be deployed
enabled: true
# EnableServiceLinks for the StatefulSet pod
enableServiceLinks: true
annotations: {}
labels: {}
# Image is the image to use for the external etcd statefulSet
image:
# Registry is the registry of the container image, e.g. my-registry.com or ghcr.io. This setting can be globally
# overridden via the controlPlane.advanced.defaultImageRegistry option. Empty means docker hub.
registry: "registry.k8s.io"
# Repository is the repository of the container image, e.g. my-repo/my-image
repository: "etcd"
# Tag is the tag of the container image, e.g. latest
tag: "3.5.15-0"
# ImagePullPolicy is the pull policy for the external etcd image
imagePullPolicy: ""
# ExtraArgs are appended to the etcd command.
extraArgs: []
# Env are extra environment variables
env: []
# Resources the etcd can consume
resources:
# Requests are minimal resources that will be consumed by the container
requests:
cpu: 20m
memory: 150Mi
# Pods defines extra metadata for the etcd pods.
pods:
annotations: {}
labels: {}
# HighAvailability are high availability options
highAvailability:
# Replicas are the amount of pods to use.
replicas: 1
# Scheduling options for the etcd pods.
scheduling:
# PodManagementPolicy is the statefulSet pod management policy.
podManagementPolicy: Parallel
# NodeSelector is the node selector to apply to the pod.
nodeSelector: {}
# Affinity is the affinity to apply to the pod.
affinity: {}
# Tolerations are the tolerations to apply to the pod.
tolerations: []
# TopologySpreadConstraints are the topology spread constraints for the pod.
topologySpreadConstraints: []
# PriorityClassName is the priority class name for the the pod.
priorityClassName: ""
# Security options for the etcd pods.
security:
# PodSecurityContext specifies security context options on the pod level.
podSecurityContext: {}
# ContainerSecurityContext specifies security context options on the container level.
containerSecurityContext: {}
# Persistence options for the etcd pods.
persistence:
# VolumeClaim can be used to configure the persistent volume claim.
volumeClaim:
# Enabled enables deploying a persistent volume claim.
enabled: true
# RetentionPolicy is the persistent volume claim retention policy.
retentionPolicy: Retain
# Size is the persistent volume claim storage size.
size: 5Gi
# StorageClass is the persistent volume claim storage class.
storageClass: ""
# AccessModes are the persistent volume claim access modes.
accessModes: ["ReadWriteOnce"]
# VolumeClaimTemplates defines the volumeClaimTemplates for the statefulSet
volumeClaimTemplates: []
# AddVolumes defines extra volumes for the pod
addVolumes: []
# AddVolumeMounts defines extra volume mounts for the container
addVolumeMounts: []
# Service holds options for the external etcd service.
service:
enabled: true
annotations: {}
# HeadlessService holds options for the external etcd headless service.
headlessService:
enabled: true
annotations: {}
# Proxy defines options for the virtual cluster control plane proxy that is used to do authentication and intercept requests.
proxy:
# BindAddress under which vCluster will expose the proxy.
bindAddress: "0.0.0.0"
# Port under which vCluster will expose the proxy. Changing port is currently not supported.
port: 8443
# ExtraSANs are extra hostnames to sign the vCluster proxy certificate for.
extraSANs: []
# CoreDNS defines everything related to the coredns that is deployed and used within the vCluster.
coredns:
# Enabled defines if coredns is enabled
enabled: true
# Embedded defines if vCluster will start the embedded coredns service within the control-plane and not as a separate deployment. This is a PRO feature.
embedded: false
# OverwriteManifests can be used to overwrite the coredns manifests used to deploy coredns
overwriteManifests: ""
# OverwriteConfig can be used to overwrite the coredns config
overwriteConfig: ""
# PriorityClassName specifies the priority class name for the CoreDNS pods.
priorityClassName: ""
# Service holds extra options for the coredns service deployed within the virtual cluster
service:
annotations: {}
labels: {}
# Spec holds extra options for the coredns service
spec:
type: ClusterIP
# Deployment holds extra options for the coredns deployment deployed within the virtual cluster
deployment:
annotations: {}
labels: {}
# Image is the coredns image to use
image: ""
# Replicas is the amount of coredns pods to run.
replicas: 1
# Pods is additional metadata for the coredns pods.
pods:
labels: {}
annotations: {}
# NodeSelector is the node selector to use for coredns.
nodeSelector: {}
# Affinity is the affinity to apply to the pod.
affinity: {}
# Tolerations are the tolerations to apply to the pod.
tolerations: []
# Resources are the desired resources for coredns.
resources:
# Limits are resource limits for the container
limits:
cpu: 1000m
memory: 170Mi
# Requests are minimal resources that will be consumed by the container
requests:
cpu: 20m
memory: 64Mi
# TopologySpreadConstraints are the topology spread constraints for the CoreDNS pod.
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
k8s-app: kube-dns
# Service defines options for vCluster service deployed by Helm.
service:
# Enabled defines if the control plane service should be enabled
enabled: true
labels: {}
annotations: {}
# KubeletNodePort is the node port where the fake kubelet is exposed. Defaults to 0.
kubeletNodePort: 0
# HTTPSNodePort is the node port where https is exposed. Defaults to 0.
httpsNodePort: 0
# Spec allows you to configure extra service options.
spec:
type: ClusterIP
# Ingress defines options for vCluster ingress deployed by Helm.
ingress:
# Enabled defines if the control plane ingress should be enabled
enabled: false
# Host is the host where vCluster will be reachable
host: "my-host.com"
# PathType is the path type of the ingress
pathType: ImplementationSpecific
labels: {}
annotations:
nginx.ingress.kubernetes.io/backend-protocol: HTTPS
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
# Spec allows you to configure extra ingress options.
spec:
tls: []
# StatefulSet defines options for vCluster statefulSet deployed by Helm.
statefulSet:
labels: {}
annotations: {}
# ImagePullPolicy is the policy how to pull the image.
imagePullPolicy: ""
# Image is the image for the controlPlane statefulSet container
image:
# Configure the registry of the container image, e.g. my-registry.com or ghcr.io
# It defaults to ghcr.io and can be overriding either by using this field or controlPlane.advanced.defaultImageRegistry
registry: "ghcr.io"
# Configure the repository of the container image, e.g. my-repo/my-image.
# It defaults to the vCluster pro repository that includes the optional pro modules that are turned off by default.
# If you still want to use the pure OSS build, use 'loft-sh/vcluster-oss' instead.
repository: "loft-sh/vcluster-pro"
# Tag is the tag of the container image, e.g. latest
tag: ""
# WorkingDir specifies in what folder the main process should get started.
workingDir: ""
# Command allows you to override the main command.
command: []
# Args allows you to override the main arguments.
args: []
# Env are additional environment variables for the statefulSet container.
env: []
# Resources are the resource requests and limits for the statefulSet container.
resources:
# Limits are resource limits for the container
limits:
ephemeral-storage: 8Gi
memory: 2Gi
# Requests are minimal resources that will be consumed by the container
requests:
ephemeral-storage: 400Mi
cpu: 200m
memory: 256Mi
# Additional labels or annotations for the statefulSet pods.
pods:
labels: {}
annotations: {}
# HighAvailability holds options related to high availability.
highAvailability:
# Replicas is the amount of replicas to use for the statefulSet.
replicas: 1
# LeaseDuration is the time to lease for the leader.
leaseDuration: 60
# RenewDeadline is the deadline to renew a lease for the leader.
renewDeadline: 40
# RetryPeriod is the time until a replica will retry to get a lease.
retryPeriod: 15
# Security defines pod or container security context.
security:
# PodSecurityContext specifies security context options on the pod level.
podSecurityContext: {}
# ContainerSecurityContext specifies security context options on the container level.
containerSecurityContext:
allowPrivilegeEscalation: false
runAsUser: 0
runAsGroup: 0
# Persistence defines options around persistence for the statefulSet.
persistence:
# VolumeClaim can be used to configure the persistent volume claim.
volumeClaim:
# Enabled enables deploying a persistent volume claim. If auto, vCluster will automatically determine
# based on the chosen distro and other options if this is required.
enabled: auto
# RetentionPolicy is the persistent volume claim retention policy.
retentionPolicy: Retain
# Size is the persistent volume claim storage size.
size: 5Gi
# StorageClass is the persistent volume claim storage class.
storageClass: ""
# AccessModes are the persistent volume claim access modes.
accessModes: ["ReadWriteOnce"]
# VolumeClaimTemplates defines the volumeClaimTemplates for the statefulSet
volumeClaimTemplates: []
# AddVolumeMounts defines extra volume mounts for the container
addVolumeMounts: []
# AddVolumes defines extra volumes for the pod
addVolumes: []
# Allows you to override the dataVolume. Only works correctly if volumeClaim.enabled=false.
dataVolume: []
# BinariesVolume defines a binaries volume that is used to retrieve
# distro specific executables to be run by the syncer controller.
# This volume doesn't need to be persistent.
binariesVolume:
- name: binaries
emptyDir: {}
# EnableServiceLinks for the StatefulSet pod
enableServiceLinks: true
# Scheduling holds options related to scheduling.
scheduling:
# PodManagementPolicy is the statefulSet pod management policy.
podManagementPolicy: Parallel
# TopologySpreadConstraints are the topology spread constraints for the pod.
topologySpreadConstraints: []
# PriorityClassName is the priority class name for the the pod.
priorityClassName: ""
# NodeSelector is the node selector to apply to the pod.
nodeSelector: {}
# Affinity is the affinity to apply to the pod.
affinity: {}
# Tolerations are the tolerations to apply to the pod.
tolerations: []
# Probes enables or disables the main container probes.
probes:
# LivenessProbe specifies if the liveness probe for the container should be enabled
livenessProbe:
enabled: true
# ReadinessProbe specifies if the readiness probe for the container should be enabled
readinessProbe:
enabled: true
# StartupProbe specifies if the startup probe for the container should be enabled
startupProbe:
enabled: true
# ServiceMonitor can be used to automatically create a service monitor for vCluster deployment itself.
serviceMonitor:
# Enabled configures if Helm should create the service monitor.
enabled: false
labels: {}
annotations: {}
# Advanced holds additional configuration for the vCluster control plane.
advanced:
# DefaultImageRegistry will be used as a prefix for all internal images deployed by vCluster or Helm. This makes it easy to
# upload all required vCluster images to a single private repository and set this value. Workload images are not affected by this.
defaultImageRegistry: ""
# VirtualScheduler defines if a scheduler should be used within the virtual cluster or the scheduling decision for workloads will be made by the host cluster.
virtualScheduler:
enabled: false
# ServiceAccount specifies options for the vCluster control plane service account.
serviceAccount:
# Enabled specifies if the service account should get deployed.
enabled: true
# Name specifies what name to use for the service account.
name: ""
# ImagePullSecrets defines extra image pull secrets for the service account.
imagePullSecrets: []
labels: {}
annotations: {}
# WorkloadServiceAccount specifies options for the service account that will be used for the workloads that run within the virtual cluster.
workloadServiceAccount:
# Enabled specifies if the service account for the workloads should get deployed.
enabled: true
# Name specifies what name to use for the service account for the virtual cluster workloads.
name: ""
# ImagePullSecrets defines extra image pull secrets for the workload service account.
imagePullSecrets: []
annotations: {}
labels: {}
# HeadlessService specifies options for the headless service used for the vCluster StatefulSet.
headlessService:
labels: {}
annotations: {}
# GlobalMetadata is metadata that will be added to all resources deployed by Helm.
globalMetadata:
annotations: {}
# Integrations holds config for vCluster integrations with other operators or tools running on the host cluster
integrations:
# MetricsServer reuses the metrics server from the host cluster within the vCluster.
metricsServer:
# Enabled signals the metrics server integration should be enabled.
enabled: false
# Nodes defines if metrics-server nodes api should get proxied from host to virtual cluster.
nodes: true
# Pods defines if metrics-server pods api should get proxied from host to virtual cluster.
pods: true
# ExternalSecrets reuses a host external secret operator and makes certain CRDs from it available inside the vCluster
externalSecrets:
# Enabled defines whether the external secret integration is enabled or not
enabled: false
# Webhook defines whether the host webhooks are reused or not
webhook:
enabled: false
# Sync defines the syncing behavior for the integration
sync:
# ExternalSecrets defines whether to sync external secrets or not
externalSecrets:
enabled: true
# Stores defines whether to sync stores or not
stores:
enabled: false
# ClusterStores defines whether to sync cluster stores or not
clusterStores:
# Enabled defines if this option should be enabled.
enabled: false
# Selector defines what cluster stores should be synced
selector:
labels: {}
# KubeVirt reuses a host kubevirt and makes certain CRDs from it available inside the vCluster
kubeVirt:
# Enabled signals if the integration should be enabled
enabled: false
# Webhook holds configuration for enabling the webhook within the vCluster
webhook:
enabled: true
# Sync holds configuration on what resources to sync
sync:
# If DataVolumes should get synced
dataVolumes:
enabled: false
# If VirtualMachines should get synced
virtualMachines:
enabled: true
# If VirtualMachineInstances should get synced
virtualMachineInstances:
enabled: true
# If VirtualMachinePools should get synced
virtualMachinePools:
enabled: true
# If VirtualMachineClones should get synced
virtualMachineClones:
enabled: true
# If VirtualMachineInstanceMigrations should get synced
virtualMachineInstanceMigrations:
enabled: true
# RBAC options for the virtual cluster.
rbac:
# Role holds virtual cluster role configuration
role:
# Enabled defines if the role should be enabled or disabled.
enabled: true
# OverwriteRules will overwrite the role rules completely.
overwriteRules: []
# ExtraRules will add rules to the role.
extraRules: []
# ClusterRole holds virtual cluster cluster role configuration
clusterRole:
# Enabled defines if the cluster role should be enabled or disabled. If auto, vCluster automatically determines whether the virtual cluster requires a cluster role.
enabled: auto
# OverwriteRules will overwrite the cluster role rules completely.
overwriteRules: []
# ExtraRules will add rules to the cluster role.
extraRules: []
# Networking options related to the virtual cluster.
networking:
# ReplicateServices allows replicating services from the host within the virtual cluster or the other way around.
replicateServices:
# ToHost defines the services that should get synced from virtual cluster to the host cluster. If services are
# synced to a different namespace than the virtual cluster is in, additional permissions for the other namespace
# are required.
toHost: []
# FromHost defines the services that should get synced from the host to the virtual cluster.
fromHost: []
# ResolveDNS allows to define extra DNS rules. This only works if embedded coredns is configured.
resolveDNS: []
# Advanced holds advanced network options.
advanced:
# ClusterDomain is the Kubernetes cluster domain to use within the virtual cluster.
clusterDomain: "cluster.local"
# FallbackHostCluster allows to fallback dns to the host cluster. This is useful if you want to reach host services without
# any other modification. You will need to provide a namespace for the service, e.g. my-other-service.my-other-namespace
fallbackHostCluster: false
# ProxyKubelets allows rewriting certain metrics and stats from the Kubelet to "fake" this for applications such as
# prometheus or other node exporters.
proxyKubelets:
# ByHostname will add a special vCluster hostname to the nodes where the node can be reached at. This doesn't work
# for all applications, e.g. Prometheus requires a node IP.
byHostname: true
# ByIP will create a separate service in the host cluster for every node that will point to virtual cluster and will be used to
# route traffic.
byIP: true
# Policies to enforce for the virtual cluster deployment as well as within the virtual cluster.
policies:
# ResourceQuota specifies resource quota options.
resourceQuota:
# Enabled defines if the resource quota should be enabled. "auto" means that if limitRange is enabled,
# the resourceQuota will be enabled as well.
enabled: auto
labels: {}
annotations: {}
# Quota are the quota options
quota:
requests.cpu: 10
requests.memory: 20Gi
requests.storage: "100Gi"
requests.ephemeral-storage: 60Gi
limits.cpu: 20
limits.memory: 40Gi
limits.ephemeral-storage: 160Gi
services.nodeports: 0
services.loadbalancers: 1
count/endpoints: 40
count/pods: 20
count/services: 20
count/secrets: 100
count/configmaps: 100
count/persistentvolumeclaims: 20
# ScopeSelector is the resource quota scope selector
scopeSelector:
matchExpressions: []
# Scopes are the resource quota scopes
scopes: []
# LimitRange specifies limit range options.
limitRange:
# Enabled defines if the limit range should be deployed by vCluster. "auto" means that if resourceQuota is enabled,
# the limitRange will be enabled as well.
enabled: auto
labels: {}
annotations: {}
# Default are the default limits for the limit range
default:
ephemeral-storage: 8Gi
memory: 512Mi
cpu: "1"
# DefaultRequest are the default request options for the limit range
defaultRequest:
ephemeral-storage: 3Gi
memory: 128Mi
cpu: 100m
# Min are the min limits for the limit range
min: {}
# Max are the max limits for the limit range
max: {}
# NetworkPolicy specifies network policy options.
networkPolicy:
# Enabled defines if the network policy should be deployed by vCluster.
enabled: false
labels: {}
annotations: {}
fallbackDns: 8.8.8.8
outgoingConnections:
# Platform enables egress access towards loft platform
platform: true
# IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed
# to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs
# that should not be included within this rule.
ipBlock:
# cidr is a string representing the IPBlock
# Valid examples are "192.168.1.0/24" or "2001:db8::/64"
cidr: 0.0.0.0/0
# except is a slice of CIDRs that should not be included within an IPBlock
# Valid examples are "192.168.1.0/24" or "2001:db8::/64"
# Except values will be rejected if they are outside the cidr range
# +optional
except:
- 100.64.0.0/10
- 127.0.0.0/8
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
# CentralAdmission defines what validating or mutating webhooks should be enforced within the virtual cluster.
centralAdmission:
# ValidatingWebhooks are validating webhooks that should be enforced in the virtual cluster
validatingWebhooks: []
# MutatingWebhooks are mutating webhooks that should be enforced in the virtual cluster
mutatingWebhooks: []
# ExportKubeConfig describes how vCluster should export the vCluster kubeConfig file.
exportKubeConfig:
# Context is the name of the context within the generated kubeconfig to use.
context: ""
# Override the default https://localhost:8443 and specify a custom hostname for the generated kubeconfig.
server: ""
# If tls should get skipped for the server
insecure: false
# ServiceAccount can be used to generate a service account token instead of the default certificates.
serviceAccount:
# Name of the service account to be used to generate a service account token instead of the default certificates.
name: ""
# Namespace of the service account to be used to generate a service account token instead of the default certificates.
# If omitted, will use the kube-system namespace.
namespace: ""
# ClusterRole to assign to the service account.
clusterRole: ""
# Declare in which host cluster secret vCluster should store the generated virtual cluster kubeconfig.
# If this is not defined, vCluster will create it with `vc-NAME`. If you specify another name,
# vCluster creates the config in this other secret.
secret:
# Name is the name of the secret where the kubeconfig should get stored.
name: ""
# Namespace where vCluster should store the kubeconfig secret. If this is not equal to the namespace
# where you deployed vCluster, you need to make sure vCluster has access to this other namespace.
namespace: ""
# External holds configuration for tools that are external to the vCluster.
external: {}
# Define which vCluster plugins to load.
plugins: {}
# Experimental features for vCluster. Configuration here might change, so be careful with this.
experimental:
# MultiNamespaceMode tells virtual cluster to sync to multiple namespaces instead of a single one. This will map each virtual cluster namespace to a single namespace in the host cluster.
multiNamespaceMode:
# Enabled specifies if multi namespace mode should get enabled
enabled: false
# SyncSettings are advanced settings for the syncer controller.
syncSettings:
# DisableSync will not sync any resources and disable most control plane functionality.
disableSync: false
# RewriteKubernetesService will rewrite the Kubernetes service to point to the vCluster service if disableSync is enabled
rewriteKubernetesService: false
# TargetNamespace is the namespace where the workloads should get synced to.
targetNamespace: ""
# SetOwner specifies if vCluster should set an owner reference on the synced objects to the vCluster service. This allows for easy garbage collection.
setOwner: true
# IsolatedControlPlane is a feature to run the vCluster control plane in a different Kubernetes cluster than the workloads themselves.
isolatedControlPlane:
# Headless states that Helm should deploy the vCluster in headless mode for the isolated control plane.
headless: false
# Deploy allows you to configure manifests and Helm charts to deploy within the virtual cluster.
deploy:
# Host defines what manifests to deploy into the host cluster
host:
# Manifests are raw Kubernetes manifests that should get applied within the virtual cluster.
manifests: ""
# ManifestsTemplate is a Kubernetes manifest template that will be rendered with vCluster values before applying it within the virtual cluster.
manifestsTemplate: ""
# VCluster defines what manifests and charts to deploy into the vCluster
vcluster:
# Manifests are raw Kubernetes manifests that should get applied within the virtual cluster.
manifests: ""
# ManifestsTemplate is a Kubernetes manifest template that will be rendered with vCluster values before applying it within the virtual cluster.
manifestsTemplate: ""
# Helm are Helm charts that should get deployed into the virtual cluster
helm: []
# GenericSync holds options to generically sync resources from virtual cluster to host.
genericSync:
clusterRole:
extraRules: []
role:
extraRules: []
# Configuration related to telemetry gathered about vCluster usage.
telemetry:
# Enabled specifies that the telemetry for the vCluster control plane should be enabled.
enabled: true

View File

@@ -0,0 +1,13 @@
controlPlane:
advanced:
defaultImageRegistry: 192.168.2.43:31898
distro:
k8s:
version: v1.31.1
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 40m
memory: 64Mi

View File

@@ -0,0 +1,18 @@
controlPlane:
proxy:
extraSANs:
- 192.168.2.43
- 192.168.2.177
- 0.0.0.0
advanced:
defaultImageRegistry: 192.168.2.43:31898
distro:
k8s:
version: v1.31.6
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 40m
memory: 64Mi