Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions admin-tools/deploy-opencds-mockoon-chart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

# Exit immediately if a command exits with a non-zero status
set -e

echo "Starting deployment pre-flight checks..."
echo "----------------------------------------"

APPLICATION="opencds-mockoon"
CHART_PATH="$GITOPS_REPO_PATH/gitops/envs/conf-dso/apps/$APPLICATION"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StephaneTrebel qui ajoute la chart dans le repo gitops géneré par ansible ?

autant de faire un helm install directement sans passer par le gitops du socle

RELEASE_NAME="argocd-$APPLICATION"
NAMESPACE="dso-$APPLICATION"

# 1. Directory and File Checks

if [[ ! -d "$CHART_PATH" ]]; then
echo "❌ Error: Directory $CHART_PATH does not exist."
exit 1
fi

if [[ ! -f "$CHART_PATH/values.yaml" ]]; then
echo "❌ Error: The base 'values.yaml' was not found in $CHART_PATH."
exit 1
fi

# 2. Confirmation prompt
echo ""
read -p "Do you want to install the dso-$APPLICATION chart? (y/n): " confirm
if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then
echo "Installation aborted by administrator."
exit 0
fi

echo "Proceeding with installation..."
echo "-------------------------------"

# 3. Render chart
helm dependency build "$CHART_PATH"
helm template "$RELEASE_NAME" "$CHART_PATH" \
--namespace "$NAMESPACE" \
--create-namespace \
--values "$CHART_PATH/values.yaml" > "$FINAL_MANIFEST"

echo "✅ Manifest generated."

# 4. Apply the manifest
echo "Applying manifest..."
echo ""
if kubectl apply -f "$FINAL_MANIFEST" -n "$NAMESPACE" --server-side; then
echo "🎉 Deployment of $APPLICATION completed successfully!"
else
echo "❌ Error: kubectl apply failed."
exit 1
fi
Loading