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 export HOME=/tmp
{{ if .Values.bootstrap.structured.flavors.enabled }} {{ if .Values.bootstrap.structured.flavors.enabled }}
{{ range .Values.bootstrap.structured.flavors.options }} {{- range $i, $params := .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
{ {
openstack flavor show {{ .name }} || \ openstack flavor show {{ $params.name }} || \
openstack flavor create {{ .name }} \ openstack flavor create \
{{ if .id }} \ {{- range $key, $val := $params }}
--id {{ .id }} \ {{- if ne $key "name" }}
{{ end }} \ {{- if eq $key "extra_specs" }}
--ram {{ .ram }} \ {{- if kindIs "slice" $val }}
--disk {{ .disk }} \ {{- range $idx, $spec := $val }}
--vcpus {{ .vcpus }} --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 }} {{ end }}
wait 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.
...