17566d1fdd95312fa66791b3a349be77e967fcf6
[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: profile-management-wft
22   namespace: osm-workflows
23 spec:
24   templates:
25
26   # Create a profile
27   - name: create-profile
28     inputs:
29       parameters:
30       # Volumes with cloned repos
31       - name: fleet_volume_name
32       - name: fleet_mount_path
33         value: "/fleet"
34
35       # Specific parameters
36       - name: profile_name
37       - name: profile_type
38       - name: project_name
39         value: "osm_admin"
40       - name: fleet_repo_url
41
42       # Other parameters - Recommended to keep defaults
43       - name: fleet_repo_dir
44         value: "/fleet/fleet-osm/"
45
46     volumes:
47       - name: fleet-repo-volume
48         persistentVolumeClaim:
49           claimName: '{{inputs.parameters.fleet_volume_name}}'
50     container:
51       image: ttl.sh/osm-krm-functions:24h
52       # imagePullPolicy: Always
53       volumeMounts:
54       - name: fleet-repo-volume
55         mountPath: '{{inputs.parameters.fleet_mount_path}}'
56       command: ["/app/scripts/entrypoint.sh"]
57       args:
58       - create_profile
59       - "{{inputs.parameters.profile_name}}"
60       - "{{inputs.parameters.profile_type}}"
61       - "{{inputs.parameters.project_name}}"
62       - "{{inputs.parameters.fleet_repo_url}}"
63       - "{{inputs.parameters.fleet_repo_dir}}"
64     securityContext:
65       fsGroup: 10000
66     #   runAsUser: 10000
67     #   runAsGroup: 10000
68
69
70   # Delete a profile
71   - name: delete-profile
72     inputs:
73       parameters:
74       # Volumes with cloned repos
75       - name: fleet_volume_name
76       - name: fleet_mount_path
77         value: "/fleet"
78
79       # Specific parameters
80       - name: profile_name
81       - name: profile_type
82       - name: project_name
83         value: "osm_admin"
84
85       # Other parameters - Recommended to keep defaults
86       - name: fleet_repo_dir
87         value: "/fleet/fleet-osm/"
88
89     volumes:
90       - name: fleet-repo-volume
91         persistentVolumeClaim:
92           claimName: '{{inputs.parameters.fleet_volume_name}}'
93     container:
94       image: ttl.sh/osm-krm-functions:24h
95       # imagePullPolicy: Always
96       volumeMounts:
97       - name: fleet-repo-volume
98         mountPath: '{{inputs.parameters.fleet_mount_path}}'
99       command: ["/app/scripts/entrypoint.sh"]
100       args:
101       - delete_profile
102       - "{{inputs.parameters.profile_name}}"
103       - "{{inputs.parameters.profile_type}}"
104       - "{{inputs.parameters.project_name}}"
105       - "{{inputs.parameters.fleet_repo_dir}}"
106     securityContext:
107       fsGroup: 10000
108     #   runAsUser: 10000
109     #   runAsGroup: 10000
110
111
112   # Attach a profile to a cluster
113   - name: attach-profile-to-cluster
114     inputs:
115       parameters:
116       # Volumes with cloned repos
117       - name: fleet_volume_name
118       - name: fleet_mount_path
119         value: "/fleet"
120
121       # Specific parameters
122       - name: profile_name
123       - name: profile_type
124       - name: project_name
125         value: "osm_admin"
126       - name: cluster_kustomization_name
127
128       # Other parameters - Recommended to keep defaults
129       - name: fleet_repo_dir
130         value: "/fleet/fleet-osm/"
131     volumes:
132       - name: fleet-repo-volume
133         persistentVolumeClaim:
134           claimName: '{{inputs.parameters.fleet_volume_name}}'
135     container:
136       image: ttl.sh/osm-krm-functions:24h
137       # imagePullPolicy: Always
138       volumeMounts:
139       - name: fleet-repo-volume
140         mountPath: '{{inputs.parameters.fleet_mount_path}}'
141       command: ["/app/scripts/entrypoint.sh"]
142       args:
143       - attach_profile_to_cluster
144       - "{{inputs.parameters.profile_name}}"
145       - "{{inputs.parameters.profile_type}}"
146       - "{{inputs.parameters.project_name}}"
147       - "{{inputs.parameters.cluster_kustomization_name}}"
148       - "{{inputs.parameters.fleet_repo_dir}}"
149     securityContext:
150       fsGroup: 10000
151     #   runAsUser: 10000
152     #   runAsGroup: 10000
153
154
155   # Detach profile from cluster
156   - name: detach-profile-from-cluster
157     inputs:
158       parameters:
159       # Volumes with cloned repos
160       - name: fleet_volume_name
161       - name: fleet_mount_path
162         value: "/fleet"
163
164       # Specific parameters
165       - name: profile_name
166       - name: profile_type
167       - name: project_name
168         value: "osm_admin"
169       - name: cluster_kustomization_name
170
171       # Other parameters - Recommended to keep defaults
172       - name: fleet_repo_dir
173         value: "/fleet/fleet-osm/"
174     volumes:
175       - name: fleet-repo-volume
176         persistentVolumeClaim:
177           claimName: '{{inputs.parameters.fleet_volume_name}}'
178     container:
179       image: ttl.sh/osm-krm-functions:24h
180       # imagePullPolicy: Always
181       volumeMounts:
182       - name: fleet-repo-volume
183         mountPath: '{{inputs.parameters.fleet_mount_path}}'
184       command: ["/app/scripts/entrypoint.sh"]
185       args:
186       - detach_profile_from_cluster
187       - "{{inputs.parameters.profile_name}}"
188       - "{{inputs.parameters.profile_type}}"
189       - "{{inputs.parameters.project_name}}"
190       - "{{inputs.parameters.cluster_kustomization_name}}"
191       - "{{inputs.parameters.fleet_repo_dir}}"
192     securityContext:
193       fsGroup: 10000
194     #   runAsUser: 10000
195     #   runAsGroup: 10000