Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fix for hubSpoke task #40

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions roles/grafana_cloud_operator/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ grafana_cloud_operator_alertmanager_secret_name: alertmanager-main

# SyncSet details
grafana_cloud_operator_syncset_namespace: grafana-cloud-operator

# Mode
grafana_cloud_operator_mode: standalone
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
receiver_url: "{{ item.grafana_details.link }}"
namespace: "{{ item.cluster.namespace }}"
cluster_name: "{{ item.cluster.name }}"
# mode: "{{ gco_cr.spec.provisionMode }}"
loop: "{{ mapped_integrations }}"

- name: Update CR status for SyncSet creation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
reason: "GrafanaIntegrationSuccess"
message: "Grafana integration created successfully"

- name: Display mode string coming in the value
ansible.builtin.debug:
var: grafana_cloud_operator_mode

- name: Modify Alertmanager secret
ansible.builtin.include_tasks: modify_alertmanager_secret.yml
vars:
Expand Down
4 changes: 4 additions & 0 deletions roles/grafana_cloud_operator/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
- name: Execute tasks for hub and spoke topology
ansible.builtin.include_tasks: grafana_oncall_hub_spoke.yml
when: gco_cr.spec.provisionMode == 'hubAndSpoke'
# vars:
# mode: hubAndSpoke

- name: Execute tasks for standalone topology
ansible.builtin.include_tasks: grafana_oncall_standalone.yml
when: gco_cr.spec.provisionMode == 'standalone'
# vars:
# mode: standalone
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@
reason: "AlertmanagerConfigModified"
message: "Decoded and modified the alertmanager secret configuration"

- name: Display mode string coming in the value
ansible.builtin.debug:
var: grafana_cloud_operator_mode

- name: Re-encode modified alertmanager content for cluster
ansible.builtin.set_fact:
encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}"
when: gco_cr.spec.provisionMode == 'hubAndSpoke'
when: grafana_cloud_operator_mode == "hubAndSpoke"

- name: Create a new SyncSet for each cluster to patch alertmanager-main secret
kubernetes.core.k8s:
Expand All @@ -67,5 +71,5 @@
alertmanager.yaml: "{{ encoded_alertmanager_secret_content }}"
when:
- create_integration_for | length > 0
- gco_cr.spec.provisionMode == 'hubAndSpoke'
- grafana_cloud_operator_mode == "hubAndSpoke"
register: syncset_creation_results
Loading