-
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
Open
cssjr
wants to merge
3
commits into
openshift:main
Choose a base branch
from
cssjr:aroslsre-1138-grafana-cleanup-periodic
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
12 changes: 12 additions & 0 deletions
12
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,12 @@ | ||
| approvers: | ||
| - geoberle | ||
| - mmazur | ||
| - roivaz | ||
| - venkateshsredhat | ||
| - deads2k | ||
| reviewers: | ||
| - geoberle | ||
| - mmazur | ||
| - roivaz | ||
| - venkateshsredhat | ||
| - 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}" |
19 changes: 19 additions & 0 deletions
19
...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,19 @@ | ||
| { | ||
| "path": "aro-hcp/deprovision/grafana-datasources/aro-hcp-deprovision-grafana-datasources-ref.yaml", | ||
| "owners": { | ||
| "approvers": [ | ||
| "geoberle", | ||
| "mmazur", | ||
| "roivaz", | ||
| "venkateshsredhat", | ||
| "deads2k" | ||
| ], | ||
| "reviewers": [ | ||
| "geoberle", | ||
| "mmazur", | ||
| "roivaz", | ||
| "venkateshsredhat", | ||
| "deads2k" | ||
| ] | ||
|
Comment on lines
+4
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the alias as in https://github.com/openshift/release/blob/main/ci-operator/step-registry/aro-hcp/deprovision/cleanup-sweeper/OWNERS
You can also just drop the OWNERS file and let it inherit the one from ci-operator/step-registry/aro-hcp/deprovision/OWNERS