25 lines
577 B
Bash
25 lines
577 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
|
||
|
|
if kubectl get secret registry-credentials -n infctl >/dev/null 2>&1; then
|
||
|
|
echo "Secret 'registry-credentials' already exists in namespace 'infctl'. Skipping."
|
||
|
|
exit 0
|
||
|
|
fi
|
||
|
|
|
||
|
|
|
||
|
|
echo "Container Registry Server: $SERVER"
|
||
|
|
|
||
|
|
kubectl create secret docker-registry registry-credentials \
|
||
|
|
--docker-server=$SERVER \
|
||
|
|
--docker-username=$USER \
|
||
|
|
--docker-password=$PASSWORD \
|
||
|
|
--docker-email=$EMAIL \
|
||
|
|
-n infctl
|
||
|
|
|
||
|
|
if [ $? -ne 0 ]; then
|
||
|
|
echo "Error: Failed to create the docker-registry secret."
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo "Docker registry secret created successfully."
|
||
|
|
|