Skip to content

Commit 6ae680f

Browse files
(helm/v1alpha): add samples manifests
Add samples to the helm chart so that consumers and developers can decide if should provide good samples configurations and enable them for the chart be installed within
1 parent 40db2b8 commit 6ae680f

File tree

7 files changed

+56
-0
lines changed

7 files changed

+56
-0
lines changed

pkg/plugins/optional/helm/v1alpha/scaffolds/init.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ func (s *initScaffolder) copyConfigFiles() error {
236236
}{
237237
{"config/rbac", "dist/chart/templates/rbac", "rbac"},
238238
{"config/crd/bases", "dist/chart/templates/crd", "crd"},
239+
{"config/samples", "dist/chart/templates/samples", "samples"},
239240
{"config/network-policy", "dist/chart/templates/network-policy", "networkPolicy"},
240241
}
241242

pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/values.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ crd:
120120
# (Certificates, Issuers, ...) due to garbage collection.
121121
keep: true
122122
123+
# [SAMPLES]: To apply the sample(s) manifests set true
124+
samples:
125+
enable: false
126+
123127
# [METRICS]: Set to true to generate manifests for exporting metrics.
124128
# To disable metrics export set false, and ensure that the
125129
# ControllerManager argument "--metrics-bind-address=:8443" is removed.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if .Values.samples.enable }}
2+
apiVersion: example.com.testproject.org/v1
3+
kind: Wordpress
4+
metadata:
5+
labels:
6+
{{- include "chart.labels" . | nindent 4 }}
7+
name: wordpress-sample
8+
spec:
9+
# TODO(user): Add fields here
10+
{{- end -}}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.samples.enable }}
2+
apiVersion: example.com.testproject.org/v1alpha1
3+
kind: Busybox
4+
metadata:
5+
labels:
6+
{{- include "chart.labels" . | nindent 4 }}
7+
name: busybox-sample
8+
spec:
9+
# TODO(user): edit the following value to ensure the number
10+
# of Pods/Instances your Operand must have on cluster
11+
size: 1
12+
{{- end -}}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- if .Values.samples.enable }}
2+
apiVersion: example.com.testproject.org/v1alpha1
3+
kind: Memcached
4+
metadata:
5+
labels:
6+
{{- include "chart.labels" . | nindent 4 }}
7+
name: memcached-sample
8+
spec:
9+
# TODO(user): edit the following value to ensure the number
10+
# of Pods/Instances your Operand must have on cluster
11+
size: 1
12+
13+
# TODO(user): edit the following value to ensure the container has the right port to be initialized
14+
containerPort: 11211
15+
{{- end -}}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if .Values.samples.enable }}
2+
apiVersion: example.com.testproject.org/v2
3+
kind: Wordpress
4+
metadata:
5+
labels:
6+
{{- include "chart.labels" . | nindent 4 }}
7+
name: wordpress-sample
8+
spec:
9+
# TODO(user): Add fields here
10+
{{- end -}}

testdata/project-v4-with-plugins/dist/chart/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ crd:
6060
# (Certificates, Issuers, ...) due to garbage collection.
6161
keep: true
6262

63+
# [SAMPLES]: To apply the sample(s) manifests set true
64+
samples:
65+
enable: false
66+
6367
# [METRICS]: Set to true to generate manifests for exporting metrics.
6468
# To disable metrics export set false, and ensure that the
6569
# ControllerManager argument "--metrics-bind-address=:8443" is removed.

0 commit comments

Comments
 (0)