Use full secret paths.
This commit is contained in:
@@ -79,27 +79,22 @@ deploy_secrets() {
|
||||
|
||||
echo "Deploying secrets for app '${app_name}' in namespace '${namespace}'"
|
||||
|
||||
# Create secret data
|
||||
# Gather data for app secret
|
||||
local secret_data=""
|
||||
while IFS= read -r secret_path; do
|
||||
# Get the secret value using full path
|
||||
secret_value=$(yq eval ".${secret_path} // \"\"" "${SECRETS_FILE}")
|
||||
|
||||
# Extract just the key name for the Kubernetes secret (handle dotted paths)
|
||||
secret_key="${secret_path##*.}"
|
||||
|
||||
if [ -n "${secret_value}" ] && [ "${secret_value}" != "null" ]; then
|
||||
if [[ "${secret_value}" == CHANGE_ME_* ]]; then
|
||||
echo "Warning: Secret '${secret_path}' for app '${app_name}' still has dummy value: ${secret_value}"
|
||||
fi
|
||||
secret_data="${secret_data} --from-literal=${secret_key}=${secret_value}"
|
||||
secret_data="${secret_data} --from-literal=${secret_path}=${secret_value}"
|
||||
else
|
||||
echo "Error: Required secret '${secret_path}' not found in ${SECRETS_FILE} for app '${app_name}'"
|
||||
exit 1
|
||||
fi
|
||||
done < <(yq eval '.requiredSecrets[]' "${manifest_file}")
|
||||
|
||||
# Create the secret if we have data
|
||||
# Create/update app secret in cluster
|
||||
if [ -n "${secret_data}" ]; then
|
||||
echo "Creating/updating secret '${app_name}-secrets' in namespace '${namespace}'"
|
||||
if [ "${DRY_RUN:-}" = "--dry-run=client" ]; then
|
||||
@@ -112,9 +107,11 @@ deploy_secrets() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Step 1: Create namespaces first (dependencies and main app)
|
||||
# Step 1: Create namespaces first
|
||||
echo "Creating namespaces..."
|
||||
MANIFEST_FILE="apps/${APP_NAME}/manifest.yaml"
|
||||
|
||||
# Create dependency namespaces.
|
||||
if [ -f "${MANIFEST_FILE}" ]; then
|
||||
if yq eval '.requires' "${MANIFEST_FILE}" | grep -q -v '^null$'; then
|
||||
yq eval '.requires[].name' "${MANIFEST_FILE}" | while read -r required_app; do
|
||||
|
Reference in New Issue
Block a user