This commit is contained in:
2
tools/forward_addresses
Normal file
2
tools/forward_addresses
Normal file
@@ -0,0 +1,2 @@
|
||||
wn@mainscnt.eu: wolfgang.hottgenroth@icloud.com
|
||||
wn@ib-hottgenroth.de: wolfgang.hottgenroth@icloud.com
|
||||
2
tools/forward_domains
Normal file
2
tools/forward_domains
Normal file
@@ -0,0 +1,2 @@
|
||||
mainscnt.eu
|
||||
ib-hottgenroth.de
|
||||
44
tools/update-addresses.sh
Executable file
44
tools/update-addresses.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to create and apply a ConfigMap from forward_addresses and forward_domains files
|
||||
# Usage: ./tools/update-addresses.sh [--dry-run]
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
CONFIGMAP_NAME="exim-forwarder-config"
|
||||
NAMESPACE="forwarder"
|
||||
|
||||
# Parse command line arguments
|
||||
DRY_RUN_FLAG=""
|
||||
if [[ "$1" == "--dry-run" ]]; then
|
||||
DRY_RUN_FLAG="--dry-run=client"
|
||||
echo "Running in dry-run mode..."
|
||||
fi
|
||||
|
||||
# Check if files exist
|
||||
if [[ ! -f "$SCRIPT_DIR/forward_addresses" ]]; then
|
||||
echo "Error: forward_addresses file not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$SCRIPT_DIR/forward_domains" ]]; then
|
||||
echo "Error: forward_domains file not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Creating ConfigMap '$CONFIGMAP_NAME'..."
|
||||
|
||||
# Create ConfigMap directly from files
|
||||
kubectl create configmap "$CONFIGMAP_NAME" \
|
||||
--from-file=addresses="$SCRIPT_DIR/forward_addresses" \
|
||||
--from-file=domains="$SCRIPT_DIR/forward_domains" \
|
||||
--namespace="$NAMESPACE" \
|
||||
--dry-run=client -o yaml | kubectl apply $DRY_RUN_FLAG -f -
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo "ConfigMap successfully applied!"
|
||||
else
|
||||
echo "Failed to apply ConfigMap"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user