6a59d34ece15a55b6107fe40efd27ab1d6446c16
[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: full-delete-crossplane-providerconfig
22   namespace: osm-workflows
23
24 spec:
25   arguments:
26     parameters:
27     # Fleet repo
28     - name: git_fleet_url
29     - name: fleet_destination_folder
30     - name: git_fleet_cred_secret
31     # SW-Catalogs repo
32     - name: git_sw_catalogs_url
33     - name: sw_catalogs_destination_folder
34     - name: git_sw_catalogs_cred_secret
35
36     # Specific parameters
37     - name: providerconfig_name
38     ## As of today, one among `azure`, `aws` or `gcp`
39     - name: provider_type
40     - name: osm_project_name
41       value: "osm_admin"
42     # Debug/dry run?
43     - name: debug
44       value: "false"
45     - name: dry_run
46       value: "false"
47
48   # Cleanup policy
49   ttlStrategy:
50     secondsAfterCompletion: 6000  # Time to live after workflow is completed, replaces ttlSecondsAfterFinished
51     secondsAfterSuccess: 6000     # Time to live after workflow is successful
52     secondsAfterFailure: 9000     # Time to live after workflow fails
53
54   entrypoint: delete-crossplane-providerconfig
55
56   templates:
57
58   # Main template
59   - name: delete-crossplane-providerconfig
60     inputs:
61       parameters:
62       # Fleet repo
63       - name: git_fleet_url
64       - name: fleet_destination_folder
65       - name: git_fleet_cred_secret
66       # SW-Catalogs repo
67       - name: git_sw_catalogs_url
68       - name: sw_catalogs_destination_folder
69       - name: git_sw_catalogs_cred_secret
70       # Specific parameters
71       - name: providerconfig_name
72       - name: provider_type
73       - name: osm_project_name
74       # Debug/dry run?
75       - name: debug
76         value: "false"
77       - name: dry_run
78         value: "false"
79
80     steps:
81
82     # ------ Preparations for transaction
83     - - name: generate-fleet-volume-repo
84         templateRef:
85           name: k8s-resources-wft
86           template: generate-volume
87         arguments:
88           parameters:
89             - name: pvc-size
90               value: '100Mi'
91       - name: generate-sw-catalogs-volume-repo
92         templateRef:
93           name: k8s-resources-wft
94           template: generate-volume
95         arguments:
96           parameters:
97             - name: pvc-size
98               value: '100Mi'
99     - - name: clone-fleet
100         templateRef:
101           name: git-wft
102           template: git-clone
103         arguments:
104           parameters:
105           - name: mount_path
106             value: "/fleet"
107           - name: repo_url
108             value: "{{inputs.parameters.git_fleet_url}}"
109           - name: destination_folder
110             value: "{{inputs.parameters.fleet_destination_folder}}"
111           - name: git_cred_secret
112             value: "{{inputs.parameters.git_fleet_cred_secret}}"
113           - name: git_volume_name
114             value: '{{steps.generate-fleet-volume-repo.outputs.parameters.pvc-name}}'
115       - name: clone-sw-catalogs
116         templateRef:
117           name: git-wft
118           template: git-clone
119         arguments:
120           parameters:
121           - name: mount_path
122             value: "/sw-catalogs"
123           - name: repo_url
124             value: "{{inputs.parameters.git_sw_catalogs_url}}"
125           - name: destination_folder
126             value: "{{inputs.parameters.sw_catalogs_destination_folder}}"
127           - name: git_cred_secret
128             value: "{{inputs.parameters.git_sw_catalogs_cred_secret}}"
129           - name: git_volume_name
130             value: '{{steps.generate-sw-catalogs-volume-repo.outputs.parameters.pvc-name}}'
131     # ------ end of preparations for transaction
132
133     # ------ Transformations
134     - - name: delete-crossplane-providerconfig
135         templateRef:
136           name: cloud-accounts-wft
137           template: delete-crossplane-providerconfig
138         arguments:
139           parameters:
140           # References to required external resources
141           - name: fleet_volume_name
142             value: '{{steps.generate-fleet-volume-repo.outputs.parameters.pvc-name}}'
143           - name: sw_catalogs_volume_name
144             value: '{{steps.generate-sw-catalogs-volume-repo.outputs.parameters.pvc-name}}'
145           # Specific parameters
146           - name: providerconfig_name
147             value: "{{inputs.parameters.providerconfig_name}}"
148           - name: provider_type
149             value: "{{inputs.parameters.provider_type}}"
150           - name: osm_project_name
151             value: "{{inputs.parameters.osm_project_name}}"
152           # Debug?
153           - name: debug
154             value: "{{inputs.parameters.debug}}"
155     # ------ end of transformations
156
157     # ------ Commit transaction
158     - - name: push-to-fleet
159         templateRef:
160           name: git-wft
161           template: git-commit-merge-push
162         arguments:
163           parameters:
164           - name: mount_path
165             value: "/fleet"
166           - name: repo_folder
167             value: "{{inputs.parameters.fleet_destination_folder}}"
168           - name: git_cred_secret
169             value: "{{inputs.parameters.git_fleet_cred_secret}}"
170           - name: git_volume_name
171             value: '{{steps.generate-fleet-volume-repo.outputs.parameters.pvc-name}}'
172           - name: commit_message
173             value: "Delete ProviderConfig {{inputs.parameters.providerconfig_name}} for {{inputs.parameters.provider_type}}"
174           - name: main_branch
175             value: main
176           - name: contrib_branch
177             value: osm_contrib
178           - name: dry_run
179             value: "{{inputs.parameters.dry_run}}"
180 # ------ end of commit transaction