okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 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 implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */}} |
| 16 | |
| 17 | set -ex |
| 18 | export HOME=/tmp |
| 19 | |
| 20 | cd $HOME |
| 21 | |
| 22 | {{ range .Values.bootstrap.structured.images }} |
| 23 | openstack image show {{ .name | quote }} || \ |
okozachenko1203 | 5f08910 | 2023-03-24 23:42:22 +1100 | [diff] [blame] | 24 | (curl --fail -sSL -O {{ .source_url }}{{ .image_file }}; \ |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 25 | 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 |
okozachenko1203 | 5f08910 | 2023-03-24 23:42:22 +1100 | [diff] [blame] | 35 | {{- end -}};) |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 36 | {{ end }} |
| 37 | |
okozachenko1203 | 85370ca | 2023-03-24 23:16:18 +1100 | [diff] [blame] | 38 | {{ range .Values.bootstrap.structured.flavors }} |
| 39 | openstack 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 |
okozachenko1203 | 5f08910 | 2023-03-24 23:42:22 +1100 | [diff] [blame] | 50 | {{- end -}}; |
okozachenko1203 | 85370ca | 2023-03-24 23:16:18 +1100 | [diff] [blame] | 51 | {{ end }} |
| 52 | |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 53 | openstack share type show default || \ |
| 54 | openstack share type create default true \ |
| 55 | --public true --description "default generic share type" |
| 56 | openstack share group type show default || \ |
| 57 | openstack share group type create default default --public true |
| 58 | |
| 59 | {{ .Values.bootstrap.script | default "echo 'Not Enabled'" }} |