From 134053a134ab1a4466b2fb576736bbc163ede097 Mon Sep 17 00:00:00 2001 From: Jakub Stejskal Date: Mon, 13 Jan 2025 21:12:07 +0100 Subject: [PATCH] Fix automation and change name of the datasource (#385) * Fix automation and change name of the datasource Signed-off-by: Jakub Stejskal * Revert branch for deployment-hub Signed-off-by: Jakub Stejskal --------- Signed-off-by: Jakub Stejskal --- .github/workflows/skodjob-ee.yaml | 2 +- image-update/strimzi-image-update.sh | 3 + .../install_observability.yaml | 10 +++ .../install/install_argo_workflow.yaml | 1 + .../infra-setup/install/install_strimzi.yaml | 22 +++++- .../tasks/monitoring/deploy-data-source.yaml | 18 ++++- .../tasks/monitoring/install_monitoring.yaml | 8 +- .../workflows/infra-argo-workflows.yaml | 76 +++++++++++++++++++ .../acm/07-multicluster-observability.yaml.j2 | 3 +- .../argo/applications/amq-streams-infra.yaml | 3 +- .../templates/argo/applications/debezium.yaml | 3 +- .../alerts/infra/argo-alerts.yaml.j2 | 2 +- ...imzi-alerts-cluster-operator-kraft.yaml.j2 | 2 +- .../strimzi-alerts-cluster-operator.yaml.j2 | 2 +- .../strimzi-alerts-drain-cleaner.yaml.j2 | 2 +- .../strimzi-alerts-kafka-connect.yaml.j2 | 2 +- .../strimzi-alerts-kafka-kraft.yaml.j2 | 2 +- .../strimzi-alerts-kafka-mm2-kraft.yaml.j2 | 2 +- .../strimzi-alerts-kafka-mm2.yaml.j2 | 2 +- .../worker-01/strimzi-alerts-kafka.yaml.j2 | 2 +- .../strimzi-alerts-cluster-operator.yaml.j2 | 2 +- .../strimzi-alerts-drain-cleaner.yaml.j2 | 2 +- .../worker-02/strimzi-alerts-kafka.yaml.j2 | 2 +- .../dashboards/grafana-dashboards.yaml.j2 | 2 +- .../argo/applications/strimzi-infra.yaml | 3 +- .../grafana/grafana-data-source.yaml.j2 | 8 +- .../templates/grafana/grafana-setup.yaml.j2 | 14 +++- 27 files changed, 167 insertions(+), 33 deletions(-) diff --git a/.github/workflows/skodjob-ee.yaml b/.github/workflows/skodjob-ee.yaml index f99e877e..422fae07 100644 --- a/.github/workflows/skodjob-ee.yaml +++ b/.github/workflows/skodjob-ee.yaml @@ -29,7 +29,7 @@ jobs: uses: docker/build-push-action@v6 with: context: ./skodjob-ee/context - file: ./skodjob-ee/context/Dockerfile + file: ./skodjob-ee/context/Containerfile push: true # TODO - Change org when we will create a new one tags: quay.io/tealc/skodjob-ee:latest diff --git a/image-update/strimzi-image-update.sh b/image-update/strimzi-image-update.sh index f2ec5313..7559e3f0 100755 --- a/image-update/strimzi-image-update.sh +++ b/image-update/strimzi-image-update.sh @@ -212,6 +212,9 @@ do LATEST_DIGEST=$(skopeo inspect --override-arch amd64 --override-os linux docker://"$TARGET_ORG_REPO"/"$IMAGE":latest-kafka-"$PREFIX" --format "{{ .Digest }}") elif [[ $ELEMENT == *"kafka@"* ]]; then continue + # Do not care about bridge version + elif [[ $ELEMENT == *"bridge@"* ]]; then + continue else LATEST_DIGEST=$(skopeo inspect --override-arch amd64 --override-os linux docker://"$TARGET_ORG_REPO"/"$IMAGE" --format "{{ .Digest }}") fi diff --git a/install/roles/automation-hub/tasks/infra-setup/install/advanced-cluster-management/install_observability.yaml b/install/roles/automation-hub/tasks/infra-setup/install/advanced-cluster-management/install_observability.yaml index 91e03ccf..66a97af4 100644 --- a/install/roles/automation-hub/tasks/infra-setup/install/advanced-cluster-management/install_observability.yaml +++ b/install/roles/automation-hub/tasks/infra-setup/install/advanced-cluster-management/install_observability.yaml @@ -18,6 +18,16 @@ template: templates/acm/06-thanos-storage-secret.yaml.j2 verify_ssl: no +# This is needed if the clusters are created via our ACM. +# MultiClusterObservability is installed only on managed clusters with this label +- name: Label each cluster with vendor=OpenShift + ansible.builtin.shell: "oc label managedcluster {{ cluster.name }} vendor=OpenShift --overwrite" + environment: + KUBECONFIG: "{{ kubeconfig_path }}/{{ infra_context_name }}" + loop: "{{ clusters_dict.values() }}" + loop_control: + loop_var: cluster + - name: "Create multicluster observability on Infra cluster" kubernetes.core.k8s: kubeconfig: "{{ kubeconfig_path }}/{{ infra_context_name }}" diff --git a/install/roles/automation-hub/tasks/infra-setup/install/install_argo_workflow.yaml b/install/roles/automation-hub/tasks/infra-setup/install/install_argo_workflow.yaml index 80682346..1333a0b5 100644 --- a/install/roles/automation-hub/tasks/infra-setup/install/install_argo_workflow.yaml +++ b/install/roles/automation-hub/tasks/infra-setup/install/install_argo_workflow.yaml @@ -12,6 +12,7 @@ labels: project: "skodjob" secret: "cert-manager" + strimzi.io/sync-secrets: "true" - name: Clean helm releases for workflows shell: "oc delete secret -l owner=helm -n {{ infra_workflow_namespace }} || true" diff --git a/install/roles/automation-hub/tasks/infra-setup/install/install_strimzi.yaml b/install/roles/automation-hub/tasks/infra-setup/install/install_strimzi.yaml index ab541de4..b594fa58 100644 --- a/install/roles/automation-hub/tasks/infra-setup/install/install_strimzi.yaml +++ b/install/roles/automation-hub/tasks/infra-setup/install/install_strimzi.yaml @@ -1,5 +1,5 @@ --- -- name: Create Strimzi namespaces on Infra cluster +- name: Create Strimzi Operator namespaces on Infra cluster kubernetes.core.k8s: kubeconfig: "{{ kubeconfig_path }}/{{ infra_context_name }}" verify_ssl: no @@ -11,12 +11,28 @@ name: "{{ item }}" labels: project: "skodjob" - strimzi.io/sync-secrets: "true" + strimzi.io/type: operators loop: - "{{ strimzi_operator_namespace }}" - - "{{ strimzi_kafka_namespace }}" - "{{ strimzi_drain_cleaner_namespace }}" +- name: Create Strimzi Event Bus namespaces on Infra cluster + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig_path }}/{{ infra_context_name }}" + verify_ssl: no + state: present + definition: + apiVersion: v1 + kind: Namespace + metadata: + name: "{{ item }}" + labels: + project: "skodjob" + strimzi.io/sync-secrets: "true" + strimzi.io/type: operands + loop: + - "{{ strimzi_kafka_namespace }}" + - name: Clean helm releases for workflows shell: "oc delete secret -l owner=helm -n {{ strimzi_operator_namespace }} || true" environment: diff --git a/install/roles/automation-hub/tasks/monitoring/deploy-data-source.yaml b/install/roles/automation-hub/tasks/monitoring/deploy-data-source.yaml index cb5a284e..10d529f3 100644 --- a/install/roles/automation-hub/tasks/monitoring/deploy-data-source.yaml +++ b/install/roles/automation-hub/tasks/monitoring/deploy-data-source.yaml @@ -1,12 +1,22 @@ --- # Get Grafana access token and update clusters data -- name: "Export access token {{ cluster.name }}" - # shell: "oc serviceaccounts get-token grafana-serviceaccount -n {{ target.sa_namespace }}" - shell: "oc get $(oc get secret -o name -n {{ cluster.monitoring_namespace }} | grep {{ sa_name }}-token) -n {{ cluster.monitoring_namespace }} -o=jsonpath='{.data.token}' | base64 -d" +- name: "Export access token for {{ cluster.name }}" + shell: "oc get secret {{ sa_name }} -n {{ cluster.monitoring_namespace }} -o=jsonpath='{.data.token}' | base64 -d" environment: KUBECONFIG: "{{ kubeconfig_path }}/{{ cluster.name }}" register: "access_token_out" +- debug: + msg: "{{ access_token_out }}" + +- name: "Set facts grafana access token - {{ cluster.name }}" + set_fact: access_token="{{ access_token_out.stdout }}" + +- name: Check that token exists + fail: + msg: "Token is not properly stored!\n{{ access_token }}" + when: access_token | length == 0 + - name: "Update facts for {{ cluster.name }}" ansible.utils.update_fact: updates: @@ -23,7 +33,7 @@ clusters_dict: "{{ updated_data.clusters_dict }}" when: is_worker is defined -- name: "Create Grafana data-source {{ cluster.name }}" +- name: "Create Grafana data-source {{ datasource_name }}" kubernetes.core.k8s: kubeconfig: "{{ kubeconfig_path }}/{{ infra_context_name }}" namespace: "{{ cluster.monitoring_namespace }}" diff --git a/install/roles/automation-hub/tasks/monitoring/install_monitoring.yaml b/install/roles/automation-hub/tasks/monitoring/install_monitoring.yaml index 7ff9b8a3..afa14dca 100644 --- a/install/roles/automation-hub/tasks/monitoring/install_monitoring.yaml +++ b/install/roles/automation-hub/tasks/monitoring/install_monitoring.yaml @@ -134,18 +134,21 @@ vars: is_worker: True sa_name: "{{ cluster.name }}-grafana" + datasource_name: "{{ cluster.name }}" url: "https://thanos-querier-openshift-monitoring.apps.{{ cluster.name }}.{{ cluster_domain }}:443" - name: Create data-sources on Infra cluster for Infra data include_tasks: deploy-data-source.yaml loop: - {name: "{{ infra_context_name }}", + datasource_name: "{{ infra_context_name }}", sa_namespace: "{{ infra_user_namespace }}", monitoring_namespace: "{{ infra_monitoring_namespace }}", target_cluster_name: "{{ infra_context_name }}", context: "{{ infra_context_name }}", url: "https://thanos-querier.openshift-monitoring.svc.cluster.local:9091"} - - {name: "skodjob-thanos", + - {name: "{{ infra_context_name }}", + datasource_name: "skodjob-thanos", sa_namespace: "{{ infra_user_namespace }}", monitoring_namespace: "{{ infra_monitoring_namespace }}", target_cluster_name: "{{ infra_context_name }}", @@ -154,7 +157,8 @@ loop_control: loop_var: cluster vars: - sa_name: "skodjob-sa" + sa_name: "{{ infra_context_name }}-grafana" + datasource_name: "{{ cluster.datasource_name }}" - name: Configure Alertmanager to for sending alerts on Infra cluster from all clusters kubernetes.core.k8s: diff --git a/install/roles/automation-hub/tasks/scenario-deployment/workflows/infra-argo-workflows.yaml b/install/roles/automation-hub/tasks/scenario-deployment/workflows/infra-argo-workflows.yaml index 2d84a1c0..9c2cc517 100644 --- a/install/roles/automation-hub/tasks/scenario-deployment/workflows/infra-argo-workflows.yaml +++ b/install/roles/automation-hub/tasks/scenario-deployment/workflows/infra-argo-workflows.yaml @@ -20,3 +20,79 @@ verify_ssl: no apply: true with_fileglob: 'templates/argo-workflows/eventsource/*.j2' + +- name: Wait for EventSources - Deployed + kubernetes.core.k8s_info: + kubeconfig: "{{ kubeconfig_path }}/{{ infra_context_name }}" + namespace: "{{ infra_workflow_namespace }}" + kind: EventSource + api_version: argoproj.io/v1alpha1 + name: "{{ item }}" + wait: true + verify_ssl: no + wait_condition: + type: Deployed + status: True + loop: + - automation-hub + register: eventsource_info + +# TODO - Fail if single sensor is not found, this could be improved to properly check the status +- name: Fail if EventSource is not found + fail: + msg: "EventSource automation-hub not found." + loop: "{{ eventsource_info.results }}" + when: item.resources | length == 0 + +- name: Wait for EventSources - SourcesProvided + kubernetes.core.k8s_info: + kubeconfig: "{{ kubeconfig_path }}/{{ infra_context_name }}" + namespace: "{{ infra_workflow_namespace }}" + kind: EventSource + api_version: argoproj.io/v1alpha1 + name: "{{ item }}" + wait: true + verify_ssl: no + wait_condition: + type: SourcesProvided + status: True + loop: + - automation-hub + +- name: Wait for Sensors - Deployed + kubernetes.core.k8s_info: + kubeconfig: "{{ kubeconfig_path }}/{{ infra_context_name }}" + namespace: "{{ infra_workflow_namespace }}" + kind: Sensor + api_version: argoproj.io/v1alpha1 + name: "{{ item }}" + wait: true + verify_ssl: no + wait_condition: + type: Deployed + status: True + loop: + - automation-hub + register: sensor_info + +# TODO - Fail if single sensor is not found, this could be improved to properly check the status +- name: Fail if Sensor is not found + fail: + msg: "Sensor automation-hub not found." + loop: "{{ sensor_info.results }}" + when: item.resources | length == 0 + +- name: Wait for Sensors - TriggersProvided + kubernetes.core.k8s_info: + kubeconfig: "{{ kubeconfig_path }}/{{ infra_context_name }}" + namespace: "{{ infra_workflow_namespace }}" + kind: Sensor + api_version: argoproj.io/v1alpha1 + name: "{{ item }}" + wait: true + verify_ssl: no + wait_condition: + type: TriggersProvided + status: True + loop: + - automation-hub \ No newline at end of file diff --git a/install/roles/automation-hub/templates/acm/07-multicluster-observability.yaml.j2 b/install/roles/automation-hub/templates/acm/07-multicluster-observability.yaml.j2 index e151a386..a2342076 100644 --- a/install/roles/automation-hub/templates/acm/07-multicluster-observability.yaml.j2 +++ b/install/roles/automation-hub/templates/acm/07-multicluster-observability.yaml.j2 @@ -24,8 +24,9 @@ spec: receiveStorageSize: 100Gi ruleStorageSize: 10Gi storageClass: standard-csi + # This might need increase in the future storeStorageSize: 10Gi - # For more info see https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/2.7/html-single/apis/index + # For more info see https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/2.12/html-single/apis/index advanced: receive: replicas: 3 diff --git a/install/roles/automation-hub/templates/argo/applications/amq-streams-infra.yaml b/install/roles/automation-hub/templates/argo/applications/amq-streams-infra.yaml index 4803357d..94172516 100644 --- a/install/roles/automation-hub/templates/argo/applications/amq-streams-infra.yaml +++ b/install/roles/automation-hub/templates/argo/applications/amq-streams-infra.yaml @@ -3,6 +3,8 @@ kind: ApplicationSet metadata: name: amq-streams-infra spec: + syncPolicy: + preserveResourcesOnDeletion: true generators: - matrix: generators: @@ -36,7 +38,6 @@ spec: selfHeal: true syncOptions: - CreateNamespace=true - preserveResourcesOnDeletion: true managedNamespaceMetadata: labels: project: skodjob diff --git a/install/roles/automation-hub/templates/argo/applications/debezium.yaml b/install/roles/automation-hub/templates/argo/applications/debezium.yaml index 7e336e9b..095f1aa2 100644 --- a/install/roles/automation-hub/templates/argo/applications/debezium.yaml +++ b/install/roles/automation-hub/templates/argo/applications/debezium.yaml @@ -3,6 +3,8 @@ kind: ApplicationSet metadata: name: debezium spec: + syncPolicy: + preserveResourcesOnDeletion: true generators: - matrix: generators: @@ -36,7 +38,6 @@ spec: selfHeal: true syncOptions: - CreateNamespace=true - preserveResourcesOnDeletion: true managedNamespaceMetadata: labels: project: skodjob diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/infra/argo-alerts.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/infra/argo-alerts.yaml.j2 index e04afef8..cbce6393 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/infra/argo-alerts.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/infra/argo-alerts.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/argo directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-cluster-operator-kraft.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-cluster-operator-kraft.yaml.j2 index 1202ea7f..b5d8b468 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-cluster-operator-kraft.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-cluster-operator-kraft.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/strimzi-operator directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-cluster-operator.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-cluster-operator.yaml.j2 index 3d2f9851..3e87d77a 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-cluster-operator.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-cluster-operator.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/strimzi-operator directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-drain-cleaner.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-drain-cleaner.yaml.j2 index 1e041e3c..d50397ed 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-drain-cleaner.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-drain-cleaner.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/strimzi-drain-cleaner directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-connect.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-connect.yaml.j2 index a78d815f..de2a2e81 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-connect.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-connect.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/kafka-connect directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-kraft.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-kraft.yaml.j2 index 3b8986aa..0091e694 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-kraft.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-kraft.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/kafka-kraft directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-mm2-kraft.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-mm2-kraft.yaml.j2 index cb3aa96d..dc76d101 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-mm2-kraft.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-mm2-kraft.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/kafka-mirror-maker directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-mm2.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-mm2.yaml.j2 index 06f1f2e0..d0e1dc64 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-mm2.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka-mm2.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/kafka-mirror-maker directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka.yaml.j2 index 8c884054..e39f393c 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-01/strimzi-alerts-kafka.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/kafka directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-cluster-operator.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-cluster-operator.yaml.j2 index 35dab370..1ebb0cd2 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-cluster-operator.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-cluster-operator.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/strimzi-operator directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-drain-cleaner.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-drain-cleaner.yaml.j2 index 65d465bb..e92404c8 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-drain-cleaner.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-drain-cleaner.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/strimzi-drain-cleaner directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-kafka.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-kafka.yaml.j2 index 3e3dbe8c..b7388f54 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-kafka.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/alerts/worker-02/strimzi-alerts-kafka.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/alerts/kafka directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/monitoring/dashboards/grafana-dashboards.yaml.j2 b/install/roles/automation-hub/templates/argo/applications/monitoring/dashboards/grafana-dashboards.yaml.j2 index 22fee6a6..dfadc0fd 100644 --- a/install/roles/automation-hub/templates/argo/applications/monitoring/dashboards/grafana-dashboards.yaml.j2 +++ b/install/roles/automation-hub/templates/argo/applications/monitoring/dashboards/grafana-dashboards.yaml.j2 @@ -9,7 +9,7 @@ spec: project: monitoring source: repoURL: https://github.com/skodjob/deployment-hub - targetRevision: HEAD + targetRevision: {{ deployment_hub_branch }} path: metrics/grafana/dashboards directory: recurse: true diff --git a/install/roles/automation-hub/templates/argo/applications/strimzi-infra.yaml b/install/roles/automation-hub/templates/argo/applications/strimzi-infra.yaml index 82e39466..9113b714 100644 --- a/install/roles/automation-hub/templates/argo/applications/strimzi-infra.yaml +++ b/install/roles/automation-hub/templates/argo/applications/strimzi-infra.yaml @@ -3,6 +3,8 @@ kind: ApplicationSet metadata: name: strimzi-infra spec: + syncPolicy: + preserveResourcesOnDeletion: true generators: - matrix: generators: @@ -47,7 +49,6 @@ spec: selfHeal: true syncOptions: - CreateNamespace=true - preserveResourcesOnDeletion: true managedNamespaceMetadata: labels: project: skodjob diff --git a/install/roles/automation-hub/templates/grafana/grafana-data-source.yaml.j2 b/install/roles/automation-hub/templates/grafana/grafana-data-source.yaml.j2 index ac291191..e9d42883 100644 --- a/install/roles/automation-hub/templates/grafana/grafana-data-source.yaml.j2 +++ b/install/roles/automation-hub/templates/grafana/grafana-data-source.yaml.j2 @@ -5,7 +5,7 @@ apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDatasource metadata: - name: {{ cluster.name }}-source + name: {{ datasource_name }}-source labels: project: "skodjob" app: grafana @@ -19,9 +19,8 @@ spec: instanceSelector: matchLabels: dashboards: "skodjob" - name: skodjob.yaml datasource: - name: {{ cluster.name }} + name: {{ datasource_name }} type: prometheus access: proxy # url: https://thanos-querier.openshift-monitoring.svc.cluster.local:9091 @@ -29,9 +28,8 @@ spec: basicAuth: false basicAuthUser: internal isDefault: false - version: 1 editable: true -{% if cluster.name != 'skodjob-thanos' %} +{% if datasource_name != 'skodjob-thanos' %} jsonData: tlsSkipVerify: true timeInterval: "5s" diff --git a/install/roles/automation-hub/templates/grafana/grafana-setup.yaml.j2 b/install/roles/automation-hub/templates/grafana/grafana-setup.yaml.j2 index f8295301..fad4e27a 100644 --- a/install/roles/automation-hub/templates/grafana/grafana-setup.yaml.j2 +++ b/install/roles/automation-hub/templates/grafana/grafana-setup.yaml.j2 @@ -1,4 +1,4 @@ -{% if cluster is defined %} +{% if is_worker is defined %} {% set namespace = cluster.monitoring_namespace %} {% set name = cluster.name %} {% else %} @@ -17,6 +17,18 @@ metadata: annotations: argocd.argoproj.io/compare-options: IgnoreExtraneous --- +apiVersion: v1 +kind: Secret +type: kubernetes.io/service-account-token +metadata: + name: {{ name }}-grafana + namespace: {{ namespace }} + labels: + app: grafana + project: skodjob + annotations: + kubernetes.io/service-account.name: {{ name }}-grafana +--- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: