diff --git a/ansible/files/prometheus-data.sh b/ansible/files/prometheus-data.sh deleted file mode 100644 index c2152582..00000000 --- a/ansible/files/prometheus-data.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -export KUBECONFIG=/tmp/kube.config.previous -PREVIOUS_POD=$(kubectl get pods -n metrics --selector=app.kubernetes.io/component=server --no-headers -o custom-columns=":metadata.name") -kubectl -n metrics exec -it pod/${PREVIOUS_POD} -c prometheus-server -- tar cfz backup.tar.gz /data -kubectl cp metrics/${PREVIOUS_POD}:backup.tar.gz /tmp/prometheus.tar.gz -c prometheus-server - -sleep 150 # make a little gap of time to keep data from overlapping - -export KUBECONFIG=/tmp/kube.config.current -CURRENT_POD=$(kubectl get pods -n metrics --selector=app.kubernetes.io/component=server --no-headers -o custom-columns=":metadata.name") -kubectl -n metrics wait --for=condition=ready pod -l app.kubernetes.io/component=server --timeout=600s -kubectl cp /tmp/prometheus.tar.gz metrics/${CURRENT_POD}:backup.tar.gz -c prometheus-server -kubectl -n metrics exec -it pod/${CURRENT_POD} -c prometheus-server -- sh -c 'rm -rf /data/* ; tar xfz backup.tar.gz -C /' -kubectl -n metrics rollout restart deployment.apps/prometheus-server diff --git a/ansible/paws.yaml b/ansible/paws.yaml index 1c3f1368..ceb7b634 100644 --- a/ansible/paws.yaml +++ b/ansible/paws.yaml @@ -75,7 +75,6 @@ name: metrics kind: Namespace state: present - register: prometheus - name: Prometheus kubernetes.core.helm: @@ -95,10 +94,6 @@ template: "templates/prometheus-ingress.yaml.j2" namespace: metrics - - name: Pull in previous prometheus data - ansible.builtin.script: files/prometheus-data.sh - when: prometheus.changed - - name: Add jupyterhub chart repo kubernetes.core.helm_repository: name: jupyterhub diff --git a/deploy.sh b/deploy.sh index f5ebb42f..d6ea1c72 100644 --- a/deploy.sh +++ b/deploy.sh @@ -42,9 +42,6 @@ fi source secrets-${datacenter}.sh -# save current kube.config in case we need to transfer prometheus data -cp $(pwd)/tofu/kube.config /tmp/kube.config.previous || true # if it isn't there just keep going - python3 -m venv .venv/deploy source .venv/deploy/bin/activate pip install ansible==8.1.0 kubernetes==26.1.0 @@ -54,7 +51,6 @@ cd tofu AWS_ACCESS_KEY_ID=${ACCESS_KEY} AWS_SECRET_ACCESS_KEY=${SECRET_KEY} tofu init -backend-config=${datacenter}-backend.conf AWS_ACCESS_KEY_ID=${ACCESS_KEY} AWS_SECRET_ACCESS_KEY=${SECRET_KEY} tofu apply -var datacenter=${datacenter} export KUBECONFIG=$(pwd)/kube.config -cp $(pwd)/kube.config /tmp/kube.config.current if [ "${tofuonly}" = '1' ] then