Skip to content

Commit

Permalink
Add owner label as a prefix while creating integration
Browse files Browse the repository at this point in the history
  • Loading branch information
John2020-cyber committed Dec 13, 2024
1 parent 77cc5f1 commit 397baf5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
kind: ManagedCluster
register: managed_clusters_raw

- name: Extract the list of ManagedCluster CRs
- name: Extract ManagedCluster details with owner label
ansible.builtin.set_fact:
managed_clusters: "{{ managed_clusters | default([]) + [{'name': item.metadata.name}] }}"
managed_clusters: "{{ managed_clusters | default([]) + [{'name': item.metadata.name, 'owner': item.metadata.labels.owner }}"

Check failure on line 48 in roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml

View workflow job for this annotation

GitHub Actions / Operator Pull Request

jinja[invalid]

Syntax error in jinja2 template: {{ managed_clusters | default([]) + [{'name': item.metadata.name, 'owner': item.metadata.labels.owner }}
loop: "{{ managed_clusters_raw.resources }}"
loop_control:
loop_var: item
Expand Down Expand Up @@ -100,19 +100,19 @@
{{
{
"type": "alertmanager",
"name": item.name,
"name": (item.owner + '-' + item.name),
"default_route": {
"slack": {
"channel_id": slack_channel_validated[loop_index].slack_id,
"enabled": slack_cond
}
"slack": {
"channel_id": slack_channel_validated[loop_index].slack_id,
"enabled": slack_cond
}
} if slack_channel_validated is defined and
slack_channel_validated | length > loop_index and
slack_channel_validated[loop_index].slack_id | length > 0
else {
"type": "alertmanager",
"name": item.name
}
} if slack_channel_validated is defined and
slack_channel_validated | length > loop_index and
slack_channel_validated[loop_index].slack_id | length > 0
else {
"type": "alertmanager",
"name": (item.owner + '-' + item.name)
}
}}
status_code: [200, 201]
Expand Down

0 comments on commit 397baf5

Please sign in to comment.