67a4f87184c963442ea0f3769c70f489b4ad820e
[osm/devops.git] /
1 #######################################################################################
2 # Copyright ETSI Contributors and Others.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #    http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #######################################################################################
17
18 apiVersion: argoproj.io/v1alpha1
19 kind: WorkflowTemplate
20 metadata:
21   name: ksu-management-wft
22   namespace: osm-workflows
23 spec:
24   templates:
25
26 # Create a KSU based on an OKA Package which includes a `HelmRelease`
27   - name: create-ksu-oka-hr
28     inputs:
29       parameters:
30       # References to required external resources
31       - name: fleet_volume_name
32       - name: fleet_mount_path
33         value: "/fleet"
34       - name: sw_catalogs_volume_name
35       - name: sw_catalogs_mount_path
36         value: "/sw-catalogs"
37       # Specific parameters - Base KSU generation from template
38       - name: templates_path
39       ## Should substitute environment variables in the template?
40       - name: substitute_environment
41         value: "false"
42       ## Filter for substitution of environment variables
43       - name: substitution_filter
44         value: ""
45       ## Custom environment variables (formatted as .env), to be used for template parametrization
46       - name: custom_env_vars
47         value: ""
48       ## Root folder of the cloned SW Catalogs repo - Do not touch
49       - name: cloned_sw_catalogs_folder_name
50         value: "sw-catalogs-osm"
51       # Specific parameters - Patch HelmRelease in KSU with inline values
52       - name: kustomization_name
53       - name: helmrelease_name
54       - name: inline_values
55         value: ""
56       # Specific parameters - Secret generation
57       - name: is_preexisting_secret
58         value: "false"
59       - name: target_ns
60       - name: age_public_key
61       - name: values_secret_name
62       - name: reference_secret_for_values
63       - name: reference_key_for_values
64       - name: secret_key
65         value: "values.yaml"
66       # Specific parameters - Configmap generation
67       - name: is_preexisting_cm
68         value: "false"
69       - name: values_cm_name
70       - name: cm_key
71         value: "values.yaml"
72       - name: cm_values
73         value: ""
74       # Specific parameters - KSU rendering
75       - name: ksu_name
76       - name: profile_name
77       - name: profile_type
78       - name: project_name
79         value: "osm_admin"
80       - name: sync
81         value: "true"
82       ## Root folder of the cloned Fleet repo - Do not touch
83       - name: cloned_fleet_folder_name
84         value: "fleet-osm"
85       # Debug?
86       - name: debug
87         value: "false"
88     container:
89       image: ttl.sh/osm-krm-functions:24h
90       # imagePullPolicy: Always
91       env:
92       - name: SECRET_VALUES
93         valueFrom:
94           secretKeyRef:
95             name: "{{inputs.parameters.reference_secret_for_values}}"
96             key: "{{inputs.parameters.reference_key_for_values}}"
97           default: ""
98       - name: DEBUG
99         value: "{{inputs.parameters.debug}}"
100       command: ["/app/scripts/entrypoint.sh"]
101       args:
102         - create_hr_ksu_into_profile
103         - "{{inputs.parameters.sw_catalogs_mount_path}}/{{inputs.parameters.cloned_sw_catalogs_folder_name}}/{{inputs.parameters.templates_path}}"
104         - "{{inputs.parameters.substitute_environment}}"
105         - "{{inputs.parameters.substitution_filter}}"
106         - "{{inputs.parameters.custom_env_vars}}"
107         - "{{inputs.parameters.kustomization_name}}"
108         - "{{inputs.parameters.helmrelease_name}}"
109         - "{{inputs.parameters.inline_values}}"
110         - "{{inputs.parameters.is_preexisting_secret}}"
111         - "{{inputs.parameters.target_ns}}"
112         - "{{inputs.parameters.values_secret_name}}"
113         - "{{inputs.parameters.secret_key}}"
114         - "{{inputs.parameters.age_public_key}}"
115         - ''
116         - "{{inputs.parameters.is_preexisting_cm}}"
117         - "{{inputs.parameters.values_cm_name}}"
118         - "{{inputs.parameters.cm_key}}"
119         - "{{inputs.parameters.cm_values}}"
120         - "{{inputs.parameters.ksu_name}}"
121         - "{{inputs.parameters.profile_name}}"
122         - "{{inputs.parameters.profile_type}}"
123         - "{{inputs.parameters.project_name}}"
124         - "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
125         - "{{inputs.parameters.sync}}"
126       volumeMounts:
127       - name: fleet-volume
128         mountPath: '{{inputs.parameters.fleet_mount_path}}'
129       - name: sw-catalogs-repo-volume
130         mountPath: '{{inputs.parameters.sw_catalogs_mount_path}}'
131     volumes:
132       - name: fleet-volume
133         persistentVolumeClaim:
134           claimName: '{{inputs.parameters.fleet_volume_name}}'
135       - name: sw-catalogs-repo-volume
136         persistentVolumeClaim:
137           claimName: '{{inputs.parameters.sw_catalogs_volume_name}}'
138     securityContext:
139       fsGroup: 10000
140     #   runAsUser: 10000
141     #   runAsGroup: 10000
142
143
144 # Update a KSU based on an OKA Package which includes a `HelmRelease`
145   - name: update-ksu-oka-hr
146     inputs:
147       parameters:
148       # References to required external resources
149       - name: fleet_volume_name
150       - name: fleet_mount_path
151         value: "/fleet"
152       - name: sw_catalogs_volume_name
153       - name: sw_catalogs_mount_path
154         value: "/sw-catalogs"
155       # Specific parameters - Base KSU generation from template
156       - name: templates_path
157       ## Should substitute environment variables in the template?
158       - name: substitute_environment
159         value: "false"
160       ## Filter for substitution of environment variables
161       - name: substitution_filter
162         value: ""
163       ## Custom environment variables (formatted as .env), to be used for template parametrization
164       - name: custom_env_vars
165         value: ""
166       ## Root folder of the cloned SW Catalogs repo - Do not touch
167       - name: cloned_sw_catalogs_folder_name
168         value: "sw-catalogs-osm"
169       # Specific parameters - Patch HelmRelease in KSU with inline values
170       - name: kustomization_name
171       - name: helmrelease_name
172       - name: inline_values
173         value: ""
174       # Specific parameters - Secret generation
175       - name: is_preexisting_secret
176         value: "false"
177       - name: target_ns
178       - name: age_public_key
179       - name: values_secret_name
180       - name: reference_secret_for_values
181       - name: reference_key_for_values
182       - name: secret_key
183         value: "values.yaml"
184       # Specific parameters - Configmap generation
185       - name: is_preexisting_cm
186         value: "false"
187       - name: values_cm_name
188       - name: cm_key
189         value: "values.yaml"
190       - name: cm_values
191         value: ""
192       # Specific parameters - KSU rendering
193       - name: ksu_name
194       - name: profile_name
195       - name: profile_type
196       - name: project_name
197         value: "osm_admin"
198       ## Root folder of the cloned Fleet repo - Do not touch
199       - name: cloned_fleet_folder_name
200         value: "fleet-osm"
201       # Debug?
202       - name: debug
203         value: "false"
204     container:
205       image: ttl.sh/osm-krm-functions:24h
206       # imagePullPolicy: Always
207       env:
208       - name: SECRET_VALUES
209         valueFrom:
210           secretKeyRef:
211             name: "{{inputs.parameters.reference_secret_for_values}}"
212             key: "{{inputs.parameters.reference_key_for_values}}"
213           default: ""
214       - name: DEBUG
215         value: "{{inputs.parameters.debug}}"
216       command: ["/app/scripts/entrypoint.sh"]
217       args:
218         - update_hr_ksu_into_profile
219         - "{{inputs.parameters.sw_catalogs_mount_path}}/{{inputs.parameters.cloned_sw_catalogs_folder_name}}/{{inputs.parameters.templates_path}}"
220         - "{{inputs.parameters.substitute_environment}}"
221         - "{{inputs.parameters.substitution_filter}}"
222         - "{{inputs.parameters.custom_env_vars}}"
223         - "{{inputs.parameters.kustomization_name}}"
224         - "{{inputs.parameters.helmrelease_name}}"
225         - "{{inputs.parameters.inline_values}}"
226         - "{{inputs.parameters.is_preexisting_secret}}"
227         - "{{inputs.parameters.target_ns}}"
228         - "{{inputs.parameters.values_secret_name}}"
229         - "{{inputs.parameters.secret_key}}"
230         - "{{inputs.parameters.age_public_key}}"
231         - ''
232         - "{{inputs.parameters.is_preexisting_cm}}"
233         - "{{inputs.parameters.values_cm_name}}"
234         - "{{inputs.parameters.cm_key}}"
235         - "{{inputs.parameters.cm_values}}"
236         - "{{inputs.parameters.ksu_name}}"
237         - "{{inputs.parameters.profile_name}}"
238         - "{{inputs.parameters.profile_type}}"
239         - "{{inputs.parameters.project_name}}"
240         - "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
241       volumeMounts:
242       - name: fleet-volume
243         mountPath: '{{inputs.parameters.fleet_mount_path}}'
244       - name: sw-catalogs-repo-volume
245         mountPath: '{{inputs.parameters.sw_catalogs_mount_path}}'
246     volumes:
247       - name: fleet-volume
248         persistentVolumeClaim:
249           claimName: '{{inputs.parameters.fleet_volume_name}}'
250       - name: sw-catalogs-repo-volume
251         persistentVolumeClaim:
252           claimName: '{{inputs.parameters.sw_catalogs_volume_name}}'
253     securityContext:
254       fsGroup: 10000
255     #   runAsUser: 10000
256     #   runAsGroup: 10000
257
258
259 # Create a "generated" KSU from `HelmRelease` and Source Repo definitions
260   - name: create-ksu-generated-hr
261     inputs:
262       parameters:
263       # References to required external resources
264       - name: fleet_volume_name
265       - name: fleet_mount_path
266         value: "/fleet"
267       # HelmRelease generation
268       - name: helmrelease_name
269       - name: chart_name
270       - name: chart_version
271       - name: target_ns
272       - name: create_ns
273       # Repo source generation
274       - name: is_preexisting_repo
275         value: "false"
276       - name: helmrepo_name
277       - name: helmrepo_url
278       - name: helmrepo_ns
279         valueFrom:
280           expression: "{{input.parameters.target_ns}}"
281       - name: helmrepo_secret_ref
282       # HelmRelease inline values (if any)
283       - name: inline_values
284         value: ""
285       # Secret reference and generation (if required)
286       - name: is_preexisting_secret
287         value: "false"
288       - name: values_secret_name
289       - name: secret_key
290         value: "values.yaml"
291       - name: age_public_key
292       ## Secret values will be obtained from the
293       ## secret named after the input parameter `reference_secret_for_values`,
294       ## and from the key named after the input parameter `reference_key_for_values`
295       - name: reference_secret_for_values
296       - name: reference_key_for_values
297       # ConfigMap reference and generation (if required)
298       - name: is_preexisting_cm
299         value: "false"
300       - name: values_cm_name
301       - name: cm_key
302         value: "values.yaml"
303       - name: cm_values
304         value: ""
305       # KSU rendering
306       - name: ksu_name
307       - name: profile_name
308       - name: profile_type
309       - name: project_name
310         value: "osm_admin"
311       # By default, it will not syncronize, so that we can easily accumulate more than
312       # one Helm chart into the same KSU if desired
313       - name: sync
314         value: "false"
315       ## Root folder of the cloned Fleet repo - Do not touch
316       ### `FLEET_REPO_DIR` is the result of:
317       ### "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
318       - name: cloned_fleet_folder_name
319         value: "fleet-osm"
320       # Debug?
321       - name: debug
322         value: "false"
323
324     container:
325       image: ttl.sh/osm-krm-functions:24h
326       # imagePullPolicy: Always
327       env:
328       - name: SECRET_VALUES
329         valueFrom:
330           secretKeyRef:
331             name: "{{inputs.parameters.reference_secret_for_values}}"
332             key: "{{inputs.parameters.reference_key_for_values}}"
333           default: ""
334       - name: DEBUG
335         value: "{{inputs.parameters.debug}}"
336       command: ["/app/scripts/entrypoint.sh"]
337       args:
338       - create_generated_ksu_from_helm_into_profile
339       - "{{inputs.parameters.helmrelease_name}}"
340       - "{{inputs.parameters.chart_name}}"
341       - "{{inputs.parameters.chart_version}}"
342       - "{{inputs.parameters.target_ns}}"
343       - "{{inputs.parameters.create_ns}}"
344       - "{{inputs.parameters.is_preexisting_repo}}"
345       - "{{inputs.parameters.helmrepo_name}}"
346       - "{{inputs.parameters.helmrepo_url}}"
347       - "{{inputs.parameters.helmrepo_ns}}"
348       - "{{inputs.parameters.helmrepo_secret_ref}}"
349       - "{{inputs.parameters.inline_values}}"
350       - "{{inputs.parameters.is_preexisting_secret}}"
351       - "{{inputs.parameters.values_secret_name}}"
352       - "{{inputs.parameters.secret_key}}"
353       - "{{inputs.parameters.age_public_key}}"
354       - ''
355       - "{{inputs.parameters.is_preexisting_cm}}"
356       - "{{inputs.parameters.values_cm_name}}"
357       - "{{inputs.parameters.cm_key}}"
358       - "{{inputs.parameters.cm_values}}"
359       - "{{inputs.parameters.ksu_name}}"
360       - "{{inputs.parameters.profile_name}}"
361       - "{{inputs.parameters.profile_type}}"
362       - "{{inputs.parameters.project_name}}"
363       - "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
364       - "{{inputs.parameters.sync}}"
365       volumeMounts:
366       - name: fleet-volume
367         mountPath: '{{inputs.parameters.fleet_mount_path}}'
368     volumes:
369       - name: fleet-volume
370         persistentVolumeClaim:
371           claimName: '{{inputs.parameters.fleet_volume_name}}'
372     securityContext:
373       fsGroup: 10000
374     #   runAsUser: 10000
375     #   runAsGroup: 10000
376
377
378 # Update a "generated" KSU from `HelmRelease` and Source Repo definitions
379   - name: update-ksu-generated-hr
380     inputs:
381       parameters:
382       # References to required external resources
383       - name: fleet_volume_name
384       - name: fleet_mount_path
385         value: "/fleet"
386       # HelmRelease generation
387       - name: helmrelease_name
388       - name: chart_name
389       - name: chart_version
390       - name: target_ns
391       - name: create_ns
392       # Repo source generation
393       - name: is_preexisting_repo
394         value: "false"
395       - name: helmrepo_name
396       - name: helmrepo_url
397       - name: helmrepo_ns
398         valueFrom:
399           expression: "{{input.parameters.target_ns}}"
400       - name: helmrepo_secret_ref
401       # HelmRelease inline values (if any)
402       - name: inline_values
403         value: ""
404       # Secret reference and generation (if required)
405       - name: is_preexisting_secret
406         value: "false"
407       - name: values_secret_name
408       - name: secret_key
409         value: "values.yaml"
410       - name: age_public_key
411       ## Secret values will be obtained from the
412       ## secret named after the input parameter `reference_secret_for_values`,
413       ## and from the key named after the input parameter `reference_key_for_values`
414       - name: reference_secret_for_values
415       - name: reference_key_for_values
416       # ConfigMap reference and generation (if required)
417       - name: is_preexisting_cm
418         value: "false"
419       - name: values_cm_name
420       - name: cm_key
421         value: "values.yaml"
422       - name: cm_values
423         value: ""
424       # KSU rendering
425       - name: ksu_name
426       - name: profile_name
427       - name: profile_type
428       - name: project_name
429         value: "osm_admin"
430       ## Root folder of the cloned Fleet repo - Do not touch
431       ### `FLEET_REPO_DIR` is the result of:
432       ### "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
433       - name: cloned_fleet_folder_name
434         value: "fleet-osm"
435       # Debug?
436       - name: debug
437         value: "false"
438
439     container:
440       image: ttl.sh/osm-krm-functions:24h
441       # imagePullPolicy: Always
442       env:
443       - name: SECRET_VALUES
444         valueFrom:
445           secretKeyRef:
446             name: "{{inputs.parameters.reference_secret_for_values}}"
447             key: "{{inputs.parameters.reference_key_for_values}}"
448           default: ""
449       - name: DEBUG
450         value: "{{inputs.parameters.debug}}"
451       command: ["/app/scripts/entrypoint.sh"]
452       args:
453       - update_generated_ksu_from_helm_into_profile
454       - "{{inputs.parameters.helmrelease_name}}"
455       - "{{inputs.parameters.chart_name}}"
456       - "{{inputs.parameters.chart_version}}"
457       - "{{inputs.parameters.target_ns}}"
458       - "{{inputs.parameters.create_ns}}"
459       - "{{inputs.parameters.is_preexisting_repo}}"
460       - "{{inputs.parameters.helmrepo_name}}"
461       - "{{inputs.parameters.helmrepo_url}}"
462       - "{{inputs.parameters.helmrepo_ns}}"
463       - "{{inputs.parameters.helmrepo_secret_ref}}"
464       - "{{inputs.parameters.inline_values}}"
465       - "{{inputs.parameters.is_preexisting_secret}}"
466       - "{{inputs.parameters.values_secret_name}}"
467       - "{{inputs.parameters.secret_key}}"
468       - "{{inputs.parameters.age_public_key}}"
469       - ''
470       - "{{inputs.parameters.is_preexisting_cm}}"
471       - "{{inputs.parameters.values_cm_name}}"
472       - "{{inputs.parameters.cm_key}}"
473       - "{{inputs.parameters.cm_values}}"
474       - "{{inputs.parameters.ksu_name}}"
475       - "{{inputs.parameters.profile_name}}"
476       - "{{inputs.parameters.profile_type}}"
477       - "{{inputs.parameters.project_name}}"
478       - "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
479       volumeMounts:
480       - name: fleet-volume
481         mountPath: '{{inputs.parameters.fleet_mount_path}}'
482     volumes:
483       - name: fleet-volume
484         persistentVolumeClaim:
485           claimName: '{{inputs.parameters.fleet_volume_name}}'
486     securityContext:
487       fsGroup: 10000
488     #   runAsUser: 10000
489     #   runAsGroup: 10000
490
491
492 # Delete a KSU from a profile
493   - name: delete-ksu
494     inputs:
495       parameters:
496       # References to required external resources
497       - name: fleet_volume_name
498       - name: fleet_mount_path
499         value: "/fleet"
500       - name: sw_catalogs_volume_name
501       - name: sw_catalogs_mount_path
502         value: "/sw-catalogs"
503       # Specific parameters - KSU id
504       - name: ksu_name
505       - name: profile_name
506       - name: profile_type
507       - name: project_name
508         value: "osm_admin"
509       # Other parameters - Do not touch
510       - name: cloned_fleet_folder_name
511         value: "fleet-osm"
512       - name: cloned_sw_catalogs_folder_name
513         value: "sw-catalogs-osm"
514       # Debug?
515       - name: debug
516         value: "false"
517     container:
518       image: ttl.sh/osm-krm-functions:24h
519       # imagePullPolicy: Always
520       env:
521       - name: DEBUG
522         value: "{{inputs.parameters.debug}}"
523       command: ["/app/scripts/entrypoint.sh"]
524       args:
525         - delete_ksu_from_profile
526         - "{{inputs.parameters.ksu_name}}"
527         - "{{inputs.parameters.profile_name}}"
528         - "{{inputs.parameters.profile_type}}"
529         - "{{inputs.parameters.project_name}}"
530         - "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
531       volumeMounts:
532       - name: fleet-volume
533         mountPath: '{{inputs.parameters.fleet_mount_path}}'
534       - name: sw-catalogs-repo-volume
535         mountPath: '{{inputs.parameters.sw_catalogs_mount_path}}'
536     volumes:
537       - name: fleet-volume
538         persistentVolumeClaim:
539           claimName: '{{inputs.parameters.fleet_volume_name}}'
540       - name: sw-catalogs-repo-volume
541         persistentVolumeClaim:
542           claimName: '{{inputs.parameters.sw_catalogs_volume_name}}'
543     securityContext:
544       fsGroup: 10000
545     #   runAsUser: 10000
546     #   runAsGroup: 10000
547
548
549 # Clone a KSU from a profile to another
550   - name: clone-ksu
551     inputs:
552       parameters:
553       # References to required external resources
554       - name: fleet_volume_name
555       - name: fleet_mount_path
556         value: "/fleet"
557       # Specific parameters - Source and destination KSU
558       ## Source KSU:
559       - name: source_ksu_name
560       - name: source_profile_name
561       - name: source_profile_type
562       - name: source_project_name
563         value: "osm_admin"
564       ## Destination KSU:
565       ## - If any of the destination parameters are not specified, it will assume
566       ##   they are the same as in source.
567       ## - It will reject if all are empty or equal to source, to avoid cloning a KSU over itself
568       - name: destination_ksu_name
569         value: ""
570       - name: destination_profile_name
571         value: ""
572       - name: destination_profile_type
573         value: ""
574       - name: destination_project_name
575         value: ""
576       # Other parameters - Do not touch
577       - name: cloned_fleet_folder_name
578         value: "fleet-osm"
579       # Debug?
580       - name: debug
581         value: "false"
582     container:
583       image: ttl.sh/osm-krm-functions:24h
584       # imagePullPolicy: Always
585       env:
586       - name: DEBUG
587         value: "{{inputs.parameters.debug}}"
588       command: ["/app/scripts/entrypoint.sh"]
589       args:
590       - clone_ksu
591       - "{{inputs.parameters.source_ksu_name}}"
592       - "{{inputs.parameters.source_profile_name}}"
593       - "{{inputs.parameters.source_profile_type}}"
594       - "{{inputs.parameters.source_project_name}}"
595       - "{{inputs.parameters.destination_ksu_name}}"
596       - "{{inputs.parameters.destination_profile_name}}"
597       - "{{inputs.parameters.destination_profile_type}}"
598       - "{{inputs.parameters.destination_project_name}}"
599       - "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
600       volumeMounts:
601       - name: fleet-volume
602         mountPath: '{{inputs.parameters.fleet_mount_path}}'
603     volumes:
604       - name: fleet-volume
605         persistentVolumeClaim:
606           claimName: '{{inputs.parameters.fleet_volume_name}}'
607     securityContext:
608       fsGroup: 10000
609     #   runAsUser: 10000
610     #   runAsGroup: 10000
611
612
613   # Read template folder from OKA Package and convert to `ResourceList`
614   # It can work as KRM generator function, since it accepts an optional input `ResourceList`
615   - name: folder2list
616     inputs:
617       parameters:
618       # References to required external resources
619       - name: sw_catalogs_volume_name
620       - name: temp_volume_name
621       # Filename for input stream
622       - name: input_stream_file
623         value: "/dev/null"
624       # Specific parameters
625       ## Relative path from `sw_catalogs_mount_path`
626       - name: templates_path
627       ## Should substitute environment variables in the template?
628       - name: substitute_environment
629         value: "false"
630       ## Filter for substitution of environment variables
631       - name: substitution_filter
632         value: ""
633       ## Custom environment variables (formatted as .env), to be used for template parametrization
634       - name: custom_env_vars
635         value: ""
636         # value: |
637         #     KEY1=value1
638         #     KEY2=value2
639       # Debug mode?
640       - name: debug
641         value: "false"
642       # Other parameters - Do not touch
643       - name: sw_catalogs_mount_path
644         value: "/sw-catalogs"
645       - name: cloned_sw_catalogs_folder_name
646         value: "sw-catalogs-osm"
647       - name: rand_str
648         value: "{{=sprig.randAlphaNum(9)}}"
649     outputs:
650       parameters:
651         - name: output_file
652           value: "/results/resourcelist.{{inputs.parameters.rand_str}}.yaml"
653     container:
654       image: ttl.sh/osm-krm-functions:24h
655       # imagePullPolicy: Always
656       env:
657       - name: INFILE
658         value: "{{inputs.parameters.input_stream_file}}"
659       - name: OUTFILE
660         value: "/results/resourcelist.{{inputs.parameters.rand_str}}.yaml"
661       - name: CUSTOM_ENV
662         value: "{{inputs.parameters.custom_env_vars}}"
663       - name: DEBUG
664         value: "{{inputs.parameters.debug}}"
665       command: ["/app/scripts/entrypoint.sh"]
666       args:
667       - folder2list_generator
668       - "{{inputs.parameters.sw_catalogs_mount_path}}/{{inputs.parameters.cloned_sw_catalogs_folder_name}}/{{inputs.parameters.templates_path}}"
669       - "{{inputs.parameters.substitute_environment}}"
670       - "{{inputs.parameters.substitution_filter}}"
671       volumeMounts:
672       - name: temp-volume
673         mountPath: "/results"
674       - name: sw-catalogs-repo-volume
675         mountPath: '{{inputs.parameters.sw_catalogs_mount_path}}'
676     volumes:
677       - name: temp-volume
678         persistentVolumeClaim:
679           claimName: '{{inputs.parameters.temp_volume_name}}'
680       - name: sw-catalogs-repo-volume
681         persistentVolumeClaim:
682           claimName: '{{inputs.parameters.sw_catalogs_volume_name}}'
683     securityContext:
684       fsGroup: 10000
685     #   runAsUser: 10000
686     #   runAsGroup: 10000
687
688
689   # Transform `ResourceList`'s main Kustomization to patch `HelmRelease` to use
690   # inline values
691   - name: transform-ks-add-values-to-hr
692     inputs:
693       parameters:
694       # References to required external resources
695       - name: temp_volume_name
696       # Specific parameters - Generator
697       ## Filename for input stream
698       - name: input_stream_file
699       # Specific parameters
700       ## Patched objects
701       - name: kustomization_name
702       - name: helmrelease_name
703       ## Input values for the Helm Chart
704       - name: inline_values
705       # Debug mode?
706       - name: debug
707         value: "false"
708       # Other parameters - Do not touch
709       - name: rand_str
710         value: "{{=sprig.randAlphaNum(9)}}"
711     outputs:
712       parameters:
713         - name: output_file
714           value: "/results/resourcelist.{{inputs.parameters.rand_str}}.yaml"
715     container:
716       image: ttl.sh/osm-krm-functions:24h
717       # imagePullPolicy: Always
718       env:
719       - name: INFILE
720         value: "{{inputs.parameters.input_stream_file}}"
721       - name: OUTFILE
722         value: "/results/resourcelist.{{inputs.parameters.rand_str}}.yaml"
723       - name: DEBUG
724         value: "{{inputs.parameters.debug}}"
725       command: ["/app/scripts/entrypoint.sh"]
726       args:
727       - add_values_to_helmrelease_via_ks
728       - "{{inputs.parameters.kustomization_name}}"
729       - "{{inputs.parameters.helmrelease_name}}"
730       - "{{inputs.parameters.inline_values}}"
731       volumeMounts:
732       - name: temp-volume
733         mountPath: "/results"
734     volumes:
735     - name: temp-volume
736       persistentVolumeClaim:
737         claimName: '{{inputs.parameters.temp_volume_name}}'
738     securityContext:
739       fsGroup: 10000
740       # runAsUser: 10000
741       # runAsGroup: 10000
742
743
744   # Transform `ResourceList`'s main Kustomization to patch `HelmRelease` to use
745   # values from a Secret, a ConfigMap or both.
746   - name: transform-ks-add-referenced-values-to-hr
747     inputs:
748       parameters:
749       # References to required external resources
750       - name: temp_volume_name
751       # Specific parameters - Generator
752       ## Filename for input stream
753       - name: input_stream_file
754       # Specific parameters
755       - name: kustomization_name
756       - name: helmrelease_name
757       ## Source for values (Secret, ConfigMap or both)
758       - name: values_secret_name
759         value: ""
760       - name: values_cm_name
761         value: ""
762       # Debug mode?
763       - name: debug
764         value: "false"
765       # Other parameters - Do not touch
766       - name: rand_str
767         value: "{{=sprig.randAlphaNum(9)}}"
768     outputs:
769       parameters:
770         - name: output_file
771           value: "/results/resourcelist.{{inputs.parameters.rand_str}}.yaml"
772     container:
773       image: ttl.sh/osm-krm-functions:24h
774       # imagePullPolicy: Always
775       env:
776       - name: INFILE
777         value: "{{inputs.parameters.input_stream_file}}"
778       - name: OUTFILE
779         value: "/results/resourcelist.{{inputs.parameters.rand_str}}.yaml"
780       - name: DEBUG
781         value: "{{inputs.parameters.debug}}"
782       command: ["/app/scripts/entrypoint.sh"]
783       args:
784       - add_ref_values_to_hr_via_ks
785       - "{{inputs.parameters.kustomization_name}}"
786       - "{{inputs.parameters.helmrelease_name}}"
787       - "{{inputs.parameters.values_secret_name}}"
788       - "{{inputs.parameters.values_cm_name}}"
789       volumeMounts:
790       - name: temp-volume
791         mountPath: "/results"
792     volumes:
793     - name: temp-volume
794       persistentVolumeClaim:
795         claimName: '{{inputs.parameters.temp_volume_name}}'
796     securityContext:
797       fsGroup: 10000
798       # runAsUser: 10000
799       # runAsGroup: 10000
800
801
802   # KRM function to render a ResourceList with a KSU into a target profile
803   - name: render-ksu-into-profile
804     inputs:
805       parameters:
806       # References to required external resources
807       - name: fleet_volume_name
808       - name: temp_volume_name
809       # Filename for input stream
810       - name: input_stream_file
811       # Specific parameters
812       - name: ksu_name
813       - name: profile_name
814       - name: profile_type
815       - name: project_name
816         value: "osm_admin"
817       ## Whether the target KSU folder will be fully re-created on render
818       - name: sync
819         value: "false"
820       # Debug mode?
821       - name: debug
822         value: "false"
823       # Other parameters - Do not touch
824       - name: fleet_mount_path
825         value: "/fleet"
826       - name: fleet_repo_dir
827         value: "/fleet/fleet-osm/"
828       - name: rand_str
829         value: "{{=sprig.randAlphaNum(9)}}"
830     outputs:
831       parameters:
832         - name: output_file
833           value: "/results/resourcelist.{{inputs.parameters.rand_str}}.yaml"
834     container:
835       image: ttl.sh/osm-krm-functions:24h
836       # imagePullPolicy: Always
837       env:
838       - name: INFILE
839         value: "{{inputs.parameters.input_stream_file}}"
840       - name: OUTFILE
841         value: "/results/resourcelist.{{inputs.parameters.rand_str}}.yaml"
842       - name: DEBUG
843         value: "{{inputs.parameters.debug}}"
844       command: ["/app/scripts/entrypoint.sh"]
845       args:
846       - render_ksu_into_profile
847       - "{{inputs.parameters.ksu_name}}"
848       - "{{inputs.parameters.profile_name}}"
849       - "{{inputs.parameters.profile_type}}"
850       - "{{inputs.parameters.project_name}}"
851       - "{{inputs.parameters.fleet_repo_dir}}"
852       - "{{inputs.parameters.sync}}"
853       volumeMounts:
854       - name: temp-volume
855         mountPath: "/results"
856       - name: fleet-volume
857         mountPath: '{{inputs.parameters.fleet_mount_path}}'
858     volumes:
859       - name: temp-volume
860         persistentVolumeClaim:
861           claimName: '{{inputs.parameters.temp_volume_name}}'
862       - name: fleet-volume
863         persistentVolumeClaim:
864           claimName: '{{inputs.parameters.fleet_volume_name}}'
865     securityContext:
866       fsGroup: 10000
867     #   runAsUser: 10000
868     #   runAsGroup: 10000
869
870
871   # KRM generator to create Secrets suitable to pass values to `HelmReleases`
872   - name: generator-secret-hr-values
873     inputs:
874       parameters:
875       # References to required external resources
876       - name: temp_volume_name
877       # Specific parameters - Generator
878       ## Filename for input stream
879       - name: input_stream_file
880         value: "/dev/null"
881       ## Name of final manifest filename into generated `ResourceList` object
882       - name: final_manifest_filename
883       # Specific parameters - Secret
884       - name: age_public_key
885       - name: values_secret_name
886       - name: target_ns
887       - name: reference_secret_for_values
888       - name: reference_key_for_values
889       - name: secret_key
890         value: "values.yaml"
891       # Debug mode?
892       - name: debug
893         value: "false"
894     outputs:
895       parameters:
896         - name: output_file
897           valueFrom:
898             parameter: '{{steps.generate-resourcelist.outputs.parameters.output_file}}'
899     steps:
900     - - name: build-manifest
901         templateRef:
902           name: ksu-management-wft
903           template: manifest-secret-hr-values
904         arguments:
905           parameters:
906           # References to required external resources
907           - name: temp_volume_name
908             value: "{{inputs.parameters.temp_volume_name}}"
909           # Specific parameters
910           - name: age_public_key
911             value: "{{inputs.parameters.age_public_key}}"
912           - name: values_secret_name
913             value: "{{inputs.parameters.values_secret_name}}"
914           - name: target_ns
915             value: "{{inputs.parameters.target_ns}}"
916           - name: reference_secret_for_values
917             value: "{{inputs.parameters.reference_secret_for_values}}"
918           - name: reference_key_for_values
919             value: "{{inputs.parameters.reference_key_for_values}}"
920           - name: secret_key
921             value: "{{inputs.parameters.secret_key}}"
922           # Debug?
923           - name: debug
924             value: "{{inputs.parameters.debug}}"
925     - - name: generate-resourcelist
926         templateRef:
927           name: ksu-management-wft
928           template: make-generator
929         arguments:
930           parameters:
931           # References to required external resources
932           - name: temp_volume_name
933             value: "{{inputs.parameters.temp_volume_name}}"
934           # Filename for input stream
935           - name: input_stream_file
936             value: "{{inputs.parameters.input_stream_file}}"
937           # File with raw manifest
938           - name: input_manifest_file
939             value: '{{steps.build-manifest.outputs.parameters.output_file}}'
940           # Name of final manifest filename into generated `ResourceList` object
941           - name: final_manifest_filename
942             value: "{{inputs.parameters.final_manifest_filename}}"
943           # Debug?
944           - name: debug
945             value: "{{inputs.parameters.debug}}"
946
947
948   # KRM generator to create ConfigMaps suitable to pass values to `HelmReleases`
949   - name: generator-cm-hr-values
950     inputs:
951       parameters:
952       # References to required external resources
953       - name: temp_volume_name
954       # Specific parameters - Generator
955       ## Filename for input stream
956       - name: input_stream_file
957         value: "/dev/null"
958       ## Name of final manifest filename into generated `ResourceList` object
959       - name: final_manifest_filename
960       # Specific parameters - ConfigMap
961       - name: values_cm_name
962       - name: target_ns
963       - name: cm_key
964         value: "values.yaml"
965       - name: cm_values
966       # Debug mode?
967       - name: debug
968         value: "false"
969     outputs:
970       parameters:
971         - name: output_file
972           valueFrom:
973             parameter: '{{steps.generate-resourcelist.outputs.parameters.output_file}}'
974     steps:
975     - - name: build-manifest
976         templateRef:
977           name: ksu-management-wft
978           template: manifest-cm-hr-values
979         arguments:
980           parameters:
981           # References to required external resources
982           - name: temp_volume_name
983             value: "{{inputs.parameters.temp_volume_name}}"
984           # Specific parameters
985           - name: values_cm_name
986             value: "{{inputs.parameters.values_cm_name}}"
987           - name: target_ns
988             value: "{{inputs.parameters.target_ns}}"
989           - name: cm_key
990             value: "{{inputs.parameters.cm_key}}"
991           - name: cm_values
992             value: "{{inputs.parameters.cm_values}}"
993           # Debug?
994           - name: debug
995             value: "{{inputs.parameters.debug}}"
996     - - name: generate-resourcelist
997         templateRef:
998           name: ksu-management-wft
999           template: make-generator
1000         arguments:
1001           parameters:
1002           # References to required external resources
1003           - name: temp_volume_name
1004             value: "{{inputs.parameters.temp_volume_name}}"
1005           # Filename for input stream
1006           - name: input_stream_file
1007             value: "{{inputs.parameters.input_stream_file}}"
1008           # File with raw manifest
1009           - name: input_manifest_file
1010             value: '{{steps.build-manifest.outputs.parameters.output_file}}'
1011           # Name of final manifest filename into generated `ResourceList` object
1012           - name: final_manifest_filename
1013             value: "{{inputs.parameters.final_manifest_filename}}"
1014           # Debug?
1015           - name: debug
1016             value: "{{inputs.parameters.debug}}"
1017
1018
1019   # Converts a manifest to a KRM generator
1020   - name: make-generator
1021     inputs:
1022       parameters:
1023       # References to required external resources
1024       - name: temp_volume_name
1025       # Filename for input stream
1026       - name: input_stream_file
1027         value: "/dev/null"
1028       # File with raw manifest
1029       - name: input_manifest_file
1030       # Name of final manifest filename into generated `ResourceList` object
1031       - name: final_manifest_filename
1032       # Debug mode?
1033       - name: debug
1034         value: "false"
1035       # Other parameters - Do not touch
1036       - name: rand_str
1037         value: "{{=sprig.randAlphaNum(9)}}"
1038     outputs:
1039       parameters:
1040         - name: output_file
1041           value: "/results/resourcelist.{{inputs.parameters.rand_str}}.yaml"
1042     container:
1043       image: ttl.sh/osm-krm-functions:24h
1044       # imagePullPolicy: Always
1045       env:
1046       - name: INFILE
1047         value: "{{inputs.parameters.input_stream_file}}"
1048       - name: OUTFILE
1049         value: "/results/resourcelist.{{inputs.parameters.rand_str}}.yaml"
1050       - name: DEBUG
1051         value: "{{inputs.parameters.debug}}"
1052       command: ["/app/scripts/entrypoint.sh"]
1053       args:
1054       - make_generator
1055       - "{{inputs.parameters.final_manifest_filename}}"
1056       - cat
1057       - "{{inputs.parameters.input_manifest_file}}"
1058       volumeMounts:
1059       - name: temp-volume
1060         mountPath: "/results"
1061     volumes:
1062     - name: temp-volume
1063       persistentVolumeClaim:
1064         claimName: '{{inputs.parameters.temp_volume_name}}'
1065     securityContext:
1066       fsGroup: 10000
1067       # runAsUser: 10000
1068       # runAsGroup: 10000
1069
1070
1071   # Produces a secret manifest and encrypts it with SOPS
1072   - name: manifest-secret-hr-values
1073     inputs:
1074       parameters:
1075       # References to required external resources
1076       - name: temp_volume_name
1077       # Public age key to encrypt secret
1078       - name: age_public_key
1079       # Name of the secret to be created
1080       - name: values_secret_name
1081       # Namespace for the secret
1082       - name: target_ns
1083       # Input secret that contains the values to embed into the new secret
1084       - name: reference_secret_for_values
1085       - name: reference_key_for_values
1086         value: "values.yaml"
1087       # Key in the new secret where the values will be inserted
1088       - name: secret_key
1089         value: "values.yaml"
1090       # Debug mode?
1091       - name: debug
1092         value: "false"
1093       # Other parameters - Do not touch
1094       - name: rand_str
1095         value: "{{=sprig.randAlphaNum(9)}}"
1096     outputs:
1097       parameters:
1098         - name: output_file
1099           value: "/results/manifest.{{inputs.parameters.rand_str}}.yaml"
1100     container:
1101       image: ttl.sh/osm-krm-functions:24h
1102       # imagePullPolicy: Always
1103       env:
1104       - name: INSTREAM
1105         valueFrom:
1106           secretKeyRef:
1107             name: "{{inputs.parameters.reference_secret_for_values}}"
1108             key: "{{inputs.parameters.reference_key_for_values}}"
1109       - name: OUTFILE
1110         value: "/results/manifest.{{inputs.parameters.rand_str}}.yaml"
1111       - name: DEBUG
1112         value: "{{inputs.parameters.debug}}"
1113       command: ["/app/scripts/entrypoint.sh"]
1114       args:
1115         - kubectl_encrypt
1116         - "{{inputs.parameters.age_public_key}}"
1117         - create
1118         - secret
1119         - generic
1120         - "{{inputs.parameters.values_secret_name}}"
1121         - --namespace={{inputs.parameters.target_ns}}
1122         - --from-file={{inputs.parameters.secret_key}}=/dev/stdin
1123         - -o=yaml
1124         - --dry-run=client
1125       volumeMounts:
1126       - name: temp-volume
1127         mountPath: "/results"
1128     volumes:
1129     - name: temp-volume
1130       persistentVolumeClaim:
1131         claimName: '{{inputs.parameters.temp_volume_name}}'
1132     securityContext:
1133       fsGroup: 10000
1134     # runAsUser: 10000
1135     # runAsGroup: 10000
1136
1137
1138   # Produces a ConfigMap manifest
1139   - name: manifest-cm-hr-values
1140     inputs:
1141       parameters:
1142       # References to required external resources
1143       - name: temp_volume_name
1144       # Specific parameters
1145       - name: values_cm_name
1146       - name: target_ns
1147       - name: cm_key
1148         value: "values.yaml"
1149       - name: cm_values
1150       # Debug mode?
1151       - name: debug
1152         value: "false"
1153       # Other parameters - Do not touch
1154       - name: rand_str
1155         value: "{{=sprig.randAlphaNum(9)}}"
1156     outputs:
1157       parameters:
1158         - name: output_file
1159           value: "/results/manifest.{{inputs.parameters.rand_str}}.yaml"
1160     container:
1161       image: ttl.sh/osm-krm-functions:24h
1162       # imagePullPolicy: Always
1163       env:
1164       - name: INSTREAM
1165         value: "{{inputs.parameters.cm_values}}"
1166       - name: OUTFILE
1167         value: "/results/manifest.{{inputs.parameters.rand_str}}.yaml"
1168       - name: DEBUG
1169         value: "{{inputs.parameters.debug}}"
1170       command: ["/app/scripts/entrypoint.sh"]
1171       args:
1172         - kubectl
1173         - create
1174         - configmap
1175         - "{{inputs.parameters.values_cm_name}}"
1176         - --namespace={{inputs.parameters.target_ns}}
1177         - --from-file={{inputs.parameters.cm_key}}=/dev/stdin
1178         - -o=yaml
1179         - --dry-run=client
1180       volumeMounts:
1181       - name: temp-volume
1182         mountPath: "/results"
1183     volumes:
1184     - name: temp-volume
1185       persistentVolumeClaim:
1186         claimName: '{{inputs.parameters.temp_volume_name}}'
1187     securityContext:
1188       fsGroup: 10000
1189     # runAsUser: 10000
1190     # runAsGroup: 10000