Add rancher turtles charts

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
This commit is contained in:
Nicolas Belouin 2024-10-31 16:54:18 +01:00
parent 71bd51893e
commit b39277a6cb
42 changed files with 44830 additions and 0 deletions

View File

@ -0,0 +1,10 @@
#!BuildTag: %%IMG_PREFIX%%rancher-turtles-airgap-resources-chart:0.3.3
#!BuildTag: %%IMG_PREFIX%%rancher-turtles-airgap-resources-chart:0.3.3-%RELEASE%
apiVersion: v2
appVersion: 0.11.0
description: Rancher Turtles utility chart for airgap scenarios
home: https://github.com/rancher/turtles/
icon: https://raw.githubusercontent.com/rancher/turtles/main/logos/capi.svg
name: rancher-turtles-airgap-resources
type: application
version: 0.3.3

View File

@ -0,0 +1,26 @@
# Deploy Rancher Turtles in airgapped scenarios
To simplify deployment of the suse-edge rancher-turtles wrapper chart in airgapped scenarios
this chart deploys the corresponding ConfigMap resources, as described in the
[Rancher Turtles Documentation](https://turtles.docs.rancher.com/getting-started/air-gapped-environment)
In addition to installing the chart, it will be necessary to adjust the rancher-turtles chart values:
```
cluster-api-operator:
cluster-api:
core:
fetchConfig:
selector: "{\"matchLabels\": {\"provider-components\": \"core\"}}"
rke2:
bootstrap:
fetchConfig:
selector: "{\"matchLabels\": {\"provider-components\": \"rke2-bootstrap\"}}"
controlPlane:
fetchConfig:
selector: "{\"matchLabels\": {\"provider-components\": \"rke2-control-plane\"}}"
metal3:
infrastructure:
fetchConfig:
selector: "{\"matchLabels\": {\"provider-components\": \"metal3\"}}"
```

View File

@ -0,0 +1,8 @@
<services>
<service mode="buildtime" name="kiwi_metainfo_helper"/>
<service name="replace_using_env" mode="buildtime">
<param name="file">Chart.yaml</param>
<param name="eval">IMG_PREFIX=$(rpm --macros=/root/.rpmmacros -E %img_prefix)</param>
<param name="var">IMG_PREFIX</param>
</service>
</services>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
dependencies:
- name: cluster-api-operator
repository: https://kubernetes-sigs.github.io/cluster-api-operator
version: 0.12.0
digest: sha256:c167c074ca89ef7a520ec18a5afd380b9edaee513810aa3ac0e0bda51db9c526
generated: "2024-08-22T14:23:18.589443298Z"

View File

@ -0,0 +1,32 @@
#!BuildTag: %%IMG_PREFIX%%rancher-turtles-chart:0.3.3
#!BuildTag: %%IMG_PREFIX%%rancher-turtles-chart:0.3.3-%RELEASE%
annotations:
catalog.cattle.io/certified: rancher
catalog.cattle.io/display-name: Rancher Turtles - the Cluster API Extension
catalog.cattle.io/kube-version: '>= 1.23.0-0'
catalog.cattle.io/namespace: rancher-turtles-system
catalog.cattle.io/os: linux
catalog.cattle.io/permits-os: linux
catalog.cattle.io/rancher-version: '>= 2.9.0-1'
catalog.cattle.io/release-name: rancher-turtles
catalog.cattle.io/scope: management
catalog.cattle.io/type: cluster-tool
apiVersion: v2
appVersion: 0.11.0
dependencies:
- condition: cluster-api-operator.enabled
name: cluster-api-operator
repository: file://./charts/cluster-api-operator
version: 0.12.0
description: Rancher Turtles is an extension to Rancher that brings full Cluster API
integration to Rancher.
home: https://github.com/rancher/turtles/
icon: https://raw.githubusercontent.com/rancher/turtles/main/logos/capi.svg
keywords:
- rancher
- cluster-api
- capi
- provisioning
name: rancher-turtles
type: application
version: 0.3.3+up0.11.0

View File

@ -0,0 +1,5 @@
# Rancher Turtles Chart
This chart installs the Rancher Turtles operator and optionally the Cluster API Operator using Helm.
Checkout the [documentation](https://turtles.docs.rancher.com) for further information.

View File

@ -0,0 +1,6 @@
## Changes since test/v0.11.0
---
## :chart_with_upwards_trend: Overview
_Thanks to all our contributors!_ 😊

View File

@ -0,0 +1,15 @@
<services>
<service mode="buildtime" name="kiwi_metainfo_helper"/>
<service name="replace_using_env" mode="buildtime">
<param name="file">values.yaml</param>
<param name="eval">IMG_PREFIX=$(rpm --macros=/root/.rpmmacros -E %img_prefix)</param>
<param name="var">IMG_PREFIX</param>
<param name="eval">IMG_REPO=$(rpm --macros=/root/.rpmmacros -E %img_repo)</param>
<param name="var">IMG_REPO</param>
</service>
<service name="replace_using_env" mode="buildtime">
<param name="file">Chart.yaml</param>
<param name="eval">IMG_PREFIX=$(rpm --macros=/root/.rpmmacros -E %img_prefix)</param>
<param name="var">IMG_PREFIX</param>
</service>
</services>

View File

@ -0,0 +1,5 @@
# Rancher Turtles - The Cluster API Extension for Rancher
Rancher Turtles brings enhanced integration of Cluster API with Rancher.
For more information, including a getting started guide, see the [official documentation](https://turtles.docs.rancher.com).

View File

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,6 @@
apiVersion: v2
appVersion: 0.12.0
description: Cluster API Operator
name: cluster-api-operator
type: application
version: 0.12.0

View File

@ -0,0 +1,24 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "capi-operator.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "capi-operator.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,56 @@
# Addon provider
{{- if .Values.addon }}
{{- $addons := split ";" .Values.addon }}
{{- $addonNamespace := "" }}
{{- $addonName := "" }}
{{- $addonVersion := "" }}
{{- range $addon := $addons }}
{{- $addonArgs := split ":" $addon }}
{{- $addonArgsLen := len $addonArgs }}
{{- if eq $addonArgsLen 3 }}
{{- $addonNamespace = $addonArgs._0 }}
{{- $addonName = $addonArgs._1 }}
{{- $addonVersion = $addonArgs._2 }}
{{- else if eq $addonArgsLen 2 }}
{{- $addonNamespace = print $addonArgs._0 "-addon-system" }}
{{- $addonName = $addonArgs._0 }}
{{- $addonVersion = $addonArgs._1 }}
{{- else if eq $addonArgsLen 1 }}
{{- $addonNamespace = print $addonArgs._0 "-addon-system" }}
{{- $addonName = $addonArgs._0 }}
{{- else }}
{{- fail "addon provider argument should have the following format helm:v1.0.0 or mynamespace:helm:v1.0.0" }}
{{- end }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
"argocd.argoproj.io/sync-wave": "1"
name: {{ $addonNamespace }}
---
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: AddonProvider
metadata:
name: {{ $addonName }}
namespace: {{ $addonNamespace }}
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
"argocd.argoproj.io/sync-wave": "2"
{{- if or $addonVersion $.Values.secretName }}
spec:
{{- end}}
{{- if $addonVersion }}
version: {{ $addonVersion }}
{{- end }}
{{- if $.Values.secretName }}
secretName: {{ $.Values.secretName }}
{{- end }}
{{- if $.Values.secretNamespace }}
secretNamespace: {{ $.Values.secretNamespace }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,55 @@
# Bootstrap provider
{{- if .Values.bootstrap }}
{{- $bootstraps := split ";" .Values.bootstrap }}
{{- $bootstrapNamespace := "" }}
{{- $bootstrapName := "" }}
{{- $bootstrapVersion := "" }}
{{- range $bootstrap := $bootstraps }}
{{- $bootstrapArgs := split ":" $bootstrap }}
{{- $bootstrapArgsLen := len $bootstrapArgs }}
{{- if eq $bootstrapArgsLen 3 }}
{{- $bootstrapNamespace = $bootstrapArgs._0 }}
{{- $bootstrapName = $bootstrapArgs._1 }}
{{- $bootstrapVersion = $bootstrapArgs._2 }}
{{- else if eq $bootstrapArgsLen 2 }}
{{- $bootstrapNamespace = print $bootstrapArgs._0 "-bootstrap-system" }}
{{- $bootstrapName = $bootstrapArgs._0 }}
{{- $bootstrapVersion = $bootstrapArgs._1 }}
{{- else if eq $bootstrapArgsLen 1 }}
{{- $bootstrapNamespace = print $bootstrapArgs._0 "-bootstrap-system" }}
{{- $bootstrapName = $bootstrapArgs._0 }}
{{- else }}
{{- fail "bootstrap provider argument should have the following format kubeadm:v1.0.0 or mynamespace:kubeadm:v1.0.0" }}
{{- end }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
name: {{ $bootstrapNamespace }}
---
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: BootstrapProvider
metadata:
name: {{ $bootstrapName }}
namespace: {{ $bootstrapNamespace }}
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if or $bootstrapVersion $.Values.configSecret.name }}
spec:
{{- end}}
{{- if $bootstrapVersion }}
version: {{ $bootstrapVersion }}
{{- end }}
{{- if $.Values.configSecret.name }}
configSecret:
name: {{ $.Values.configSecret.name }}
{{- if $.Values.configSecret.namespace }}
namespace: {{ $.Values.configSecret.namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,55 @@
# Control plane provider
{{- if .Values.controlPlane }}
{{- $controlPlanes := split ";" .Values.controlPlane }}
{{- $controlPlaneNamespace := "" }}
{{- $controlPlaneName := "" }}
{{- $controlPlaneVersion := "" }}
{{- range $controlPlane := $controlPlanes }}
{{- $controlPlaneArgs := split ":" $controlPlane }}
{{- $controlPlaneArgsLen := len $controlPlaneArgs }}
{{- if eq $controlPlaneArgsLen 3 }}
{{- $controlPlaneNamespace = $controlPlaneArgs._0 }}
{{- $controlPlaneName = $controlPlaneArgs._1 }}
{{- $controlPlaneVersion = $controlPlaneArgs._2 }}
{{- else if eq $controlPlaneArgsLen 2 }}
{{- $controlPlaneNamespace = print $controlPlaneArgs._0 "-control-plane-system" }}
{{- $controlPlaneName = $controlPlaneArgs._0 }}
{{- $controlPlaneVersion = $controlPlaneArgs._1 }}
{{- else if eq $controlPlaneArgsLen 1 }}
{{- $controlPlaneNamespace = print $controlPlaneArgs._0 "-control-plane-system" }}
{{- $controlPlaneName = $controlPlaneArgs._0 }}
{{- else }}
{{- fail "controlplane provider argument should have the following format kubeadm:v1.0.0 or mynamespace:kubeadm:v1.0.0" }}
{{- end }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
name: {{ $controlPlaneNamespace }}
---
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: ControlPlaneProvider
metadata:
name: {{ $controlPlaneName }}
namespace: {{ $controlPlaneNamespace }}
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if or $controlPlaneVersion $.Values.configSecret.name }}
spec:
{{- end}}
{{- if $controlPlaneVersion }}
version: {{ $controlPlaneVersion }}
{{- end }}
{{- if $.Values.configSecret.name }}
configSecret:
name: {{ $.Values.configSecret.name }}
{{- if $.Values.configSecret.namespace }}
namespace: {{ $.Values.configSecret.namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,31 @@
{{- if or .Values.addon .Values.bootstrap .Values.controlPlane .Values.infrastructure }}
# Deploy core components if not specified
{{- if not .Values.core }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
name: capi-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: CoreProvider
metadata:
name: cluster-api
namespace: capi-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- with .Values.configSecret }}
spec:
configSecret:
name: {{ .name }}
{{- if .namespace }}
namespace: {{ .namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,63 @@
# Core provider
{{- if .Values.core }}
{{- $coreArgs := split ":" .Values.core }}
{{- $coreArgsLen := len $coreArgs }}
{{- $coreVersion := "" }}
{{- $coreNamespace := "" }}
{{- $coreName := "" }}
{{- $coreVersion := "" }}
{{- if eq $coreArgsLen 3 }}
{{- $coreNamespace = $coreArgs._0 }}
{{- $coreName = $coreArgs._1 }}
{{- $coreVersion = $coreArgs._2 }}
{{- else if eq $coreArgsLen 2 }}
{{- $coreNamespace = "capi-system" }}
{{- $coreName = $coreArgs._0 }}
{{- $coreVersion = $coreArgs._1 }}
{{- else if eq $coreArgsLen 1 }}
{{- $coreNamespace = "capi-system" }}
{{- $coreName = $coreArgs._0 }}
{{- else }}
{{- fail "core provider argument should have the following format cluster-api:v1.0.0 or mynamespace:cluster-api:v1.0.0" }}
{{- end }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
name: {{ $coreNamespace }}
---
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: CoreProvider
metadata:
name: {{ $coreName }}
namespace: {{ $coreNamespace }}
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
"argocd.argoproj.io/sync-wave": "2"
{{- if or $coreVersion $.Values.configSecret.name }}
spec:
{{- end}}
{{- if $coreVersion }}
version: {{ $coreVersion }}
{{- end }}
{{- if $.Values.manager }}
manager:
{{- if and $.Values.manager.featureGates $.Values.manager.featureGates.core }}
featureGates:
{{- range $key, $value := $.Values.manager.featureGates.core }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
{{- end }}
{{- if $.Values.configSecret.name }}
configSecret:
name: {{ $.Values.configSecret.name }}
{{- if $.Values.configSecret.namespace }}
namespace: {{ $.Values.configSecret.namespace }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,146 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "capi-operator.fullname" . }}
namespace: '{{ .Release.Namespace }}'
labels:
app: {{ template "capi-operator.name" . }}
app.kubernetes.io/name: {{ template "capi-operator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "controller"
control-plane: controller-manager
clusterctl.cluster.x-k8s.io/core: capi-operator
{{- with .Values.deploymentLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ template "capi-operator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "controller"
control-plane: controller-manager
clusterctl.cluster.x-k8s.io/core: capi-operator
{{- with .Values.strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
labels:
app: {{ template "capi-operator.name" . }}
app.kubernetes.io/name: {{ template "capi-operator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "controller"
control-plane: controller-manager
clusterctl.cluster.x-k8s.io/core: capi-operator
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: capi-operator-manager
automountServiceAccountToken: true
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- args:
{{- if .Values.logLevel }}
- --v={{ .Values.logLevel }}
{{- end }}
{{- if .Values.healthAddr }}
- --health-addr={{ .Values.healthAddr }}
{{- end }}
{{- if .Values.metricsBindAddr }}
- --metrics-bind-addr={{ .Values.metricsBindAddr }}
{{- end }}
{{- if .Values.diagnosticsAddress }}
- --diagnostics-address={{ .Values.diagnosticsAddress }}
{{- end }}
{{- if .Values.insecureDiagnostics }}
- --insecure-diagnostics={{ .Values.insecureDiagnostics }}
{{- end }}
{{- with .Values.leaderElection }}
- --leader-elect={{ .enabled }}
{{- if .leaseDuration }}
- --leader-elect-lease-duration={{ .leaseDuration }}
{{- end }}
{{- if .renewDeadline }}
- --leader-elect-renew-deadline={{ .renewDeadline }}
{{- end }}
{{- if .retryPeriod }}
- --leader-elect-retry-period={{ .retryPeriod }}
{{- end }}
{{- end }}
command:
- /manager
{{- with .Values.image.manager }}
image: "{{- if .registry -}}{{ .registry }}/{{- end -}}{{ .repository }}{{- if (.digest) -}} @{{ .digest }}{{- else -}}:{{ default $.Chart.AppVersion .tag }} {{- end -}}"
{{- end }}
imagePullPolicy: {{ .Values.image.manager.pullPolicy }}
name: manager
ports:
- containerPort: 9443
name: webhook-server
protocol: TCP
- containerPort: {{ ( split ":" $.Values.metricsBindAddr)._1 | int }}
name: metrics
protocol: TCP
{{- with .Values.resources.manager }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.env.manager }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.containerSecurityContext.manager }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumeMounts.manager }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
terminationGracePeriodSeconds: 10
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podDnsPolicy }}
dnsPolicy: {{ . }}
{{- end }}
{{- with .Values.podDnsConfig }}
dnsConfig:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@ -0,0 +1,64 @@
{{- if .Values.infrastructure }}
# Deploy bootstrap, and infrastructure components if not specified
{{- if not .Values.bootstrap }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
"argocd.argoproj.io/sync-wave": "1"
name: capi-kubeadm-bootstrap-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: BootstrapProvider
metadata:
name: kubeadm
namespace: capi-kubeadm-bootstrap-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
"argocd.argoproj.io/sync-wave": "2"
{{- with .Values.configSecret }}
spec:
configSecret:
name: {{ .name }}
{{- if .namespace }}
namespace: {{ .namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- if not .Values.controlPlane }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
"argocd.argoproj.io/sync-wave": "1"
name: capi-kubeadm-control-plane-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: ControlPlaneProvider
metadata:
name: kubeadm
namespace: capi-kubeadm-control-plane-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
"argocd.argoproj.io/sync-wave": "2"
{{- with .Values.configSecret }}
spec:
configSecret:
name: {{ .name }}
{{- if .namespace }}
namespace: {{ .namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,84 @@
{{- define "recursivePrinter" }}
{{- range $key, $value := . }}
{{- if kindIs "map" $value }}
{{ $key }}:
{{- include "recursivePrinter" $value | indent 2 }}
{{- else }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
{{- end }}
# Infrastructure providers
{{- if .Values.infrastructure }}
{{- $infrastructures := split ";" .Values.infrastructure }}
{{- $infrastructureNamespace := "" }}
{{- $infrastructureName := "" }}
{{- $infrastructureVersion := "" }}
{{- range $infrastructure := $infrastructures }}
{{- $infrastructureArgs := split ":" $infrastructure }}
{{- $infrastructureArgsLen := len $infrastructureArgs }}
{{- if eq $infrastructureArgsLen 3 }}
{{- $infrastructureNamespace = $infrastructureArgs._0 }}
{{- $infrastructureName = $infrastructureArgs._1 }}
{{- $infrastructureVersion = $infrastructureArgs._2 }}
{{- else if eq $infrastructureArgsLen 2 }}
{{- $infrastructureNamespace = print $infrastructureArgs._0 "-infrastructure-system" }}
{{- $infrastructureName = $infrastructureArgs._0 }}
{{- $infrastructureVersion = $infrastructureArgs._1 }}
{{- else if eq $infrastructureArgsLen 1 }}
{{- $infrastructureNamespace = print $infrastructureArgs._0 "-infrastructure-system" }}
{{- $infrastructureName = $infrastructureArgs._0 }}
{{- else }}
{{- fail "infrastructure provider argument should have the following format aws:v1.0.0 or mynamespace:aws:v1.0.0" }}
{{- end }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
"argocd.argoproj.io/sync-wave": "1"
name: {{ $infrastructureNamespace }}
---
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: InfrastructureProvider
metadata:
name: {{ $infrastructureName }}
namespace: {{ $infrastructureNamespace }}
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
"argocd.argoproj.io/sync-wave": "2"
{{- if or $infrastructureVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments }}
spec:
{{- end }}
{{- if $infrastructureVersion }}
version: {{ $infrastructureVersion }}
{{- end }}
{{- if $.Values.manager }}
manager:
{{- if and (kindIs "map" $.Values.manager.featureGates) (hasKey $.Values.manager.featureGates $infrastructureName) }}
{{- range $key, $value := $.Values.manager.featureGates }}
{{- if eq $key $infrastructureName }}
featureGates:
{{- range $k, $v := $value }}
{{ $k }}: {{ $v }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if $.Values.configSecret.name }}
configSecret:
name: {{ $.Values.configSecret.name }}
{{- if $.Values.configSecret.namespace }}
namespace: {{ $.Values.configSecret.namespace }}
{{- end }}
{{- end }}
{{- if $.Values.additionalDeployments }}
additionalDeployments:
{{- include "recursivePrinter" $.Values.additionalDeployments | indent 2 }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,69 @@
---
# ---
# Cluster API provider options
core: ""
bootstrap: ""
controlPlane: ""
infrastructure: ""
addon: ""
manager.featureGates: {}
# ---
# Common configuration secret options
configSecret: {}
# ---
# CAPI operator deployment options
logLevel: 2
replicaCount: 1
leaderElection:
enabled: true
image:
manager:
repository: registry.k8s.io/capi-operator/cluster-api-operator
tag: v0.12.0
pullPolicy: IfNotPresent
env:
manager: []
healthAddr: ":8081"
metricsBindAddr: "127.0.0.1:8080"
diagnosticsAddress: "8443"
insecureDiagnostics: false
imagePullSecrets: {}
resources:
manager:
limits:
cpu: 100m
memory: 150Mi
requests:
cpu: 100m
memory: 100Mi
containerSecurityContext: {}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
- ppc64le
- key: kubernetes.io/os
operator: In
values:
- linux
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
volumes:
- name: cert
secret:
defaultMode: 420
secretName: capi-operator-webhook-service-cert
volumeMounts:
manager:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true

View File

@ -0,0 +1,78 @@
namespace: rancher-turtles-system
questions:
- variable: rancherTurtles.features.default
default: "false"
description: "Customize install settings"
label: Customize install settings
type: boolean
show_subquestion_if: true
group: "Rancher Turtles Extra Settings"
subquestions:
- variable: cluster-api-operator.cert-manager.enabled
default: false
type: boolean
description: "Flag to enable or disable installation of cert-manager. If set to false then you will need to install cert-manager manually"
label: "Enable Cert Manager"
- variable: rancherTurtles.features.cluster-api-operator.cleanup
default: true
description: "Specify that the CAPI Operator post-delete cleanup job will be performed"
type: boolean
label: Cleanup CAPI Operator installation
group: "CAPI Operator cleanup settings"
show_subquestion_if: true
subquestions:
- variable: rancherTurtles.features.cluster-api-operator.kubectlImage
default: "rancher/kubectl:v1.30.3"
description: "Specify the image to use when cleaning up the Cluster API Operator manifests"
type: string
label: Cleanup Image
group: "CAPI Operator cleanup settings"
- variable: rancherTurtles.features.rancher-webhook.cleanup
default: true
description: "Specify that the Rancher embedded cluster api webhooks should be removed"
type: boolean
label: Cleanup Rancher Embedded CAPI Webhooks
group: "Rancher webhook cleanup settings"
show_subquestion_if: true
subquestions:
- variable: rancherTurtles.features.rancher-webhook.kubectlImage
default: "rancher/kubectl:v1.30.3"
description: "Specify the image to use when cleaning up the webhooks"
type: string
label: Webhook Cleanup Image
group: "Rancher webhook cleanup settings"
- variable: rancherTurtles.features.rancher-kubeconfigs.label
default: false
description: "(Experimental) Specify that the kubeconfigs generated by Rancher should be automatically patched to contain the CAPI expected labels"
type: boolean
label: Label Rancher Kubeconfigs
group: "Rancher Turtles Features Settings"
- variable: rancherTurtles.features.managementv3-cluster.enabled
default: true
description: "Use v3/management cluster manifest for import, instead of v1/provisioning"
type: boolean
label: Use management v3 cluster manifest
group: "Rancher Turtles Features Settings"
- variable: rancherTurtles.features.managementv3-cluster-migration.enabled
default: false
description: "Automatically migrate between provisioning and management clusters on upgrade"
type: boolean
label: All imported clusters will use new cluster manifest, replacing old cluster manifest.
group: "Rancher Turtles Features Settings"
- variable: cluster-api-operator.cluster-api.rke2.enabled
default: "true"
description: "Flag to enable or disable installation of the RKE2 provider for Cluster API. By default this is enabled."
label: "Enable RKE2 Provider"
type: boolean
- variable: rancherTurtles.features.propagate-labels.enabled
default: false
description: "(Experimental) Specify that the labels from CAPI should be propagated to Rancher"
type: boolean
label: Propagate CAPI Labels
group: "Rancher Turtles Features Settings"
- variable: rancherTurtles.features.addon-provider-fleet.enabled
default: false
description: "Enable Fleet Addon Provider functionality in Rancher Turtles"
type: boolean
label: Seamless integration with Fleet and CAPI
group: "Rancher Turtles Features Settings"

View File

@ -0,0 +1,44 @@
{{- if index .Values "rancherTurtles" "features" "addon-provider-fleet" "enabled" }}
---
apiVersion: turtles-capi.cattle.io/v1alpha1
kind: CAPIProvider
metadata:
name: fleet
namespace: '{{ .Values.rancherTurtles.namespace }}'
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "2"
spec:
type: addon
additionalManifests:
name: fleet-addon-config
namespace: '{{ .Values.rancherTurtles.namespace }}'
---
apiVersion: v1
kind: ConfigMap
metadata:
name: fleet-addon-config
namespace: '{{ .Values.rancherTurtles.namespace }}'
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "2"
data:
manifests: |-
apiVersion: addons.cluster.x-k8s.io/v1alpha1
kind: FleetAddonConfig
metadata:
name: fleet-addon-config
spec:
clusterClass:
patchResource: true
setOwnerReferences: true
cluster:
patchResource: true
setOwnerReferences: true
selector:
matchLabels:
cluster-api.cattle.io/rancher-auto-import: "true"
namespaceSelector:
matchLabels:
cluster-api.cattle.io/rancher-auto-import: "true"
{{- end }}

View File

@ -0,0 +1,19 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: caprke2-azure-aggregated-role
labels:
cluster.x-k8s.io/aggregate-to-capz-manager: "true"
rules:
- apiGroups:
- bootstrap.cluster.x-k8s.io
resources:
- rke2configs
verbs:
- create
- update
- delete
- get
- list
- patch
- watch

View File

@ -0,0 +1,34 @@
{{- if index .Values "cluster-api-operator" "enabled" }}
apiVersion: v1
kind: ConfigMap
metadata:
name: clusterctl-config
namespace: '{{ .Values.rancherTurtles.namespace }}'
data:
clusterctl.yaml: |
providers:
# Cluster API core provider
- name: "cluster-api"
url: "https://github.com/kubernetes-sigs/cluster-api/releases/v1.7.5/core-components.yaml"
type: "CoreProvider"
# Infrastructure providers
- name: "metal3"
url: "https://github.com/metal3-io/cluster-api-provider-metal3/releases/v1.7.1/infrastructure-components.yaml"
type: "InfrastructureProvider"
# Bootstrap providers
- name: "rke2"
url: "https://github.com/rancher/cluster-api-provider-rke2/releases/v0.7.0/bootstrap-components.yaml"
type: "BootstrapProvider"
# ControlPlane providers
- name: "rke2"
url: "https://github.com/rancher/cluster-api-provider-rke2/releases/v0.7.0/control-plane-components.yaml"
type: "ControlPlaneProvider"
# Addon providers
# - name: "fleet"
# url: "https://github.com/rancher-sandbox/cluster-api-addon-provider-fleet/releases/v0.3.1/addon-components.yaml"
# type: "AddonProvider"
{{- end }}

View File

@ -0,0 +1,82 @@
{{- if index .Values "cluster-api-operator" "cluster-api" "enabled" }}
{{- $namespace := index .Values "cluster-api-operator" "cluster-api" "core" "namespace" }}
{{- if not (lookup "v1" "Namespace" "" $namespace) }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "1"
name: {{ index .Values "cluster-api-operator" "cluster-api" "core" "namespace" }}
{{- end }}
---
apiVersion: turtles-capi.cattle.io/v1alpha1
kind: CAPIProvider
metadata:
name: cluster-api
namespace: {{ index .Values "cluster-api-operator" "cluster-api" "core" "namespace" }}
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "2"
spec:
name: cluster-api
type: core
version: {{ index .Values "cluster-api-operator" "cluster-api" "version" }}
additionalManifests:
name: capi-additional-rbac-roles
namespace: {{ index .Values "cluster-api-operator" "cluster-api" "core" "namespace" }}
configSecret:
{{- if index .Values "cluster-api-operator" "cluster-api" "configSecret" "name" }}
name: {{ index .Values "cluster-api-operator" "cluster-api" "configSecret" "name" }}
{{ else }}
name: {{ index .Values "cluster-api-operator" "cluster-api" "configSecret" "defaultName" }}
{{- end }}
{{- if or (index .Values "cluster-api-operator" "cluster-api" "core" "fetchConfig" "url") (index .Values "cluster-api-operator" "cluster-api" "core" "fetchConfig" "selector") }}
fetchConfig:
{{- if index .Values "cluster-api-operator" "cluster-api" "core" "fetchConfig" "url" }}
url: {{ index .Values "cluster-api-operator" "cluster-api" "core" "fetchConfig" "url" }}
{{- end }}
{{- if index .Values "cluster-api-operator" "cluster-api" "core" "fetchConfig" "selector" }}
selector: {{ index .Values "cluster-api-operator" "cluster-api" "core" "fetchConfig" "selector" }}
{{- end }}
{{- end }}
{{- if index .Values "cluster-api-operator" "cluster-api" "core" "imageUrl" }}
deployment:
containers:
- name: manager
imageUrl: {{ index .Values "cluster-api-operator" "cluster-api" "core" "imageUrl" }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: capi-additional-rbac-roles
namespace: {{ index .Values "cluster-api-operator" "cluster-api" "core" "namespace" }}
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "2"
data:
manifests: |-
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: provisioning-rke-cattle-io
labels:
cluster.x-k8s.io/aggregate-to-manager: "true"
rules:
- apiGroups: ["rke.cattle.io"]
resources: ["*"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: provisioning-rke-machine-cattle-io
labels:
cluster.x-k8s.io/aggregate-to-manager: "true"
rules:
- apiGroups: ["rke-machine.cattle.io"]
resources: ["*"]
verbs: ["*"]
{{- end }}

View File

@ -0,0 +1,80 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
control-plane: controller-manager
name: rancher-turtles-controller-manager
namespace: '{{ .Values.rancherTurtles.namespace }}'
spec:
replicas: 1
selector:
matchLabels:
control-plane: controller-manager
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
control-plane: controller-manager
spec:
{{- if .Values.rancherTurtles.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.rancherTurtles.imagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
containers:
- args:
- --leader-elect
- --feature-gates=etcd-snapshot-restore={{ index .Values "rancherTurtles" "features" "etcd-snapshot-restore" "enabled"}},propagate-labels={{ index .Values "rancherTurtles" "features" "propagate-labels" "enabled"}},managementv3-cluster={{ index .Values "rancherTurtles" "features" "managementv3-cluster" "enabled"}},rancher-kube-secret-patch={{ index .Values "rancherTurtles" "features" "rancher-kubeconfigs" "label"}}
{{- range .Values.rancherTurtles.managerArguments }}
- {{ . }}
{{- end }}
command:
- /manager
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
{{- if (contains "sha256:" .Values.rancherTurtles.imageVersion) }}
image: '{{ .Values.rancherTurtles.image }}@{{ .Values.rancherTurtles.imageVersion }}'
{{- else }}
image: '{{ .Values.rancherTurtles.image }}:{{ .Values.rancherTurtles.imageVersion }}'
{{- end}}
imagePullPolicy: '{{ .Values.rancherTurtles.imagePullPolicy }}'
livenessProbe:
httpGet:
path: /healthz
port: 9440
initialDelaySeconds: 15
periodSeconds: 20
name: manager
readinessProbe:
httpGet:
path: /readyz
port: 9440
initialDelaySeconds: 5
periodSeconds: 10
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 10m
memory: 64Mi
serviceAccountName: rancher-turtles-manager
terminationGracePeriodSeconds: 10
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane

View File

@ -0,0 +1,55 @@
{{- if and (index .Values "cluster-api-operator" "cluster-api" "enabled") (index .Values "cluster-api-operator" "cluster-api" "metal3" "enabled") }}
{{- $namespace := index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "namespace" }}
{{- if not (lookup "v1" "Namespace" "" $namespace) }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "1"
name: {{ index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "namespace" }}
{{- end }}
---
apiVersion: turtles-capi.cattle.io/v1alpha1
kind: CAPIProvider
metadata:
name: metal3
namespace: {{ index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "namespace" }}
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "2"
spec:
name: metal3
type: infrastructure
{{- if index .Values "cluster-api-operator" "cluster-api" "rke2" "version" }}
version: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "version" }}
{{- end }}
configSecret:
{{- if index .Values "cluster-api-operator" "cluster-api" "configSecret" "name" }}
name: {{ index .Values "cluster-api-operator" "cluster-api" "configSecret" "name" }}
{{ else }}
name: {{ index .Values "cluster-api-operator" "cluster-api" "configSecret" "defaultName" }}
{{- end }}
{{- if or (index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "fetchConfig" "url") (index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "fetchConfig" "selector") }}
fetchConfig:
{{- if index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "fetchConfig" "url" }}
url: {{ index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "fetchConfig" "url" }}
{{- end }}
{{- if index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "fetchConfig" "selector" }}
selector: {{ index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "fetchConfig" "selector" }}
{{- end }}
{{- end }}
{{- if index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "imageUrl" }}
deployment:
containers:
- name: manager
imageUrl: {{ index .Values "cluster-api-operator" "cluster-api" "metal3" "infrastructure" "imageUrl" }}
additionalDeployments:
ipam-controller-manager:
deployment:
containers:
- imageUrl: {{ index .Values "cluster-api-operator" "cluster-api" "metal3" "ipam" "imageUrl" }}
name: manager
{{- end }}
{{- end }}

View File

@ -0,0 +1,166 @@
{{- if index .Values "rancherTurtles" "features" "cluster-api-operator" "cleanup" }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: post-delete-job
namespace: '{{ .Values.rancherTurtles.namespace }}'
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-weight": "1"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: post-delete-job-delete-webhooks
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-weight": "1"
rules:
- apiGroups:
- admissionregistration.k8s.io
resources:
- validatingwebhookconfigurations
- mutatingwebhookconfigurations
verbs:
- delete
- apiGroups:
- apps
resources:
- deployments
verbs:
- delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: post-delete-job-webhook-cleanup
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-weight": "1"
subjects:
- kind: ServiceAccount
name: post-delete-job
namespace: rancher-turtles-system
roleRef:
kind: ClusterRole
name: post-delete-job-delete-webhooks
apiGroup: rbac.authorization.k8s.io
---
apiVersion: batch/v1
kind: Job
metadata:
name: cluster-api-operator-mutatingwebhook-cleanup
namespace: '{{ .Values.rancherTurtles.namespace }}'
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-weight": "2"
spec:
ttlSecondsAfterFinished: 300
template:
spec:
serviceAccountName: post-delete-job
containers:
- name: cluster-api-operator-mutatingwebhook-cleanup
image: {{ index .Values "rancherTurtles" "features" "cluster-api-operator" "kubectlImage" }}
command: ["kubectl"]
args:
- delete
- mutatingwebhookconfigurations.admissionregistration.k8s.io
- capi-mutating-webhook-configuration
- capi-kubeadm-bootstrap-mutating-webhook-configuration
- capi-kubeadm-control-plane-mutating-webhook-configuration
- rke2-bootstrap-mutating-webhook-configuration
- rke2-control-plane-mutating-webhook-configuration
- --ignore-not-found=true
restartPolicy: Never
---
apiVersion: batch/v1
kind: Job
metadata:
name: cluster-api-operator-validatingwebhook-cleanup
namespace: '{{ .Values.rancherTurtles.namespace }}'
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-weight": "2"
spec:
ttlSecondsAfterFinished: 300
template:
spec:
serviceAccountName: post-delete-job
containers:
- name: cluster-api-operator-validatingwebhook-cleanup
image: {{ index .Values "rancherTurtles" "features" "cluster-api-operator" "kubectlImage" }}
command: ["kubectl"]
args:
- delete
- validatingwebhookconfigurations.admissionregistration.k8s.io
- capi-validating-webhook-configuration
- capi-kubeadm-bootstrap-validating-webhook-configuration
- capi-kubeadm-control-plane-validating-webhook-configuration
- rke2-bootstrap-validating-webhook-configuration
- rke2-control-plane-validating-webhook-configuration
- --ignore-not-found=true
restartPolicy: Never
---
apiVersion: batch/v1
kind: Job
metadata:
name: cluster-api-operator-deployment-cleanup
namespace: '{{ .Values.rancherTurtles.namespace }}'
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-weight": "2"
spec:
ttlSecondsAfterFinished: 300
template:
spec:
serviceAccountName: post-delete-job
restartPolicy: Never
containers:
- name: delete-capi-controller-manager
image: {{ index .Values "rancherTurtles" "features" "cluster-api-operator" "kubectlImage" }}
command: ["kubectl"]
args:
- delete
- deployments.apps/capi-controller-manager
- -n
- {{ index .Values "cluster-api-operator" "cluster-api" "core" "namespace" }}
- --ignore-not-found=true
- name: delete-capi-kubeadm-bootstrap-controller-manager
image: {{ index .Values "rancherTurtles" "features" "cluster-api-operator" "kubectlImage" }}
command: ["kubectl"]
args:
- delete
- deployments.apps/capi-kubeadm-bootstrap-controller-manager
- -n
- capi-kubeadm-bootstrap-system
- --ignore-not-found=true
- name: delete-capi-kubeadm-control-plane-controller-manager
image: {{ index .Values "rancherTurtles" "features" "cluster-api-operator" "kubectlImage" }}
command: ["kubectl"]
args:
- delete
- deployments.apps/capi-kubeadm-control-plane-controller-manager
- -n
- capi-kubeadm-control-plane-system
- --ignore-not-found=true
- name: delete-rke2-kubeadm-bootstrap-controller-manager
image: {{ index .Values "rancherTurtles" "features" "cluster-api-operator" "kubectlImage" }}
command: ["kubectl"]
args:
- delete
- deployments.apps/rke2-bootstrap-controller-manager
- -n
- {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "namespace" }}
- --ignore-not-found=true
- name: delete-rke2-control-plane-controller-manager
image: {{ index .Values "rancherTurtles" "features" "cluster-api-operator" "kubectlImage" }}
command: ["kubectl"]
args:
- delete
- deployments.apps/rke2-control-plane-controller-manager
- -n
- {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "namespace" }}
- --ignore-not-found=true
{{- end }}

View File

@ -0,0 +1,78 @@
{{- if eq (index .Values "rancherTurtles" "features" "managementv3-cluster-migration" "enabled") true }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: post-upgrade-job
namespace: rancher-turtles-system
annotations:
"helm.sh/hook": post-upgrade
"helm.sh/hook-weight": "1"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: post-upgrade-job-delete-clusters
annotations:
"helm.sh/hook": post-upgrade
"helm.sh/hook-weight": "1"
rules:
- apiGroups:
- provisioning.cattle.io
resources:
- clusters
verbs:
- list
- delete
- apiGroups:
- management.cattle.io
resources:
- clusters
verbs:
- list
- delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: post-upgrade-job-delete-clusters
annotations:
"helm.sh/hook": post-upgrade
"helm.sh/hook-weight": "1"
subjects:
- kind: ServiceAccount
name: post-upgrade-job
namespace: rancher-turtles-system
roleRef:
kind: ClusterRole
name: post-upgrade-job-delete-clusters
apiGroup: rbac.authorization.k8s.io
---
apiVersion: batch/v1
kind: Job
metadata:
name: post-upgrade-delete-clusters
annotations:
"helm.sh/hook": post-upgrade
"helm.sh/hook-weight": "2"
spec:
ttlSecondsAfterFinished: 300
template:
spec:
serviceAccountName: post-upgrade-job
containers:
- name: post-upgrade-delete-clusters
image: {{ index .Values "rancherTurtles" "features" "rancher-webhook" "kubectlImage" }}
args:
- delete
{{- if eq (index .Values "rancherTurtles" "features" "managementv3-cluster" "enabled") true }}
- clusters.provisioning.cattle.io
{{- else }}
- clusters.management.cattle.io
{{- end }}
- --selector=cluster-api.cattle.io/owned
- -A
- --ignore-not-found=true
- --wait
restartPolicy: OnFailure
{{- end }}

View File

@ -0,0 +1,67 @@
{{- if index .Values "rancherTurtles" "features" "rancher-webhook" "cleanup" }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: pre-delete-job
namespace: rancher-turtles-system
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-weight": "-2"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: pre-delete-job-delete-capiproviders
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-weight": "-2"
rules:
- apiGroups:
- turtles-capi.cattle.io
resources:
- capiproviders
verbs:
- list
- delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: pre-delete-job-capiprovider-cleanup
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-weight": "-2"
subjects:
- kind: ServiceAccount
name: pre-delete-job
namespace: rancher-turtles-system
roleRef:
kind: ClusterRole
name: pre-delete-job-delete-capiproviders
apiGroup: rbac.authorization.k8s.io
---
apiVersion: batch/v1
kind: Job
metadata:
name: rancher-capiprovider-cleanup
namespace: rancher-turtles-system
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-weight": "-1"
spec:
ttlSecondsAfterFinished: 300
template:
spec:
serviceAccountName: pre-delete-job
containers:
- name: rancher-capiprovider-cleanup
image: {{ index .Values "rancherTurtles" "features" "rancher-webhook" "kubectlImage" }}
args:
- delete
- capiproviders
- -A
- --all
- --cascade=foreground
restartPolicy: Never
{{- end }}

View File

@ -0,0 +1,99 @@
{{- if index .Values "rancherTurtles" "features" "embedded-capi" "disabled" }}
---
apiVersion: management.cattle.io/v3
kind: Feature
metadata:
name: embedded-cluster-api
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
spec:
value: false
{{- end }}
{{- if index .Values "rancherTurtles" "features" "rancher-webhook" "cleanup" }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: pre-install-job
namespace: rancher-turtles-system
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: pre-install-job-delete-webhooks
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
rules:
- apiGroups:
- admissionregistration.k8s.io
resources:
- validatingwebhookconfigurations
- mutatingwebhookconfigurations
verbs:
- delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: pre-install-job-webhook-cleanup
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
subjects:
- kind: ServiceAccount
name: pre-install-job
namespace: rancher-turtles-system
roleRef:
kind: ClusterRole
name: pre-install-job-delete-webhooks
apiGroup: rbac.authorization.k8s.io
---
apiVersion: batch/v1
kind: Job
metadata:
name: rancher-mutatingwebhook-cleanup
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "2"
spec:
ttlSecondsAfterFinished: 300
template:
spec:
serviceAccountName: pre-install-job
containers:
- name: rancher-mutatingwebhook-cleanup
image: {{ index .Values "rancherTurtles" "features" "rancher-webhook" "kubectlImage" }}
args:
- delete
- mutatingwebhookconfigurations.admissionregistration.k8s.io
- mutating-webhook-configuration
- --ignore-not-found=true
restartPolicy: Never
---
apiVersion: batch/v1
kind: Job
metadata:
name: rancher-validatingwebhook-cleanup
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "2"
spec:
ttlSecondsAfterFinished: 300
template:
spec:
serviceAccountName: pre-install-job
containers:
- name: rancher-validatingwebhook-cleanup
image: {{ index .Values "rancherTurtles" "features" "rancher-webhook" "kubectlImage" }}
args:
- delete
- validatingwebhookconfigurations.admissionregistration.k8s.io
- validating-webhook-configuration
- --ignore-not-found=true
restartPolicy: Never
{{- end }}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,123 @@
{{- if index .Values "rancherTurtles" "features" "etcd-snapshot-restore" "enabled" }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: etcdmachinesnapshots.turtles-capi.cattle.io
spec:
group: turtles-capi.cattle.io
names:
kind: EtcdMachineSnapshot
listKind: EtcdMachineSnapshotList
plural: etcdmachinesnapshots
singular: etcdmachinesnapshot
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: EtcdMachineSnapshot is the Schema for the EtcdMachineSnapshot
API.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: EtcdMachineSnapshotSpec defines the desired state of EtcdMachineSnapshot.
properties:
foo:
type: string
required:
- foo
type: object
status:
default: {}
description: EtcdMachineSnapshotStatus defines observed state of EtcdMachineSnapshot.
properties:
bar:
type: string
required:
- bar
type: object
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: etcdsnapshotrestores.turtles-capi.cattle.io
spec:
group: turtles-capi.cattle.io
names:
kind: EtcdSnapshotRestore
listKind: EtcdSnapshotRestoreList
plural: etcdsnapshotrestores
singular: etcdsnapshotrestore
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: EtcdSnapshotRestore is the schema for the EtcdSnapshotRestore
API.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: EtcdSnapshotRestoreSpec defines the desired state of EtcdSnapshotRestore.
properties:
foo:
type: string
required:
- foo
type: object
status:
default: {}
description: EtcdSnapshotRestoreStatus defines observed state of EtcdSnapshotRestore.
properties:
bar:
type: string
required:
- bar
type: object
type: object
served: true
storage: true
subresources:
status: {}
{{- end }}

View File

@ -0,0 +1,49 @@
{{- if and (index .Values "cluster-api-operator" "cluster-api" "enabled") (index .Values "cluster-api-operator" "cluster-api" "rke2" "enabled") }}
{{- $namespace := index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "namespace" }}
{{- if not (lookup "v1" "Namespace" "" $namespace) }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "1"
name: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "namespace" }}
{{- end }}
---
apiVersion: turtles-capi.cattle.io/v1alpha1
kind: CAPIProvider
metadata:
name: rke2-bootstrap
namespace: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "namespace" }}
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "2"
spec:
name: rke2
type: bootstrap
{{- if index .Values "cluster-api-operator" "cluster-api" "rke2" "version" }}
version: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "version" }}
{{- end }}
configSecret:
{{- if index .Values "cluster-api-operator" "cluster-api" "configSecret" "name" }}
name: {{ index .Values "cluster-api-operator" "cluster-api" "configSecret" "name" }}
{{ else }}
name: {{ index .Values "cluster-api-operator" "cluster-api" "configSecret" "defaultName" }}
{{- end }}
{{- if or (index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "fetchConfig" "url") (index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "fetchConfig" "selector") }}
fetchConfig:
{{- if index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "fetchConfig" "url" }}
url: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "fetchConfig" "url" }}
{{- end }}
{{- if index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "fetchConfig" "selector" }}
selector: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "fetchConfig" "selector" }}
{{- end }}
{{- end }}
{{- if index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "imageUrl" }}
deployment:
containers:
- name: manager
imageUrl: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "bootstrap" "imageUrl" }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,49 @@
{{- if and (index .Values "cluster-api-operator" "cluster-api" "enabled") (index .Values "cluster-api-operator" "cluster-api" "rke2" "enabled") }}
{{- $namespace := index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "namespace" }}
{{- if not (lookup "v1" "Namespace" "" $namespace) }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "1"
name: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "namespace" }}
{{- end }}
---
apiVersion: turtles-capi.cattle.io/v1alpha1
kind: CAPIProvider
metadata:
name: rke2-control-plane
namespace: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "namespace" }}
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "2"
spec:
name: rke2
type: controlPlane
{{- if index .Values "cluster-api-operator" "cluster-api" "rke2" "version" }}
version: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "version" }}
{{- end }}
configSecret:
{{- if index .Values "cluster-api-operator" "cluster-api" "configSecret" "name" }}
name: {{ index .Values "cluster-api-operator" "cluster-api" "configSecret" "name" }}
{{ else }}
name: {{ index .Values "cluster-api-operator" "cluster-api" "configSecret" "defaultName" }}
{{- end }}
{{- if or (index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "fetchConfig" "url") (index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "fetchConfig" "selector") }}
fetchConfig:
{{- if index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "fetchConfig" "url" }}
url: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "fetchConfig" "url" }}
{{- end }}
{{- if index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "fetchConfig" "selector" }}
selector: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "fetchConfig" "selector" }}
{{- end }}
{{- end }}
{{- if index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "imageUrl" }}
deployment:
containers:
- name: manager
imageUrl: {{ index .Values "cluster-api-operator" "cluster-api" "rke2" "controlPlane" "imageUrl" }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,90 @@
rancherTurtles:
image: registry.rancher.com/rancher/rancher/turtles
imageVersion: v0.11.0
imagePullPolicy: IfNotPresent
namespace: rancher-turtles-system
managerArguments: []
imagePullSecrets: []
features:
cluster-api-operator:
cleanup: true
kubectlImage: rancher/kubectl:v1.30.3
embedded-capi:
disabled: false
rancher-webhook:
cleanup: false
kubectlImage: rancher/kubectl:v1.30.3
rancher-kubeconfigs:
label: false
managementv3-cluster:
enabled: true
managementv3-cluster-migration:
enabled: false
propagate-labels:
enabled: false
etcd-snapshot-restore:
enabled: false
addon-provider-fleet:
enabled: false
cluster-api-operator:
enabled: true
cert-manager:
enabled: false
image:
manager:
repository: "%%IMG_REPO%%/%%IMG_PREFIX%%cluster-api-operator"
tag: 0.12.0
volumes:
- name: cert
secret:
defaultMode: 420
secretName: capi-operator-webhook-service-cert
- name: clusterctl-config
configMap:
name: clusterctl-config
volumeMounts:
manager:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
- mountPath: /config
name: clusterctl-config
readOnly: true
cluster-api:
enabled: true
configSecret:
name: ""
defaultName: capi-env-variables
core:
namespace: capi-system
imageUrl: "%%IMG_REPO%%/%%IMG_PREFIX%%cluster-api-controller:1.7.5"
fetchConfig:
url: ""
selector: ""
rke2:
enabled: true
version: ""
bootstrap:
namespace: rke2-bootstrap-system
imageUrl: "%%IMG_REPO%%/%%IMG_PREFIX%%cluster-api-provider-rke2-bootstrap:0.7.1"
fetchConfig:
url: ""
selector: ""
controlPlane:
namespace: rke2-control-plane-system
imageUrl: "%%IMG_REPO%%/%%IMG_PREFIX%%cluster-api-provider-rke2-controlplane:0.7.1"
fetchConfig:
url: ""
selector: ""
metal3:
enabled: true
version: ""
infrastructure:
namespace: capm3-system
imageUrl: "%%IMG_REPO%%/%%IMG_PREFIX%%cluster-api-provider-metal3:1.7.1"
fetchConfig:
url: ""
selector: ""
ipam:
namespace: capm3-system
imageUrl: "%%IMG_REPO%%/%%IMG_PREFIX%%ip-address-manager:1.7.1"