Skip to content

Commit a0c8dd4

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 6bf7566 commit a0c8dd4

File tree

7 files changed

+56
-2
lines changed

7 files changed

+56
-2
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,13 @@ crd:
112112
enable: true
113113
keep: true
114114
115+
# [SAMPLES]: To apply the sample(s) manifests set true
116+
samples:
117+
enable: false
118+
115119
# [METRICS]: Set to true to generate manifests for exporting metrics
116120
metrics:
117121
enable: true
118-
119122
{{ if .Webhooks }}
120123
# [WEBHOOKS]: Webhooks configuration
121124
webhook:
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,14 @@ crd:
5252
enable: true
5353
keep: true
5454

55+
# [SAMPLES]: To apply the sample(s) manifests set true
56+
samples:
57+
enable: false
58+
5559
# [METRICS]: Set to true to generate manifests for exporting metrics
5660
metrics:
5761
enable: true
5862

59-
6063
# [WEBHOOKS]: Webhooks configuration
6164
webhook:
6265
enable: true

0 commit comments

Comments
 (0)