From 511374c75e11a1a501869d5d7fd4ce9a29b97efa Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Wed, 27 Dec 2023 16:31:36 +0800 Subject: [PATCH] .github/workflows/iac-pipeline-create.yml: fixed setup observability-agent --- .github/workflows/iac-pipeline-create.yml | 20 ++++++++--------- .../files/setup-prometheus-operator.sh | 22 +++++++++++++++++++ 2 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 playbook/roles/k3s-addon/files/setup-prometheus-operator.sh diff --git a/.github/workflows/iac-pipeline-create.yml b/.github/workflows/iac-pipeline-create.yml index b1ca0b28..b7c814d5 100644 --- a/.github/workflows/iac-pipeline-create.yml +++ b/.github/workflows/iac-pipeline-create.yml @@ -73,8 +73,8 @@ jobs: uses: open-source-solution-design/Modern-Container-Application-Reference-Architecture/.github/workflows/use-setup-observability-agent.yml@main with: domain: 'svc.ink' - cluster_name: 'monitor' - ssh_host_name: 'monitor' + cluster_name: 'devops' + ssh_host_name: 'devops' secrets: GCP_CREDENTIALS_JSON: ${{ secrets.GCP_CREDENTIALS_JSON }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} @@ -102,9 +102,9 @@ jobs: setup-sit-cluster-observability-agent: uses: open-source-solution-design/Modern-Container-Application-Reference-Architecture/.github/workflows/use-setup-observability-agent.yml@main with: - domain: 'svc.ink' - cluster_name: 'monitor' - ssh_host_name: 'monitor' + cluster_name: 'sit' + ssh_host_name: 'sit' + domain: 'svc-sit.ink' secrets: GCP_CREDENTIALS_JSON: ${{ secrets.GCP_CREDENTIALS_JSON }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} @@ -132,9 +132,9 @@ jobs: setup-uat-cluster-observability-agent: uses: open-source-solution-design/Modern-Container-Application-Reference-Architecture/.github/workflows/use-setup-observability-agent.yml@main with: - domain: 'svc.ink' - cluster_name: 'monitor' - ssh_host_name: 'monitor' + cluster_name: 'uat' + ssh_host_name: 'uat' + domain: 'svc-uat.ink' secrets: GCP_CREDENTIALS_JSON: ${{ secrets.GCP_CREDENTIALS_JSON }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} @@ -163,8 +163,8 @@ jobs: uses: open-source-solution-design/Modern-Container-Application-Reference-Architecture/.github/workflows/use-setup-observability-agent.yml@main with: domain: 'svc.ink' - cluster_name: 'monitor' - ssh_host_name: 'monitor' + cluster_name: 'prod' + ssh_host_name: 'prod' secrets: GCP_CREDENTIALS_JSON: ${{ secrets.GCP_CREDENTIALS_JSON }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/playbook/roles/k3s-addon/files/setup-prometheus-operator.sh b/playbook/roles/k3s-addon/files/setup-prometheus-operator.sh new file mode 100644 index 00000000..5bf03bec --- /dev/null +++ b/playbook/roles/k3s-addon/files/setup-prometheus-operator.sh @@ -0,0 +1,22 @@ +#!/bin/bash +cat > prometheus-values.yaml << EOF +global: + imageRegistry: "artifact.onwalk.net/base" +prometheus: + enabled: false +defaultRules: + create: false +grafana: + enabled: false +prometheus-windows-exporter: + enabled: false +alertmanager: + enabled: false +EOF + +node_name=`kubectl get nodes | awk 'NR>1 {print $1}'` +kubectl create namespace monitoring || echo true +kubectl label nodes $node prometheus=true --overwrite || echo true +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts +helm repo update +helm upgrade --install prometheus-agent prometheus-community/kube-prometheus-stack -n monitoring -f prometheus-values.yaml