64917be1fb68d34c73dc60aed617f721e9d886bb
[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       # securityContext:
54       #   runAsUser: 10000
55       #   runAsGroup: 10000
56       #   fsGroup: 10000
57       volumeMounts:
58       - name: fleet-repo-volume
59         mountPath: '{{inputs.parameters.fleet_mount_path}}'
60       command: ["/app/scripts/entrypoint.sh"]
61       args:
62       - create_profile
63       - "{{inputs.parameters.profile_name}}"
64       - "{{inputs.parameters.profile_type}}"
65       - "{{inputs.parameters.project_name}}"
66       - "{{inputs.parameters.fleet_repo_url}}"
67       - "{{inputs.parameters.fleet_repo_dir}}"
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       # securityContext:
97       #   runAsUser: 10000
98       #   runAsGroup: 10000
99       #   fsGroup: 10000
100       volumeMounts:
101       - name: fleet-repo-volume
102         mountPath: '{{inputs.parameters.fleet_mount_path}}'
103       command: ["/app/scripts/entrypoint.sh"]
104       args:
105       - delete_profile
106       - "{{inputs.parameters.profile_name}}"
107       - "{{inputs.parameters.profile_type}}"
108       - "{{inputs.parameters.project_name}}"
109       - "{{inputs.parameters.fleet_repo_dir}}"
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       # securityContext:
139       #   runAsUser: 10000
140       #   runAsGroup: 10000
141       #   fsGroup: 10000
142       volumeMounts:
143       - name: fleet-repo-volume
144         mountPath: '{{inputs.parameters.fleet_mount_path}}'
145       command: ["/app/scripts/entrypoint.sh"]
146       args:
147       - attach_profile_to_cluster
148       - "{{inputs.parameters.profile_name}}"
149       - "{{inputs.parameters.profile_type}}"
150       - "{{inputs.parameters.project_name}}"
151       - "{{inputs.parameters.cluster_kustomization_name}}"
152       - "{{inputs.parameters.fleet_repo_dir}}"
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       # securityContext:
182       #   runAsUser: 10000
183       #   runAsGroup: 10000
184       #   fsGroup: 10000
185       volumeMounts:
186       - name: fleet-repo-volume
187         mountPath: '{{inputs.parameters.fleet_mount_path}}'
188       command: ["/app/scripts/entrypoint.sh"]
189       args:
190       - detach_profile_from_cluster
191       - "{{inputs.parameters.profile_name}}"
192       - "{{inputs.parameters.profile_type}}"
193       - "{{inputs.parameters.project_name}}"
194       - "{{inputs.parameters.cluster_kustomization_name}}"
195       - "{{inputs.parameters.fleet_repo_dir}}"