Skip to content

Commit

Permalink
remove tests directory from the octavia_preconf role and enclose vari…
Browse files Browse the repository at this point in the history
…able names in double quotes in shell scripts
  • Loading branch information
puni4220 committed Jan 17, 2025
1 parent 75ab80d commit e9f473b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 20 deletions.
10 changes: 5 additions & 5 deletions ansible/roles/octavia_preconf/files/create_health_mgr_ports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ CONTROLLER_IP_PORT_LIST=''
CTRLS=$(kubectl get nodes -l openstack-control-plane=enabled -o name | awk -F"/" '{print $2}')
for node in $CTRLS
do
node_short=$(echo $node | awk -F"." '{print $1}')
node_short=$(echo "$node" | awk -F"." '{print $1}')
PORTNAME=octavia-health-manager-port-$node_short
PORT_ID=$(openstack port create $PORTNAME --security-group $SECGRP_ID --device-owner Octavia:health-mgr --host=$node -c id -f value --network $NET_ID)
IP=$(openstack port show $PORT_ID -c fixed_ips -f yaml | grep ip_address | awk -F':' '{print $2}')
if [ -z $CONTROLLER_IP_PORT_LIST ]; then
PORT_ID=$(openstack port create "$PORTNAME" --security-group "$SECGRP_ID" --device-owner Octavia:health-mgr --host="$node" -c id -f value --network "$NET_ID")
IP=$(openstack port show "$PORT_ID" -c fixed_ips -f yaml | grep ip_address | awk -F':' '{print $2}')
if [ -z "$CONTROLLER_IP_PORT_LIST" ]; then
CONTROLLER_IP_PORT_LIST=$IP:5555
else
CONTROLLER_IP_PORT_LIST=$CONTROLLER_IP_PORT_LIST,$IP:5555
fi
done

echo $CONTROLLER_IP_PORT_LIST > /tmp/octavia_hm_controller_ip_port_list
echo "$CONTROLLER_IP_PORT_LIST" > /tmp/octavia_hm_controller_ip_port_list
10 changes: 5 additions & 5 deletions ansible/roles/octavia_preconf/files/create_k8s_secret.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CLIENT_KEY_CERT=$4
function encod_base64()
{
local file_path=$1
cat $file_path | base64 -w0 | tr -d '\n'
cat "$file_path" | base64 -w0 | tr -d '\n'
}

cat <<EOF> /tmp/k8s_secret.yml
Expand All @@ -26,8 +26,8 @@ metadata:
namespace: openstack
type: Opaque
data:
server_ca.cert.pem: $(encod_base64 $SERVER_CA)
server_ca.key.pem: $(encod_base64 $SERVER_CA_KEY)
client_ca.cert.pem: $(encod_base64 $CLIENT_CA)
client.key-and-cert.pem: $(encod_base64 $CLIENT_KEY_CERT)
server_ca.cert.pem: $(encod_base64 "$SERVER_CA")
server_ca.key.pem: $(encod_base64 "$SERVER_CA_KEY")
client_ca.cert.pem: $(encod_base64 "$CLIENT_CA")
client.key-and-cert.pem: $(encod_base64 "$CLIENT_KEY_CERT")
EOF
3 changes: 0 additions & 3 deletions ansible/roles/octavia_preconf/tasks/octavia_cert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@
cmd: create_k8s_secret.sh {{ octavia_server_ca_cert }} {{ octavia_serverca_privkey }} {{ octavia_client_ca_cert }} {{ octavia_client_key_cert }}
creates: /tmp/k8s_secret.yml

#- name: Create the "octavia-certs" secret in the openstack namespace
# command:
# cmd: kubectl apply -f /tmp/k8s_secret.yml
- name: Create the "octavia-certs" secret in the openstack namespace
k8s:
state: present
Expand Down
2 changes: 0 additions & 2 deletions ansible/roles/octavia_preconf/tests/inventory

This file was deleted.

5 changes: 0 additions & 5 deletions ansible/roles/octavia_preconf/tests/test.yml

This file was deleted.

0 comments on commit e9f473b

Please sign in to comment.