-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pete Wall <pete.wall@grafana.com>
- Loading branch information
Showing
11 changed files
with
146 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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,79 @@ | ||
--- | ||
name: Platform Test | ||
# yamllint disable-line rule:truthy | ||
on: | ||
push: | ||
branches: ["main"] | ||
paths: | ||
- 'charts/**' | ||
- '!charts/k8s-monitoring-v1/**' | ||
pull_request: | ||
paths: | ||
- 'charts/**' | ||
- '!charts/k8s-monitoring-v1/**' | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
list-tests: | ||
name: List tests | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tests: ${{ steps.list_tests.outputs.tests }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: List tests | ||
id: list_tests | ||
run: | | ||
contains(github.event.pull_request.labels.*.name, 'example-label') | ||
if [ "${{ github.event_name }}" == "pull_request" ] && [ "${{contains(github.event.pull_request.labels.*.name, 'run-platform-tests')}}" != "true" ]; then | ||
echo "Skipping platform tests" | ||
exit 0 | ||
fi | ||
tests=$(ls charts/k8s-monitoring/tests/platform) | ||
echo "Tests: ${tests}" | ||
echo "tests=$(echo "${tests}" | jq --raw-input --slurp --compact-output 'split("\n") | map(select(. != ""))')" >> "${GITHUB_OUTPUT}" | ||
run-tests: | ||
name: Platform Test | ||
needs: list-tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
test: ${{ fromJson(needs.list-tests.outputs.tests) }} | ||
fail-fast: false | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Helm | ||
uses: azure/setup-helm@v4 | ||
|
||
- name: Check for cluster config | ||
id: check-cluster-config | ||
run: | | ||
if [ -f "charts/k8s-monitoring/tests/integration/${{ matrix.test }}/cluster.yaml" ]; then | ||
echo "has-cluster-config=true" >> "${GITHUB_OUTPUT}" | ||
else | ||
echo "has-cluster-config=false" >> "${GITHUB_OUTPUT}" | ||
fi | ||
- name: Create kind cluster | ||
if: ${{ steps.check-cluster-config.outputs.has-cluster-config == 'false' }} | ||
uses: helm/kind-action@v1 | ||
|
||
- name: Create kind cluster with special config | ||
if: ${{ steps.check-cluster-config.outputs.has-cluster-config == 'true' }} | ||
uses: helm/kind-action@v1 | ||
with: | ||
config: charts/k8s-monitoring/tests/integration/${{ matrix.test }}/cluster.yaml | ||
|
||
- name: Run test | ||
env: | ||
CREATE_CLUSTER: "false" | ||
DEPLOY_GRAFANA: "false" | ||
run: ./scripts/run-integration-test.sh "charts/k8s-monitoring/tests/platform/${{ matrix.test }}" |
This file contains 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 |
---|---|---|
@@ -1,23 +1,5 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ | ||
docs | ||
schema-mods | ||
Makefile | ||
README.md | ||
README.md.gotmpl |
This file contains 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 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 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 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,5 @@ | ||
export GRAFANA_CLOUD_FLEET_MGMT_USER=$(op --account grafana.1password.com read "op://Kubernetes Monitoring/helmchart Fleet Management/username") | ||
export GRAFANA_CLOUD_FLEET_MGMT_TOKEN=$(op --account grafana.1password.com read "op://Kubernetes Monitoring/helmchart Fleet Management/password") | ||
export GRAFANA_CLOUD_METRICS_USERNAME=$(op --account grafana.1password.com read "op://Kubernetes Monitoring/helmchart Prometheus/username") | ||
export GRAFANA_CLOUD_LOGS_USERNAME=$(op --account grafana.1password.com read "op://Kubernetes Monitoring/helmchart Loki/username") | ||
export GRAFANA_CLOUD_RW_POLICY_TOKEN=$(op --account grafana.1password.com read "op://Kubernetes Monitoring/helmchart Loki/password") |
13 changes: 13 additions & 0 deletions
13
charts/k8s-monitoring/tests/platform/remote-config/grafana-cloud-credentials.yaml
This file contains 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,13 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: grafana-cloud-credentials | ||
stringData: | ||
GRAFANA_CLOUD_FLEET_MGMT_USER: "$GRAFANA_CLOUD_FLEET_MGMT_USER" | ||
GRAFANA_CLOUD_FLEET_MGMT_TOKEN: "$GRAFANA_CLOUD_FLEET_MGMT_TOKEN" | ||
PROMETHEUS_URL: "https://prometheus-prod-13-prod-us-east-0.grafana.net/api/prom/api/v1/query" | ||
PROMETHEUS_USER: "$GRAFANA_CLOUD_METRICS_USERNAME" | ||
PROMETHEUS_PASS: "$GRAFANA_CLOUD_RW_POLICY_TOKEN" | ||
LOKI_USER: "$GRAFANA_CLOUD_LOGS_USERNAME" | ||
LOKI_PASS: "$GRAFANA_CLOUD_RW_POLICY_TOKEN" |
5 changes: 5 additions & 0 deletions
5
charts/k8s-monitoring/tests/platform/remote-config/test-manifest.yaml
This file contains 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,5 @@ | ||
--- | ||
prerequisites: | ||
- type: manifest | ||
name: grafana-cloud-credentials | ||
file: charts/k8s-monitoring/tests/platform/remote-config/grafana-cloud-credentials.yaml |
8 changes: 8 additions & 0 deletions
8
charts/k8s-monitoring/tests/platform/remote-config/test-values.yaml
This file contains 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 @@ | ||
--- | ||
tests: | ||
- envFrom: | ||
- secretRef: | ||
name: grafana-cloud-credentials | ||
queries: | ||
- query: alloy_build_info{cluster="remote-config-platform-test"} | ||
type: promql |
18 changes: 18 additions & 0 deletions
18
charts/k8s-monitoring/tests/platform/remote-config/values.yaml
This file contains 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,18 @@ | ||
--- | ||
cluster: | ||
name: remote-config-platform-test | ||
|
||
alloy-metrics: | ||
enabled: true | ||
remoteConfig: | ||
enabled: true | ||
url: https://fleet-management-prod-008.grafana.net | ||
auth: | ||
type: basic | ||
usernameFrom: env("GRAFANA_CLOUD_FLEET_MGMT_USER") | ||
passwordFrom: env("GRAFANA_CLOUD_FLEET_MGMT_TOKEN") | ||
alloy: | ||
stabilityLevel: public-preview | ||
envFrom: | ||
- secretRef: | ||
name: grafana-cloud-credentials |
This file contains 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