Fix warning reported by ShellCheck regarding PR #213 #230

Merged
mchiappero merged 1 commits from mchiappero/Factory:shellcheck_213 into main 2025-08-08 09:56:29 +02:00
Owner
No description provided.
mchiappero added 9 commits 2025-08-06 21:41:02 +02:00
The purpose of this commit is to:
- avoid providing IRONIC_EXTERNAL_HTTP_URL by default, as the Ironic
  startup scripts will be able to derive the value from other variables
- define a new global value under the top values.yaml to generate
  IRONIC_EXTERNAL_HTTP_URL when actually needed
- make sure that the input, which can either be a hostname or an IP
  address, is correctly formatted in case of an IPv6.

This change also allows subsequent cleanups of the whole Configmap
template for Ironic.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
Since currently we can only define the provisioning network and the
external HTTP host, remove some clutter generating unused variables.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
Create a new provisioningHostname value in values.yaml in order to set
the new IRONIC_URL_HOSTNAME, that allows to set the address(es) Ironic
will bind to.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
It should be possible to enable or disable the environment variable
LISTEN_ALL_INTERFACE in the Ironic configmap, as it allows to the way
Ironic binds to socket, especially in combination with the changes
introduced in v29.

However, if listenOnAll is false, Ironic will bind to a specific IPv4
and/or IPv6 address and the 127.0.0.1 address used for the liveness
and readiness probe will not be accepted. Also add a named template
that, when it is set to false, picks a different host IP or address,
according to the following priority:
- ironicIP (deprecated)
- provisioningIP
- provisioningHostname

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
So far ironicIP has been part of values.yaml under the global section,
however this is very misleading: this variable is internal to the Ironic
startup scripts and should not be set, moreover it conflicts with
provisioningIP, which is instead a public configuration variable for the
purpose.

This commits thus introduces the following changes:
- removes the creation of IRONIC_IP in the Ironic configmap
- does not yet remove ironicIP from values.yaml to avoid breaking
  forward compatibility
- introduces a utility function to perform input validation while still
  prioritizing ironicIP if present

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
Recently provisioningHostname has been introduced as an alternative way
to configure the IPs to bind and respond to. This however requires that
the Certificates for HTTPS also include a dnsNames section whenver such
value is present.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
The BMO should now connect via the provisioningHostname if set or an IP
address. Add a helper that returns the ironic hostname or correctly
formatted IP to define the ironicApiHost variable in the BMO configmap.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
Enable PreferDualStack on all the Services in the subcharts
All checks were successful
Check Release Manifest Local Charts Versions / Check Release Manifest Local Charts Versions (pull_request) Successful in 1s
Build PR in OBS / Build PR in OBS (pull_request_target) Successful in 4m27s
e233adfec2
Make sure that the services are created with both IPv4 and IPv6
addresses when the cluster has been created with both IPv4 and IPv6
ranges. They will behave as single stack otherwise.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
Fix a few ShellCheck reported warnings from PR #213
Some checks failed
Check Release Manifest Local Charts Versions / Check Release Manifest Local Charts Versions (pull_request) Successful in -11s
Build PR in OBS / Build PR in OBS (pull_request_target) Failing after 1m6s
300d5e21bd
The checks on the upstream project have reported some warnings to the
code accepted in PR #213, fix them in this commit.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
mchiappero force-pushed shellcheck_213 from 300d5e21bd to 390f500c42 2025-08-06 21:42:13 +02:00 Compare
mchiappero requested review from eminguez 2025-08-07 09:20:54 +02:00
mchiappero requested review from kzhelyazkov 2025-08-07 09:20:54 +02:00
eminguez approved these changes 2025-08-07 09:28:59 +02:00
eminguez left a comment
Owner

Nits about using {} to protect expansions

Nits about using {} to protect expansions
@@ -54,3 +54,3 @@
if [[ "$(echo "$LISTEN_ALL_INTERFACES" | tr '[:upper:]' '[:lower:]')" == "true" ]]; then
export IRONIC_HOST_IP="::"
elif [[ -n env.ENABLE_IPV6 ]]; then
elif [[ -n "$ENABLE_IPV6" ]]; then
Owner

elif [[ -n "${ENABLE_IPV6}" ]]; then

`elif [[ -n "${ENABLE_IPV6}" ]]; then`
@@ -56,3 +56,3 @@
local HOSTNAME=$1
echo "$(nslookup -type=${QUERY} $HOSTNAME | tail -n2 | grep -w "Address:" | cut -d " " -f2)"
echo $(nslookup -type=${QUERY} "$HOSTNAME" | tail -n2 | grep -w "Address:" | cut -d " " -f2)
Owner

echo $(nslookup -type=${QUERY} "${HOSTNAME}" | tail -n2 | grep -w "Address:" | cut -d " " -f2)

`echo $(nslookup -type=${QUERY} "${HOSTNAME}" | tail -n2 | grep -w "Address:" | cut -d " " -f2)`
@@ -86,3 +86,3 @@
IP_ADDR="$(ipcalc "${IP_ADDR}" | grep "^Address:" | awk '{print $2}')"
echo "$(ip $IP_VERS -br addr show scope global | grep -i " ${IP_ADDR}/" | cut -f 1 -d ' ' | cut -f 1 -d '@')"
echo $(ip "$IP_VERS" -br addr show scope global | grep -i " ${IP_ADDR}/" | cut -f 1 -d ' ' | cut -f 1 -d '@')
Owner

echo $(ip "${IP_VERS}" -br addr show scope global | grep -i " ${IP_ADDR}/" | cut -f 1 -d ' ' | cut -f 1 -d '@')

`echo $(ip "${IP_VERS}" -br addr show scope global | grep -i " ${IP_ADDR}/" | cut -f 1 -d ' ' | cut -f 1 -d '@') `
@@ -112,3 +112,3 @@
local IFACE=$1
echo "$(ip $IP_VERS -br addr show scope global up dev $IFACE | awk '{print $3}' | sed -e 's%/.*%%' | head -n 1)"
echo $(ip "$IP_VERS" -br addr show scope global up dev $IFACE | awk '{print $3}' | sed -e 's%/.*%%' | head -n 1)
Owner

echo $(ip "${IP_VERS}" -br addr show scope global up dev ${IFACE} | awk '{print $3}' | sed -e 's%/.*%%' | head -n 1)

`echo $(ip "${IP_VERS}" -br addr show scope global up dev ${IFACE} | awk '{print $3}' | sed -e 's%/.*%%' | head -n 1) `
@@ -151,3 +151,3 @@
until [[ -n "$IFACE_OF_IP" ]]; do
echo "Waiting for ${PROVISIONING_IP} to be configured on an interface..."
IFACE_OF_IP="$(get_interface_of_ip $PROVISIONING_IP)"
IFACE_OF_IP="$(get_interface_of_ip "$PROVISIONING_IP")"
Owner

IFACE_OF_IP="$(get_interface_of_ip "${PROVISIONING_IP}")"

`IFACE_OF_IP="$(get_interface_of_ip "${PROVISIONING_IP}")"`
@@ -168,3 +168,3 @@
echo "Waiting for ${PROVISIONING_INTERFACE} interface to be configured..."
export IRONIC_IPV6="$(get_ip_of_interface $PROVISIONING_INTERFACE 6)"
IRONIC_IPV6="$(get_ip_of_interface "$PROVISIONING_INTERFACE" 6)"
Owner

IRONIC_IPV6="$(get_ip_of_interface "${PROVISIONING_INTERFACE}" 6)"

` IRONIC_IPV6="$(get_ip_of_interface "${PROVISIONING_INTERFACE}" 6)"`
@@ -171,3 +171,3 @@
sleep 1
export IRONIC_IP="$(get_ip_of_interface $PROVISIONING_INTERFACE 4)"
IRONIC_IP="$(get_ip_of_interface "$PROVISIONING_INTERFACE" 4)"
Owner

IRONIC_IP="$(get_ip_of_interface "${PROVISIONING_INTERFACE}" 4)"

` IRONIC_IP="$(get_ip_of_interface "${PROVISIONING_INTERFACE}" 4)"`
@@ -191,3 +193,2 @@
IPV6_RECORD="$(get_ip_of_hostname $IRONIC_URL_HOSTNAME 6)"
IPV4_RECORD="$(get_ip_of_hostname $IRONIC_URL_HOSTNAME 4)"
IPV6_RECORD="$(get_ip_of_hostname "$IRONIC_URL_HOSTNAME" 6)"
Owner

IPV6_RECORD="$(get_ip_of_hostname "${IRONIC_URL_HOSTNAME}" 6)"

` IPV6_RECORD="$(get_ip_of_hostname "${IRONIC_URL_HOSTNAME}" 6)"`
@@ -192,2 +194,2 @@
IPV6_RECORD="$(get_ip_of_hostname $IRONIC_URL_HOSTNAME 6)"
IPV4_RECORD="$(get_ip_of_hostname $IRONIC_URL_HOSTNAME 4)"
IPV6_RECORD="$(get_ip_of_hostname "$IRONIC_URL_HOSTNAME" 6)"
IPV4_RECORD="$(get_ip_of_hostname "$IRONIC_URL_HOSTNAME" 4)"
Owner

IPV4_RECORD="$(get_ip_of_hostname "${IRONIC_URL_HOSTNAME}" 4)"

`IPV4_RECORD="$(get_ip_of_hostname "${IRONIC_URL_HOSTNAME}" 4)"`
@@ -200,3 +202,3 @@
echo "Waiting for ${IPV6_RECORD} to be configured on an interface"
IPV6_IFACE="$(get_interface_of_ip $IPV6_RECORD 6)"
IPV6_IFACE="$(get_interface_of_ip "$IPV6_RECORD" 6)"
Owner

IPV6_IFACE="$(get_interface_of_ip "${IPV6_RECORD}" 6)"

`IPV6_IFACE="$(get_interface_of_ip "${IPV6_RECORD}" 6)"`
@@ -204,3 +206,3 @@
echo "Waiting for ${IPV4_RECORD} to be configured on an interface"
IPV4_IFACE="$(get_interface_of_ip $IPV4_RECORD 4)"
IPV4_IFACE="$(get_interface_of_ip "$IPV4_RECORD" 4)"
Owner

IPV4_IFACE="$(get_interface_of_ip "${IPV4_RECORD}" 4)"

` IPV4_IFACE="$(get_interface_of_ip "${IPV4_RECORD}" 4)"`
Author
Owner

Nits about using {} to protect expansions

Are they needed in the above contexts? I have skipped them as I thought they made no difference here, but I'll add them anyway. Thank you for reviewing!

> Nits about using {} to protect expansions Are they needed in the above contexts? I have skipped them as I thought they made no difference here, but I'll add them anyway. Thank you for reviewing!
Owner

Nits about using {} to protect expansions

Are they needed in the above contexts? I have skipped them as I thought they made no difference here, but I'll add them anyway. Thank you for reviewing!

I won't say needed but AFAIK it won't hurt :D (I'm old)

> > Nits about using {} to protect expansions > > Are they needed in the above contexts? I have skipped them as I thought they made no difference here, but I'll add them anyway. Thank you for reviewing! I won't say _needed_ but AFAIK it won't hurt :D (I'm old)
mchiappero force-pushed shellcheck_213 from 390f500c42 to 66c168cce4 2025-08-07 16:30:26 +02:00 Compare
mchiappero force-pushed shellcheck_213 from 66c168cce4 to 1457086081 2025-08-07 16:43:10 +02:00 Compare
mchiappero force-pushed shellcheck_213 from 1457086081 to 27af056dce 2025-08-07 22:20:20 +02:00 Compare
mchiappero merged commit 27af056dce into main 2025-08-08 09:56:29 +02:00
mchiappero deleted branch shellcheck_213 2025-08-08 09:56:29 +02:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: suse-edge/Factory#230
No description provided.