Skip to content

Commit 513e6ef

Browse files
committed
Approaching the wanted structure for secrets with coulds.yaml
Signed-off-by: Kurt Garloff <[email protected]>
1 parent 73dd58d commit 513e6ef

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

_04-clouds-yaml.sh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,34 @@ umask 0177
6666
INJECTSUB="$SECRETS" INJECTSUBKWD="auth" RMVCOMMENT=1 extract_yaml clouds.$OS_CLOUD < $CLOUDS_YAML | sed "s/^\\(\\s*\\)\\($OS_CLOUD\\):/\\1openstack:/" > ~/tmp/clouds-$OS_CLOUD.yaml
6767
sed -i 's@^\(\s*cacert:\).*@\1 /etc/openstack/cacert.pem@' ~/tmp/clouds-$OS_CLOUD.yaml
6868
CL_YAML=$(ls ~/tmp/clouds-$OS_CLOUD.yaml)
69-
kubectl create secret -n kube-system generic clouds-yaml --from-file=$CL_YAML --dry-run=client -oyaml > ~/tmp/clouds-$OS_CLOUD-yaml-secret
69+
CL_YAML_B64=$(base64 -w0 < "$CL_YAML")
70+
#kubectl create secret -n $CS_NAMESPACE generic clouds-yaml --from-file=$CL_YAML
7071
umask $OLD_UMASK
7172
if test -n "$OS_CACERT"; then
7273
OS_CACERT=${OS_CACERT/\~/$HOME}
73-
kubectl create secret -n kube-system generic cacert-pem --from-file=$OS_CACERT --dry-run=client -oyaml > ~/tmp/cacert-secret
74+
CACERT_B64=$(base64 -w0 < $OS_CACERT)
75+
cat | kubectl apply -f - << EOT
76+
apiVersion: v1
77+
data:
78+
clouds.yaml: $CL_YAML_B64
79+
cacert.pem: $CACERT_B64
80+
kind: Secret
81+
metadata:
82+
name: openstack
83+
namespace: $CS_NAMESPACCE
84+
type: Opaque
85+
EOT
86+
else
87+
cat | kubectl apply -f << EOT
88+
apiVersion: v1
89+
data:
90+
clouds.yaml: $CL_YAML_B64
91+
kind: Secret
92+
metadata:
93+
name: openstack
94+
namespace: $CS_NAMESPACCE
95+
type: Opaque
96+
EOT
7497
fi
7598
# FIXME: We will provide more settings in cluster-settings.env later, hardcode it for now
7699
#if test "$CS_CCMLB=octavia-ovn"; then OCTOVN="--set octavia_ovn=true"; else unset OCTOVN; fi

0 commit comments

Comments
 (0)