Add extra spec or property for nova bootstrap script

Change-Id: I69bc1e0a428b8ed012bea33161c88633aedf024b
Signed-off-by: Saeed Padari <sam137115@gmail.com>
This commit is contained in:
Saeed Padari
2025-08-04 01:38:50 +03:30
parent fe25761f31
commit 468f1466e5
2 changed files with 30 additions and 13 deletions

View File

@@ -18,20 +18,30 @@ set -ex
export HOME=/tmp
{{ if .Values.bootstrap.structured.flavors.enabled }}
{{ range .Values.bootstrap.structured.flavors.options }}
# NOTE(aostapenko) Since Wallaby with switch of osc to sdk '--id auto' is no
# longer treated specially. Though the same behavior can be achieved w/o specifying
#--id flag.
# https://review.opendev.org/c/openstack/python-openstackclient/+/750151
{{- range $i, $params := .Values.bootstrap.structured.flavors.options }}
{
openstack flavor show {{ .name }} || \
openstack flavor create {{ .name }} \
{{ if .id }} \
--id {{ .id }} \
{{ end }} \
--ram {{ .ram }} \
--disk {{ .disk }} \
--vcpus {{ .vcpus }}
openstack flavor show {{ $params.name }} || \
openstack flavor create \
{{- range $key, $val := $params }}
{{- if ne $key "name" }}
{{- if eq $key "extra_specs" }}
{{- if kindIs "slice" $val }}
{{- range $idx, $spec := $val }}
--property {{ $spec }} \
{{- end }}
{{- end }}
{{- else if eq $key "is_public" }}
{{- if $val }}
--public \
{{- else if not $val }}
--private \
{{- end }}
{{- else }}
--{{ $key }} {{ $val }} \
{{- end }}
{{- end }}
{{- end }}
{{ $params.name }}
} &
{{ end }}
wait

View File

@@ -0,0 +1,7 @@
---
nova:
- |
Refactored the flavor creation logic in the nova bootstrap script to simplify
and generalize flavor definitions using dynamic key/value iteration. This makes
the chart more maintainable and flexible for various flavor configurations.
...