1 #######################################################################################
2 # Copyright ETSI Contributors and Others.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #######################################################################################
18 apiVersion: argoproj.io/v1alpha1
19 kind: WorkflowTemplate
21 name: cloud-accounts-wft
22 namespace: osm-workflows
26 # Create a `ProviderConfig` for CrossPlane
27 - name: create-crossplane-providerconfig
30 # Volumes with cloned repos
31 - name: fleet_volume_name
32 - name: fleet_mount_path
34 - name: sw_catalogs_volume_name
35 - name: sw_catalogs_mount_path
39 - name: providerconfig_name
40 ## As of today, one among `azure`, `aws` or `gcp`
42 ## Final secret to reference from the `ProviderConfig`
43 - name: cred_secret_name
44 ## Temporary secret with secret contents for the workflow
45 ## - If `temp_cred_secret_name` is empty, assumes that the final secret already exists
46 - name: temp_cred_secret_name
48 - name: temp_cred_secret_key
50 - name: age_public_key_mgmt
51 - name: osm_project_name
53 ## Specific parameters - GCP only
54 - name: target_gcp_project
60 # Other parameters - Do not touch
61 - name: cred_secret_key
63 - name: mgmt_cluster_name
65 - name: cred_secret_ns
66 value: "crossplane-system"
67 - name: base_templates_path
68 value: "infra-configs/crossplane/providers"
69 - name: cloned_fleet_folder_name
71 - name: cloned_sw_catalogs_folder_name
72 value: "sw-catalogs-osm"
75 image: ttl.sh/osm-krm-functions:24h
76 # imagePullPolicy: Always
78 - name: CRED_SECRET_CONTENT
81 name: "{{inputs.parameters.temp_cred_secret_name}}"
82 key: "{{inputs.parameters.temp_cred_secret_key}}"
85 value: "{{inputs.parameters.debug}}"
86 command: ["/app/scripts/entrypoint.sh"]
88 - create_crossplane_providerconfig
89 - "{{inputs.parameters.providerconfig_name}}"
90 - "{{inputs.parameters.provider_type}}"
91 - "{{inputs.parameters.cred_secret_name}}"
92 - "{{inputs.parameters.cred_secret_key}}"
93 - "{{inputs.parameters.cred_secret_ns}}"
95 - "{{inputs.parameters.age_public_key_mgmt}}"
96 - "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
97 - "{{inputs.parameters.sw_catalogs_mount_path}}/{{inputs.parameters.cloned_sw_catalogs_folder_name}}"
98 - "{{inputs.parameters.target_gcp_project}}"
99 - "{{inputs.parameters.base_templates_path}}"
100 - "{{inputs.parameters.osm_project_name}}"
101 - "{{inputs.parameters.mgmt_cluster_name}}"
103 - name: fleet-repo-volume
104 mountPath: '{{inputs.parameters.fleet_mount_path}}'
105 - name: sw-catalogs-repo-volume
106 mountPath: '{{inputs.parameters.sw_catalogs_mount_path}}'
108 - name: fleet-repo-volume
109 persistentVolumeClaim:
110 claimName: '{{inputs.parameters.fleet_volume_name}}'
111 - name: sw-catalogs-repo-volume
112 persistentVolumeClaim:
113 claimName: '{{inputs.parameters.sw_catalogs_volume_name}}'
120 # Update a `ProviderConfig` for CrossPlane
121 - name: update-crossplane-providerconfig
124 # Volumes with cloned repos
125 - name: fleet_volume_name
126 - name: fleet_mount_path
128 - name: sw_catalogs_volume_name
129 - name: sw_catalogs_mount_path
130 value: "/sw-catalogs"
132 # Specific parameters
133 - name: providerconfig_name
134 ## As of today, one among `azure`, `aws` or `gcp`
135 - name: provider_type
136 ## Final secret to reference from the `ProviderConfig`
137 - name: cred_secret_name
138 ## Temporary secret with secret contents for the workflow
139 ## - If `temp_cred_secret_name` is empty, assumes that the final secret already exists
140 - name: temp_cred_secret_name
142 - name: temp_cred_secret_key
144 - name: age_public_key_mgmt
145 - name: osm_project_name
147 ## Specific parameters - GCP only
148 - name: target_gcp_project
154 # Other parameters - Do not touch
155 - name: cred_secret_key
157 - name: mgmt_cluster_name
159 - name: cred_secret_ns
160 value: "crossplane-system"
161 - name: base_templates_path
162 value: "infra-configs/crossplane/providers"
163 - name: cloned_fleet_folder_name
165 - name: cloned_sw_catalogs_folder_name
166 value: "sw-catalogs-osm"
169 image: ttl.sh/osm-krm-functions:24h
170 # imagePullPolicy: Always
172 - name: CRED_SECRET_CONTENT
175 name: "{{inputs.parameters.temp_cred_secret_name}}"
176 key: "{{inputs.parameters.temp_cred_secret_key}}"
179 value: "{{inputs.parameters.debug}}"
180 command: ["/app/scripts/entrypoint.sh"]
182 - update_crossplane_providerconfig
183 - "{{inputs.parameters.providerconfig_name}}"
184 - "{{inputs.parameters.provider_type}}"
185 - "{{inputs.parameters.cred_secret_name}}"
186 - "{{inputs.parameters.cred_secret_key}}"
187 - "{{inputs.parameters.cred_secret_ns}}"
189 - "{{inputs.parameters.age_public_key_mgmt}}"
190 - "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
191 - "{{inputs.parameters.sw_catalogs_mount_path}}/{{inputs.parameters.cloned_sw_catalogs_folder_name}}"
192 - "{{inputs.parameters.target_gcp_project}}"
193 - "{{inputs.parameters.base_templates_path}}"
194 - "{{inputs.parameters.osm_project_name}}"
195 - "{{inputs.parameters.mgmt_cluster_name}}"
197 - name: fleet-repo-volume
198 mountPath: '{{inputs.parameters.fleet_mount_path}}'
199 - name: sw-catalogs-repo-volume
200 mountPath: '{{inputs.parameters.sw_catalogs_mount_path}}'
202 - name: fleet-repo-volume
203 persistentVolumeClaim:
204 claimName: '{{inputs.parameters.fleet_volume_name}}'
205 - name: sw-catalogs-repo-volume
206 persistentVolumeClaim:
207 claimName: '{{inputs.parameters.sw_catalogs_volume_name}}'
215 # Delete a `ProviderConfig` for CrossPlane
216 - name: delete-crossplane-providerconfig
219 # Volumes with cloned repos
220 - name: fleet_volume_name
221 - name: fleet_mount_path
223 - name: sw_catalogs_volume_name
224 - name: sw_catalogs_mount_path
225 value: "/sw-catalogs"
227 # Specific parameters
228 - name: providerconfig_name
229 ## As of today, one among `azure`, `aws` or `gcp`
230 - name: provider_type
231 - name: osm_project_name
237 # Other parameters - Do not touch
238 - name: mgmt_cluster_name
240 - name: cloned_fleet_folder_name
244 image: ttl.sh/osm-krm-functions:24h
245 # imagePullPolicy: Always
248 value: "{{inputs.parameters.debug}}"
249 command: ["/app/scripts/entrypoint.sh"]
251 - delete_crossplane_providerconfig
252 - "{{inputs.parameters.providerconfig_name}}"
253 - "{{inputs.parameters.provider_type}}"
254 - "{{inputs.parameters.fleet_mount_path}}/{{inputs.parameters.cloned_fleet_folder_name}}"
255 - "{{inputs.parameters.osm_project_name}}"
256 - "{{inputs.parameters.mgmt_cluster_name}}"
258 - name: fleet-repo-volume
259 mountPath: '{{inputs.parameters.fleet_mount_path}}'
261 - name: fleet-repo-volume
262 persistentVolumeClaim:
263 claimName: '{{inputs.parameters.fleet_volume_name}}'