-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(aro-hcp): add periodic Grafana datasource cleanup job (AROSLSRE-1138) #80947
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
Closed
cssjr
wants to merge
5
commits into
openshift:main
from
cssjr:aroslsre-1138-grafana-cleanup-periodic
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0f029a8
feat(aro-hcp): add periodic Grafana datasource cleanup job (AROSLSRE-…
cssjr 4fa2718
fix: set AZURE_TOKEN_CREDENTIALS=prod for DefaultAzureCredential
cssjr 58d10aa
Update registry metadata.
cssjr 2260d32
Update OWNERS file to use aliases for reviewers and approvers.
cssjr dbe206e
Merge branch 'openshift:main' into aroslsre-1138-grafana-cleanup-peri…
cssjr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
ci-operator/step-registry/aro-hcp/deprovision/grafana-datasources/OWNERS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| approvers: | ||
| - aro-hcp-sl-approvers | ||
| - geoberle | ||
| - deads2k | ||
| reviewers: | ||
| - aro-hcp-sl-reviewers | ||
| - geoberle | ||
| - deads2k |
30 changes: 30 additions & 0 deletions
30
...o-hcp/deprovision/grafana-datasources/aro-hcp-deprovision-grafana-datasources-commands.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/bin/bash | ||
| set -o errexit | ||
| set -o nounset | ||
| set -o pipefail | ||
|
|
||
| export CLUSTER_PROFILE_DIR="/var/run/aro-hcp-${VAULT_SECRET_PROFILE}" | ||
|
|
||
| export AZURE_CLIENT_ID; AZURE_CLIENT_ID=$(cat "${CLUSTER_PROFILE_DIR}/client-id") | ||
| export AZURE_TENANT_ID; AZURE_TENANT_ID=$(cat "${CLUSTER_PROFILE_DIR}/tenant") | ||
| export AZURE_CLIENT_SECRET; AZURE_CLIENT_SECRET=$(cat "${CLUSTER_PROFILE_DIR}/client-secret") | ||
| export AZURE_TOKEN_CREDENTIALS=prod | ||
|
|
||
| az login --service-principal -u "${AZURE_CLIENT_ID}" -p "${AZURE_CLIENT_SECRET}" --tenant "${AZURE_TENANT_ID}" --output none | ||
|
|
||
| export GLOBAL_INFRA_SUBSCRIPTION_ID; GLOBAL_INFRA_SUBSCRIPTION_ID=$(cat "${CLUSTER_PROFILE_DIR}/infra-global-subscription-id") | ||
|
|
||
| echo "Building grafanactl..." | ||
| go build -o /tmp/grafanactl ./tooling/grafanactl | ||
|
|
||
| echo "Running: grafanactl clean datasources" | ||
| /tmp/grafanactl clean datasources \ | ||
| --subscription "${GLOBAL_INFRA_SUBSCRIPTION_ID}" \ | ||
| --resource-group "${GRAFANA_RESOURCE_GROUP}" \ | ||
| --grafana-name "${GRAFANA_NAME}" | ||
|
|
||
| echo "Running: grafanactl clean fixup-datasources" | ||
| /tmp/grafanactl clean fixup-datasources \ | ||
| --subscription "${GLOBAL_INFRA_SUBSCRIPTION_ID}" \ | ||
| --resource-group "${GRAFANA_RESOURCE_GROUP}" \ | ||
| --grafana-name "${GRAFANA_NAME}" |
15 changes: 15 additions & 0 deletions
15
...deprovision/grafana-datasources/aro-hcp-deprovision-grafana-datasources-ref.metadata.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "path": "aro-hcp/deprovision/grafana-datasources/aro-hcp-deprovision-grafana-datasources-ref.yaml", | ||
| "owners": { | ||
| "approvers": [ | ||
| "aro-hcp-sl-approvers", | ||
| "geoberle", | ||
| "deads2k" | ||
| ], | ||
| "reviewers": [ | ||
| "aro-hcp-sl-reviewers", | ||
| "geoberle", | ||
| "deads2k" | ||
| ] | ||
| } | ||
| } | ||
30 changes: 30 additions & 0 deletions
30
.../aro-hcp/deprovision/grafana-datasources/aro-hcp-deprovision-grafana-datasources-ref.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| ref: | ||
| as: aro-hcp-deprovision-grafana-datasources | ||
| from: aro-hcp-e2e-tests | ||
| commands: aro-hcp-deprovision-grafana-datasources-commands.sh | ||
| resources: | ||
| requests: | ||
| cpu: 100m | ||
| memory: 300Mi | ||
| credentials: | ||
| - namespace: test-credentials | ||
| name: cluster-secrets-aro-hcp-dev | ||
| mount_path: /var/run/aro-hcp-dev | ||
| env: | ||
| - name: VAULT_SECRET_PROFILE | ||
| default: "dev" | ||
| documentation: |- | ||
| Selects which environment's cluster secrets to use (dev, int, stg, prod). | ||
| - name: GRAFANA_RESOURCE_GROUP | ||
| default: "global" | ||
| documentation: |- | ||
| Azure resource group containing the Managed Grafana instance. | ||
| - name: GRAFANA_NAME | ||
| default: "arohcp-dev" | ||
| documentation: |- | ||
| Name of the Azure Managed Grafana instance to clean. | ||
| documentation: |- | ||
| Remove orphaned Prometheus datasources from an Azure Managed Grafana instance. | ||
| Runs grafanactl clean datasources (removes stale AMW integrations from the | ||
| Grafana resource) followed by grafanactl clean fixup-datasources (deletes | ||
| Managed_Prometheus_* datasources not backed by a live Azure Monitor Workspace). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.