Skip to content

Commit f1e3b8f

Browse files
Merge pull request #1510 from Danil-Grigorev/embed-capio
Add operator manifests to turtles API
2 parents 95ff02d + 59e16c0 commit f1e3b8f

20 files changed

+43784
-5
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@ manifests: generate
235235

236236
.PHONY: generate-manifests-external
237237
generate-manifests-external: vendor controller-gen ## Generate ClusterRole and CustomResourceDefinition objects.
238-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd paths="./api/rancher/..." output:crd:artifacts:config=hack/crd/bases
239-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd paths="./vendor/sigs.k8s.io/cluster-api/..." output:crd:artifacts:config=hack/crd/bases
238+
$(CONTROLLER_GEN) crd paths="./api/rancher/..." output:crd:artifacts:config=hack/crd/bases
239+
$(CONTROLLER_GEN) crd paths="./vendor/sigs.k8s.io/cluster-api/..." output:crd:artifacts:config=hack/crd/bases
240+
$(CONTROLLER_GEN) crd paths="./vendor/sigs.k8s.io/cluster-api-operator/..." output:crd:artifacts:config=./config/operator/bases
240241
# Vendor is only required for pulling latest CRDs from the dependencies
241242
$(MAKE) vendor-clean
242243

@@ -555,8 +556,10 @@ release: clean-release $(RELEASE_DIR) ## Builds and push container images using
555556
.PHONY: build-chart
556557
build-chart: $(HELM) $(KUSTOMIZE) $(RELEASE_DIR) $(CHART_RELEASE_DIR) $(CHART_PACKAGE_DIR) ## Builds the chart to publish with a release
557558
$(KUSTOMIZE) build ./config/chart > $(CHART_DIR)/templates/rancher-turtles-components.yaml
559+
$(KUSTOMIZE) build ./config/operatorchart > $(CHART_DIR)/templates/operator-crds.yaml
558560
$(KUSTOMIZE) build ./exp/day2/config/chart > $(CHART_DIR)/templates/rancher-turtles-exp-day2-components.yaml
559561
$(KUSTOMIZE) build ./exp/clusterclass/config/default > $(CHART_DIR)/templates/rancher-turtles-exp-clusterclass-components.yaml
562+
./scripts/process-manifests.sh embedded-operator $(CHART_DIR)/templates/operator-crds.yaml
560563
./scripts/process-manifests.sh day2operations $(CHART_DIR)/templates/rancher-turtles-exp-day2-components.yaml
561564
./scripts/process-manifests.sh clusterclass-operations $(CHART_DIR)/templates/rancher-turtles-exp-clusterclass-components.yaml
562565
cp -rf $(CHART_DIR)/* $(CHART_RELEASE_DIR)

charts/rancher-turtles/questions.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,9 @@ questions:
5151
description: "[ALPHA] Enable ETCD Backup and Restore functionality in Rancher Turtles."
5252
type: boolean
5353
group: "ETCD Backup and Restore Settings"
54-
show_if: "rancherTurtles.features.day2operations.enabled"
54+
show_if: "rancherTurtles.features.day2operations.enabled"
55+
- variable: rancherTurtles.features.embedded-operator.enabled
56+
label: "Enable Turtles Embedded Operator"
57+
description: "[ALPHA] Enable Turtles Embedded Operator functionality in Rancher Turtles."
58+
type: boolean
59+
group: "Embedded operator"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{- if index .Values "rancherTurtles" "features" "embedded-operator" "enabled" }}
2+
apiversion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: clusterctl-config
6+
namespace: '{{ .Values.rancherTurtles.namespace }}'
7+
{{- end}}

charts/rancher-turtles/templates/deployment.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,20 @@ spec:
7171
requests:
7272
cpu: 10m
7373
memory: 128Mi
74+
{{- if index .Values "rancherTurtles" "features" "embedded-operator" "enabled" }}
75+
{{- with .Values.rancherTurtles.volumeMounts.manager }}
76+
volumeMounts:
77+
{{- toYaml . | nindent 12 }}
78+
{{- end }}
79+
{{- end }}
7480
serviceAccountName: rancher-turtles-manager
7581
terminationGracePeriodSeconds: 10
82+
{{- if index .Values "rancherTurtles" "features" "embedded-operator" "enabled" }}
83+
{{- with .Values.rancherTurtles.volumes }}
84+
volumes:
85+
{{- toYaml . | nindent 8 }}
86+
{{- end }}
87+
{{- end }}
7688
tolerations:
7789
- effect: NoSchedule
7890
key: node-role.kubernetes.io/master

charts/rancher-turtles/templates/operator-crds.yaml

Lines changed: 21813 additions & 0 deletions
Large diffs are not rendered by default.

charts/rancher-turtles/values.schema.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@
128128
}
129129
}
130130
},
131+
"embedded-operator": {
132+
"type": "object",
133+
"description": "Enable embedded operator controller loops.",
134+
"properties": {
135+
"enabled": {
136+
"type": "boolean",
137+
"default": false,
138+
"description": "Turn on or off."
139+
}
140+
}
141+
},
131142
"clusterclass-operations": {
132143
"type": "object",
133144
"description": "Alpha feature. Not ready for testing yet.",
@@ -155,6 +166,53 @@
155166
}
156167
}
157168
}
169+
},
170+
"volumes": {
171+
"type": "array",
172+
"description": "Volumes for controller pods.",
173+
"items": {
174+
"type": "object",
175+
"required": [
176+
"name",
177+
"configMap"
178+
],
179+
"properties": {
180+
"name": {
181+
"type": "string"
182+
},
183+
"configMap": {
184+
"type": "object",
185+
"properties": {
186+
"name": {
187+
"type": "string",
188+
"default": "clusterctl-config",
189+
"description": "ConfigMap for clusterctl."
190+
}
191+
}
192+
}
193+
}
194+
}
195+
},
196+
"volumeMounts": {
197+
"type": "object",
198+
"properties": {
199+
"manager": {
200+
"type": "array",
201+
"description": "Mount volumes to pods.",
202+
"items": {
203+
"type": "object",
204+
"properties": {
205+
"mountPath": { "type": "string" },
206+
"name": { "type": "string" },
207+
"readOnly": {
208+
"type": "boolean",
209+
"default": true,
210+
"description": "Mount as read-only."
211+
}
212+
}
213+
}
214+
}
215+
}
158216
}
159217
}
160218
},

charts/rancher-turtles/values.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ rancherTurtles:
2525
kubectlImage: registry.k8s.io/kubernetes/kubectl:v1.30.0
2626
# features: Optional and experimental features.
2727
features:
28+
# embedded-operator: Embed operator controller loops.
29+
embedded-operator:
30+
# enabled: Turn on or off.
31+
enabled: false
2832
# day2operations: Alpha feature.
2933
day2operations:
3034
# enabled: Turn on or off.
@@ -53,6 +57,16 @@ rancherTurtles:
5357
imageVersion: v0.0.0
5458
# imagePullPolicy: Pull policy.
5559
imagePullPolicy: IfNotPresent
60+
# volumes: Volumes for controller pods.
61+
volumes:
62+
- name: clusterctl-config
63+
configMap:
64+
name: clusterctl-config
65+
# volumeMounts: Volume mounts for controller pods.
66+
volumeMounts:
67+
manager:
68+
- mountPath: /config
69+
name: clusterctl-config
5670

5771
# cluster-api-operator: Manages Cluster API components.
5872
cluster-api-operator:

0 commit comments

Comments
 (0)