From bc71061db75933dfb1b812009a26bc38d42443e7 Mon Sep 17 00:00:00 2001 From: Ruben Hensen Date: Sun, 25 Oct 2026 03:27:32 +0100 Subject: [PATCH] Remove commented-out files, the empty secrets app and a stale script copy --- .gitignore | 1 + apps/templates/secrets-folder.yaml | 21 -- backup-testing/test-velero-backup.sh.bak | 381 ----------------------- secrets/hensenio-smtp.yaml | 18 -- velero/minio-es.yaml | 23 -- 5 files changed, 1 insertion(+), 443 deletions(-) delete mode 100644 apps/templates/secrets-folder.yaml delete mode 100755 backup-testing/test-velero-backup.sh.bak delete mode 100644 secrets/hensenio-smtp.yaml delete mode 100644 velero/minio-es.yaml diff --git a/.gitignore b/.gitignore index 6e94d2a..1b88e95 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ velero-credentials nix-infra-machine/ssh/ nix-infra-machine/.env nix-infra-machine/nix/ +.DS_Store diff --git a/apps/templates/secrets-folder.yaml b/apps/templates/secrets-folder.yaml deleted file mode 100644 index 024a82e..0000000 --- a/apps/templates/secrets-folder.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: secrets-folder - namespace: argocd - finalizers: - - resources-finalizer.argocd.argoproj.io -spec: - project: default - source: - repoURL: https://github.com/rubenhensen/k8scd.git - targetRevision: HEAD - path: secrets - destination: - server: https://kubernetes.default.svc - namespace: secrets - syncPolicy: - syncOptions: - - CreateNamespace=true - automated: - selfHeal: true \ No newline at end of file diff --git a/backup-testing/test-velero-backup.sh.bak b/backup-testing/test-velero-backup.sh.bak deleted file mode 100755 index ef8c15f..0000000 --- a/backup-testing/test-velero-backup.sh.bak +++ /dev/null @@ -1,381 +0,0 @@ -#!/bin/bash -# test-velero-backup.sh - Automated script to test Velero backups - -set -e - -# Configuration - customize these variables -BACKUP_NAME="" # Will list backups if empty -S3_BUCKET="velero-backups" -S3_REGION="minio" -S3_URL="http://192.168.1.99:9000" # Your NAS MinIO server -S3_ACCESS_KEY="" # Will be filled from credentials -S3_SECRET_KEY="" # Will be filled from credentials -ORIGINAL_NAMESPACE="" # Namespace in the original backup -TEST_NAMESPACE="default" -DEBUG=false # Set to true for verbose debugging - -# Parse command line arguments -while [[ $# -gt 0 ]]; do - case $1 in - --backup-name) - BACKUP_NAME="$2" - shift 2 - ;; - --s3-access-key) - S3_ACCESS_KEY="$2" - shift 2 - ;; - --s3-secret-key) - S3_SECRET_KEY="$2" - shift 2 - ;; - --s3-bucket) - S3_BUCKET="$2" - shift 2 - ;; - --s3-region) - S3_REGION="$2" - shift 2 - ;; - --s3-url) - S3_URL="$2" - shift 2 - ;; - --original-namespace) - ORIGINAL_NAMESPACE="$2" - shift 2 - ;; - --test-namespace) - TEST_NAMESPACE="$2" - shift 2 - ;; - --debug) - DEBUG=true - shift - ;; - --help) - echo "Usage: $0 [options]" - echo "Options:" - echo " --backup-name NAME Name of the Velero backup to restore" - echo " --s3-bucket BUCKET S3 bucket containing backups" - echo " --s3-region REGION S3 region" - echo " --s3-url URL S3 endpoint URL" - echo " --s3-access-key KEY S3 access key" - echo " --s3-secret-key KEY S3 secret key" - echo " --original-namespace NS Namespace in the original backup" - echo " --test-namespace NS Namespace for restoration (default: default)" - echo " --debug Enable debug output" - echo " --help Show this help message" - exit 0 - ;; - *) - echo "Unknown option: $1" - exit 1 - ;; - esac -done - -# Verify required variables -if [[ -z "$S3_BUCKET" || -z "$S3_REGION" || -z "$S3_ACCESS_KEY" || -z "$S3_SECRET_KEY" || -z "$ORIGINAL_NAMESPACE" || -z "$TEST_NAMESPACE" ]]; then - echo "Error: S3 configuration is incomplete" - exit 1 -fi - -# Function to clean up resources -cleanup() { - echo "Cleaning up resources..." - k3d cluster delete backup-test || true - echo "Cleanup complete" -} - -# Function for debugging output -debug() { - if [[ "$DEBUG" == "true" ]]; then - echo "[DEBUG] $*" - fi -} - -# Register cleanup function to run on exit (ctrl+c, etc.) -trap cleanup EXIT - -echo "=== Starting Velero backup test process ===" - -# 1. Create K3d cluster -echo "Creating K3d cluster..." -k3d cluster create backup-test \ - --api-port 6443 \ - --port "80:80@loadbalancer" \ - --port "443:443@loadbalancer" \ - --agents 0 \ - --k3s-arg "--disable=traefik@server:0" \ - --wait - # -v /mnt/longhorn:/var/lib/longhorn:shared@all \ - # -i hebury/k3s:v1.32.2-k3s1 \ - # --wait - -# Verify cluster is running -kubectl config use-context k3d-backup-test -kubectl get nodes - -# 2. Install Longhorn -# echo "Installing Longhorn..." -# kubectl create namespace longhorn-system - -# helm repo add longhorn https://charts.longhorn.io -# helm repo update - -# helm install longhorn longhorn/longhorn \ -# --namespace longhorn-system \ -# --set persistence.defaultClassReplicaCount=1 \ -# --set defaultSettings.backupTarget="" \ -# --set defaultSettings.defaultReplicaCount=1 - -# echo "Waiting for Longhorn to be ready..." -# kubectl -n longhorn-system rollout status deployment/longhorn-ui -# kubectl -n longhorn-system rollout status deployment/longhorn-driver-deployer -# kubectl -n longhorn-system rollout status daemonset/longhorn-manager - -# 3. Install Velero with S3 provider -echo "Installing Velero..." -cat > velero-credentials < /dev/null; then - echo "Error: Velero CLI is not installed or not in PATH" - echo "Please install the Velero CLI by following instructions at: https://velero.io/docs/main/basic-install/" - exit 1 -fi - -# Verify Velero is connected to the storage location -echo "Checking Velero backup storage location..." -kubectl -n velero get backupstoragelocation default -o jsonpath='{.status.phase}' | grep -q "Available" || { - echo "Warning: Backup storage location is not available, it may take a few minutes to initialize" - echo "Storage location status:" - kubectl -n velero get backupstoragelocation default -o yaml - - # Wait a bit longer for the location to become available - echo "Waiting 30 seconds for backup storage location to become available..." - sleep 30 -} - -# 4. List backups -echo "Checking for available backups..." -if ! velero_output=$(velero backup get 2>&1); then - echo "Error listing backups: $velero_output" - - # Try to verify S3 connectivity - echo "Checking S3 connectivity..." - - # Install AWS CLI if needed - if ! command -v aws &> /dev/null; then - echo "AWS CLI not found, skipping S3 connectivity test" - else - # Create temporary AWS profile - mkdir -p ~/.aws - cat > ~/.aws/credentials < ~/.aws/config < validate-restore.sh <<'EOF' -# #!/bin/bash -# # validate-restore.sh - Script to validate Velero backup restoration - -# set -e -# echo "Starting validation of restored resources..." - -# # Get namespace from command line or use default -# NAMESPACE="${1:-default}" - -# # Check all deployments -# echo "Checking deployments..." -# deployments=$(kubectl get deployment -n $NAMESPACE -o name) -# if [[ -z "$deployments" ]]; then -# echo "❌ No deployments found in namespace $NAMESPACE" -# else -# echo "Found deployments: $deployments" - -# # Check if pods are running for each deployment -# for deployment in $deployments; do -# name=$(echo $deployment | cut -d'/' -f2) -# echo -n "Checking deployment $name: " - -# # Check if pods are running -# ready_replicas=$(kubectl get deployment -n $NAMESPACE $name -o jsonpath='{.status.readyReplicas}') -# if [[ -n "$ready_replicas" && "$ready_replicas" != "0" ]]; then -# echo "✅ $ready_replicas pods ready" -# else -# echo "❌ No pods running" -# fi -# done -# fi - -# # Check all services -# echo "Checking services..." -# services=$(kubectl get service -n $NAMESPACE -o name | grep -v "kubernetes") -# if [[ -z "$services" ]]; then -# echo "❌ No services found in namespace $NAMESPACE" -# else -# echo "Found services: $services" - -# # Check if services have endpoints -# for service in $services; do -# name=$(echo $service | cut -d'/' -f2) -# echo -n "Checking service $name: " - -# # Check if service has endpoints -# endpoints=$(kubectl get endpoints -n $NAMESPACE $name -o jsonpath='{.subsets[*].addresses[*].ip}') -# if [ -n "$endpoints" ]; then -# echo "✅ Has endpoints" -# else -# echo "❌ No endpoints" -# fi -# done -# fi - -# # Check PVCs -# echo "Checking PVCs..." -# pvcs=$(kubectl get pvc -n $NAMESPACE -o name) -# if [[ -z "$pvcs" ]]; then -# echo "No PVCs found in namespace $NAMESPACE" -# else -# pvc_count=$(echo "$pvcs" | wc -l) -# echo "Found $pvc_count PVCs" - -# # Check if PVCs are bound -# bound_count=$(kubectl get pvc -n $NAMESPACE -o jsonpath='{.items[?(@.status.phase=="Bound")].metadata.name}' | wc -w) -# echo "$bound_count/$pvc_count PVCs are bound" - -# if [ "$bound_count" -ne "$pvc_count" ]; then -# echo "❌ Not all PVCs are bound" -# else -# echo "✅ All PVCs are bound" -# fi -# fi - -# echo "Validation complete!" -# exit 0 -# EOF -# chmod +x validate-restore.sh -# fi - -echo "Running validation tests..." -./validate-restore.sh $TEST_NAMESPACE - -echo "" -echo "=== Backup test process completed ===" -echo "The cluster will be deleted when you close this terminal or press Ctrl+C" -echo "To access the cluster manually, use: kubectl config use-context k3d-backup-test" -echo "" - -# Keep the script running until user terminates it -read -p "Press Enter to clean up and exit..." \ No newline at end of file diff --git a/secrets/hensenio-smtp.yaml b/secrets/hensenio-smtp.yaml deleted file mode 100644 index cefcdba..0000000 --- a/secrets/hensenio-smtp.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# apiVersion: external-secrets.io/v1beta1 -# kind: ExternalSecret -# metadata: -# name: hensenio-smtp-secrets -# namespace: blog -# spec: -# refreshInterval: "15m" -# secretStoreRef: -# name: vault-backend -# kind: ClusterSecretStore -# target: -# name: hensenio-smtp -# creationPolicy: Owner -# data: -# - secretKey: smtp-password -# remoteRef: -# key: kv/hensenio/smtp -# property: password \ No newline at end of file diff --git a/velero/minio-es.yaml b/velero/minio-es.yaml deleted file mode 100644 index 34d9898..0000000 --- a/velero/minio-es.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# apiVersion: external-secrets.io/v1beta1 -# kind: ExternalSecret -# metadata: -# name: velero-minio-credentials -# namespace: velero -# spec: -# refreshInterval: "15s" -# secretStoreRef: -# name: vault-backend -# kind: ClusterSecretStore -# target: -# name: velero-minio-credentials -# creationPolicy: Owner -# data: -# - secretKey: cloud -# remoteRef: -# key: velero/minio-credentials -# template: -# engine: gotmpl -# data: | -# [default] -# aws_access_key_id={{ .aws_access_key_id }} -# aws_secret_access_key={{ .aws_secret_access_key }} \ No newline at end of file