4a0e841679c2b159c1e0517a4997b4d6062de4c0
[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: oka-management-wft
22   namespace: osm-workflows
23 spec:
24   templates:
25
26 # Create an OKA based on an OKA Package pre-loaded into a pvc
27   - name: create-oka
28     inputs:
29       parameters:
30       # References to required external resources
31       - name: sw_catalogs_volume_name
32       - name: temp_volume_name
33       # Specific parameters - OKA
34       - name: oka_name
35       ## Choose among `infra-controllers`, `infra-configs`, `cloud-resources`, `apps`:
36       - name: oka_type
37       - name: project_name
38         value: "osm_admin"
39       - name: tarball_file
40         value: "true"
41       # Debug?
42       - name: debug
43         value: "false"
44       # Other parameters - Do not touch
45       - name: sw_catalogs_mount_path
46         value: "/sw-catalogs"
47       - name: cloned_sw_catalogs_folder_name
48         value: "sw-catalogs-osm"
49       - name: temp_volume_mount_path
50         value: "/oka"
51       - name: oka_location
52         value: "/oka"
53
54     container:
55       image: ttl.sh/osm-krm-functions:24h
56       # imagePullPolicy: Always
57       env:
58       - name: DEBUG
59         value: "{{inputs.parameters.debug}}"
60       command: ["/app/scripts/entrypoint.sh"]
61       args:
62       - create_oka
63       - "{{inputs.parameters.oka_name}}"
64       - "{{inputs.parameters.oka_type}}"
65       - "{{inputs.parameters.project_name}}"
66       - "{{inputs.parameters.sw_catalogs_mount_path}}/{{inputs.parameters.cloned_sw_catalogs_folder_name}}"
67       - "{{inputs.parameters.oka_location}}"
68       - "{{inputs.parameters.tarball_file}}"
69       volumeMounts:
70       - name: sw-catalogs-repo-volume
71         mountPath: '{{inputs.parameters.sw_catalogs_mount_path}}'
72       - name: temp-volume
73         mountPath: '{{inputs.parameters.temp_volume_mount_path}}'
74     volumes:
75       - name: sw-catalogs-repo-volume
76         persistentVolumeClaim:
77           claimName: '{{inputs.parameters.sw_catalogs_volume_name}}'
78       - name: temp-volume
79         persistentVolumeClaim:
80           claimName: '{{inputs.parameters.temp_volume_name}}'
81     securityContext:
82       fsGroup: 10000
83     #   runAsUser: 10000
84     #   runAsGroup: 10000
85
86
87 # Update an OKA based on an OKA Package pre-loaded into a pvc
88   - name: update-oka
89     inputs:
90       parameters:
91       # References to required external resources
92       - name: sw_catalogs_volume_name
93       - name: temp_volume_name
94       # Specific parameters - OKA
95       - name: oka_name
96       ## Choose among `infra-controllers`, `infra-configs`, `cloud-resources`, `apps`:
97       - name: oka_type
98       - name: project_name
99         value: "osm_admin"
100       - name: tarball_file
101         value: "true"
102       # Debug?
103       - name: debug
104         value: "false"
105       # Other parameters - Do not touch
106       - name: sw_catalogs_mount_path
107         value: "/sw-catalogs"
108       - name: cloned_sw_catalogs_folder_name
109         value: "sw-catalogs-osm"
110       - name: temp_volume_mount_path
111         value: "/oka"
112       - name: oka_location
113         value: "/oka"
114
115     container:
116       image: ttl.sh/osm-krm-functions:24h
117       # imagePullPolicy: Always
118       env:
119       - name: DEBUG
120         value: "{{inputs.parameters.debug}}"
121       command: ["/app/scripts/entrypoint.sh"]
122       args:
123       - update_oka
124       - "{{inputs.parameters.oka_name}}"
125       - "{{inputs.parameters.oka_type}}"
126       - "{{inputs.parameters.project_name}}"
127       - "{{inputs.parameters.sw_catalogs_mount_path}}/{{inputs.parameters.cloned_sw_catalogs_folder_name}}"
128       - "{{inputs.parameters.oka_location}}"
129       - "{{inputs.parameters.tarball_file}}"
130       volumeMounts:
131       - name: sw-catalogs-repo-volume
132         mountPath: '{{inputs.parameters.sw_catalogs_mount_path}}'
133       - name: temp-volume
134         mountPath: '{{inputs.parameters.temp_volume_mount_path}}'
135     volumes:
136       - name: sw-catalogs-repo-volume
137         persistentVolumeClaim:
138           claimName: '{{inputs.parameters.sw_catalogs_volume_name}}'
139       - name: temp-volume
140         persistentVolumeClaim:
141           claimName: '{{inputs.parameters.temp_volume_name}}'
142     securityContext:
143       fsGroup: 10000
144     #   runAsUser: 10000
145     #   runAsGroup: 10000
146
147
148 # Delete an OKA
149   - name: delete-oka
150     inputs:
151       parameters:
152       # References to required external resources
153       - name: sw_catalogs_volume_name
154       # Specific parameters - OKA
155       - name: oka_name
156       ## Choose among `infra-controllers`, `infra-configs`, `cloud-resources`, `apps`:
157       - name: oka_type
158       - name: project_name
159         value: "osm_admin"
160       # Debug?
161       - name: debug
162         value: "false"
163       # Other parameters - Do not touch
164       - name: sw_catalogs_mount_path
165         value: "/sw-catalogs"
166       - name: cloned_sw_catalogs_folder_name
167         value: "sw-catalogs-osm"
168
169     container:
170       image: ttl.sh/osm-krm-functions:24h
171       # imagePullPolicy: Always
172       env:
173       - name: DEBUG
174         value: "{{inputs.parameters.debug}}"
175       command: ["/app/scripts/entrypoint.sh"]
176       args:
177       - delete_oka
178       - "{{inputs.parameters.oka_name}}"
179       - "{{inputs.parameters.oka_type}}"
180       - "{{inputs.parameters.project_name}}"
181       - "{{inputs.parameters.sw_catalogs_mount_path}}/{{inputs.parameters.cloned_sw_catalogs_folder_name}}"
182       volumeMounts:
183       - name: sw-catalogs-repo-volume
184         mountPath: '{{inputs.parameters.sw_catalogs_mount_path}}'
185     volumes:
186       - name: sw-catalogs-repo-volume
187         persistentVolumeClaim:
188           claimName: '{{inputs.parameters.sw_catalogs_volume_name}}'
189     securityContext:
190       fsGroup: 10000
191     #   runAsUser: 10000
192     #   runAsGroup: 10000