ci: add deployment of polkadot prometheus rules (#6646)

This commit is contained in:
gabriel klawitter
2020-07-14 17:51:11 +05:30
committed by GitHub
parent 74655edebc
commit 537c829133
+20 -62
View File
@@ -27,7 +27,7 @@ stages:
- build - build
- post-build-test - post-build-test
- publish - publish
- kubernetes - deploy
- flaming-fir - flaming-fir
variables: &default-vars variables: &default-vars
@@ -632,74 +632,32 @@ publish-to-crates-io:
- cargo unleash em-dragons --no-check ${CARGO_UNLEASH_PKG_DEF} - cargo unleash em-dragons --no-check ${CARGO_UNLEASH_PKG_DEF}
allow_failure: true allow_failure: true
.deploy-template: &deploy
stage: kubernetes
when: manual deploy-kubernetes-alerting-rules:
stage: deploy
interruptible: true
retry: 1 retry: 1
image: paritytech/kubetools:latest
<<: *build-only
tags: tags:
# this is the runner that is used to deploy it
- kubernetes-parity-build - kubernetes-parity-build
before_script: image: paritytech/kubetools:latest
- test -z "${DEPLOY_TAG}" && environment:
test -f ./artifacts/substrate/VERSION && name: parity-mgmt-polkadot-alerting
DEPLOY_TAG="$(cat ./artifacts/substrate/VERSION)" variables:
- test "${DEPLOY_TAG}" || ( echo "Neither DEPLOY_TAG nor VERSION information available"; exit 1 ) NAMESPACE: monitoring
PROMETHEUSRULE: prometheus-k8s-rules-polkadot-alerting
RULES: .maintain/monitoring/alerting-rules/alerting-rules.yaml
script: script:
- echo "Substrate version = ${DEPLOY_TAG}" - echo "deploying prometheus alerting rules"
# or use helm to render the template - kubectl -n ${NAMESPACE} patch prometheusrule ${PROMETHEUSRULE}
- helm template --type=merge --patch "$(sed 's/^/ /;1s/^/spec:\n/' ${RULES})"
--values ./.maintain/kubernetes/values.yaml
--set image.tag=${DEPLOY_TAG}
--set validator.keys=${VALIDATOR_KEYS}
./.maintain/kubernetes | kubectl apply -f - --dry-run=false
- echo "# substrate namespace ${KUBE_NAMESPACE}"
- kubectl -n ${KUBE_NAMESPACE} get all
- echo "# substrate's nodes' external ip addresses:"
- kubectl get nodes -l node=substrate
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{range @.status.addresses[?(@.type=="ExternalIP")]}{.address}{"\n"}{end}'
- echo "# substrate' nodes"
- kubectl -n ${KUBE_NAMESPACE} get pods
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.nodeName}{"\n"}{end}'
- echo "# wait for the rollout to complete"
- kubectl -n ${KUBE_NAMESPACE} rollout status statefulset/substrate
# have environment:url eventually point to the logs
.deploy-cibuild: &deploy-cibuild
<<: *deploy
needs:
- job: publish-docker-substrate
artifacts: false
.deploy-tag: &deploy-tag
<<: *deploy
only: only:
variables: refs:
- $DEPLOY_TAG - master
changes:
- "${RULES}"
# have environment:url eventually point to the logs
deploy-ew3:
<<: *deploy-cibuild
environment:
name: parity-prod-ew3
deploy-ue1:
<<: *deploy-cibuild
environment:
name: parity-prod-ue1
deploy-ew3-tag:
<<: *deploy-tag
environment:
name: parity-prod-ew3
deploy-ue1-tag:
<<: *deploy-tag
environment:
name: parity-prod-ue1
.validator-deploy: &validator-deploy .validator-deploy: &validator-deploy
<<: *build-only <<: *build-only