blob: eaa06962a3b4e33485955eea64f87f67f526b70a [file] [log] [blame]
okozachenko120361008f72023-03-23 21:21:09 +11001#!/bin/bash
2
3{{/*
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17set -ex
18export HOME=/tmp
19
20cd $HOME
21
22{{ range .Values.bootstrap.structured.images }}
23openstack image show {{ .name | quote }} || \
okozachenko12035f089102023-03-24 23:42:22 +110024 (curl --fail -sSL -O {{ .source_url }}{{ .image_file }}; \
okozachenko120361008f72023-03-23 21:21:09 +110025 openstack image create {{ .name | quote }} \
26 {{ if .id -}} --id {{ .id }} {{ end -}} \
27 --disk-format {{ .image_type }} \
28 --file {{ .image_file }} \
29 {{ if .properties -}} {{ range $key, $value := .properties }}--property {{$key}}={{$value}} {{ end }}{{ end -}} \
30 --container-format {{ .container_format | quote }} \
31 {{ if .private -}}
32 --private
33 {{- else -}}
34 --public
okozachenko12035f089102023-03-24 23:42:22 +110035 {{- end -}};)
okozachenko120361008f72023-03-23 21:21:09 +110036{{ end }}
37
okozachenko120385370ca2023-03-24 23:16:18 +110038{{ range .Values.bootstrap.structured.flavors }}
39openstack flavor show {{ .name | quote }} || \
40 openstack flavor create {{ .name | quote }} \
41 {{ if .id -}} --id {{ .id }} {{ end -}} \
42 --ram {{ .ram }} \
43 --vcpus {{ .vcpus }} \
44 --disk {{ .disk }} \
45 --ephemeral {{ .ephemeral }} \
46 {{ if .public -}}
47 --public
48 {{- else -}}
49 --private
okozachenko12035f089102023-03-24 23:42:22 +110050 {{- end -}};
okozachenko120385370ca2023-03-24 23:16:18 +110051{{ end }}
52
okozachenko120361008f72023-03-23 21:21:09 +110053openstack share type show default || \
54 openstack share type create default true \
55 --public true --description "default generic share type"
56openstack share group type show default || \
57 openstack share group type create default default --public true
58
59{{ .Values.bootstrap.script | default "echo 'Not Enabled'" }}