k8s-monitoring 2.0 alpha #1876
Workflow file for this run
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
--- | |
name: Test | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
branches: ["main"] | |
paths: | |
- 'charts/k8s-monitoring-v1/**' | |
pull_request: | |
paths: | |
- 'charts/k8s-monitoring-v1/**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
CT_CONFIGFILE: "${{ github.workspace }}/.github/configs/ct.yaml" | |
LINT_CONFIGFILE: "${{ github.workspace }}/.configs/lintconf.yaml" | |
GRAFANA_ALLOY_VALUES: "${{ github.workspace }}/.github/configs/alloy-config.yaml" | |
GRAFANA_ALLOY_LOKI_OTLP_VALUES: "${{ github.workspace }}/.github/configs/alloy-config-loki-otlp.yaml" | |
GRAFANA_ALLOY_RECEIVER_SERVICE: "${{ github.workspace }}/.github/configs/receiver-service.yaml" | |
PROMETHEUS_VALUES: "${{ github.workspace }}/.github/configs/prometheus.yaml" | |
PROMETHEUS_WORKLOAD_VALUES: "${{ github.workspace }}/.github/configs/prometheus-workload.yaml" | |
CREDENTIALS: "${{ github.workspace }}/.github/configs/credentials.yaml" | |
LOKI_VALUES: "${{ github.workspace }}/.github/configs/loki.yaml" | |
TEMPO_VALUES: "" # No values for now | |
PYROSCOPE_VALUES: "${{ github.workspace }}/.github/configs/pyroscope.yaml" | |
GRAFANA_VALUES: "${{ github.workspace }}/.github/configs/grafana.yaml" | |
PODLOGS_OBJECTS: "${{ github.workspace }}/.github/configs/podlogs.yaml" | |
MYSQL_VALUES: "${{ github.workspace }}/.github/configs/mysql.yaml" | |
MYSQL_CONFIG_MANIFEST: "${{ github.workspace }}/.github/configs/mysql-config.yaml" | |
CERT_MANAGER_VALUES: "${{ github.workspace }}/.github/configs/cert-manager.yaml" | |
SECRETGEN_CONTROLLER_MANIFEST: https://github.com/carvel-dev/secretgen-controller/releases/latest/download/release.yml | |
CERTIFICATES_MANIFEST: "${{ github.workspace }}/.github/configs/certificates.yaml" | |
jobs: | |
check-for-doc-changes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Regenerate docs | |
run: | | |
docker run --rm \ | |
-v "$(pwd)/charts/k8s-monitoring-v1:/helm-docs" \ | |
-u "$(id -u)" \ | |
jnorwood/helm-docs | |
if ! git diff --exit-code; then | |
echo "Helm chart documentation is not up to date. Please run 'helm-docs' and commit changes!" >&2 | |
exit 1 | |
fi | |
check-for-example-output-changes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Helm | |
uses: azure/setup-helm@v4 | |
- name: Check for example output changes | |
working-directory: charts/k8s-monitoring-v1 | |
run: | | |
make clean examples | |
if [[ -n "$(git status --porcelain)" ]]; then | |
echo "k8s-monitoring Helm chart v1 examples are not up to date. Please run 'make clean examples', examine changes, and commit changes." >&2 | |
exit 1 | |
fi | |
static-test-chart: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for `ct lint` to work | |
- name: Install Helm | |
uses: azure/setup-helm@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
check-latest: true | |
- name: Set up chart-testing | |
uses: helm/chart-testing-action@v2 | |
- name: Install yq | |
run: pip install yq | |
- name: Install ShellSpec | |
run: | | |
curl -fsSL https://git.io/shellspec | sh -s -- --yes | |
# Installing Grafana Alloy because we need it to lint the generated alloy config files. | |
# https://grafana.com/docs/alloy/latest/get-started/install/linux/ | |
- name: Install Grafana Alloy | |
run: | | |
sudo mkdir -p /etc/apt/keyrings/ | |
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null | |
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list | |
sudo apt-get update | |
sudo apt-get install -y alloy | |
- name: Run tests | |
run: make test | |
working-directory: charts/k8s-monitoring-v1 | |
test-chart: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
check-latest: true | |
- name: Set up chart-testing | |
uses: helm/chart-testing-action@v2 | |
- name: List changed charts | |
id: list-changed | |
run: | | |
latestRelease=$(git describe --abbrev=0 --tags) | |
changed=$(ct list-changed --config "${CT_CONFIGFILE}" --since "${latestRelease}") | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> "${GITHUB_OUTPUT}" | |
fi | |
- name: Create kind cluster | |
uses: helm/kind-action@v1 | |
if: (steps.list-changed.outputs.changed == 'true') || (contains(github.event.pull_request.labels.*.name, 'full_test_required')) | |
with: | |
config: "${{ github.workspace }}/.github/configs/cluster-config.yaml" | |
- name: Create Certs and Credentials | |
if: (steps.list-changed.outputs.changed == 'true') || (contains(github.event.pull_request.labels.*.name, 'full_test_required')) | |
run: | | |
kubectl apply -f "${SECRETGEN_CONTROLLER_MANIFEST}" | |
kubectl apply -f "${CERTIFICATES_MANIFEST}" | |
kubectl apply -f "${CREDENTIALS}" | |
- name: Set up Helm repositories | |
if: (steps.list-changed.outputs.changed == 'true') || (contains(github.event.pull_request.labels.*.name, 'full_test_required')) | |
run: | | |
helm repo add grafana https://grafana.github.io/helm-charts | |
helm repo add jetstack https://charts.jetstack.io | |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | |
helm repo update | |
- name: Deploy Services for Test Data | |
if: (steps.list-changed.outputs.changed == 'true') || (contains(github.event.pull_request.labels.*.name, 'full_test_required')) | |
run: | | |
# MySQL for integration testing | |
helm install mysql oci://registry-1.docker.io/bitnamicharts/mysql -f "${MYSQL_VALUES}" -n mysql --create-namespace --wait | |
kubectl apply -f "${MYSQL_CONFIG_MANIFEST}" | |
# Cert Manager for integration testing (service annotations) | |
helm install cert-manager jetstack/cert-manager -f "${CERT_MANAGER_VALUES}" -n cert-manager --create-namespace --wait | |
# This alloy instance is only used for generating metrics, logs, and traces that'll get | |
# sent to the K8s Monitoring Alloy to test ingesting MLT from receivers. | |
kubectl apply -f "${GRAFANA_ALLOY_RECEIVER_SERVICE}" | |
helm install alloy grafana/alloy -f "${GRAFANA_ALLOY_VALUES}" -n alloy --create-namespace --wait | |
# This prometheus instance is used pod annotation testing with https | |
helm install prometheus-workload prometheus-community/prometheus -f "${PROMETHEUS_WORKLOAD_VALUES}" -n prometheus --create-namespace --wait | |
# Deploy the Prometheus Operator CRDs, since we want to deploy Loki with a ServiceMonitor later | |
helm install prom-crds prometheus-community/prometheus-operator-crds --wait | |
- name: Deploy Prometheus | |
if: (steps.list-changed.outputs.changed == 'true') || (contains(github.event.pull_request.labels.*.name, 'full_test_required')) | |
run: | | |
helm install prometheus prometheus-community/prometheus -f "${PROMETHEUS_VALUES}" -n prometheus --create-namespace --wait | |
- name: Deploy Loki | |
if: (steps.list-changed.outputs.changed == 'true') || (contains(github.event.pull_request.labels.*.name, 'full_test_required')) | |
run: | | |
helm install loki grafana/loki -f "${LOKI_VALUES}" -n loki --create-namespace --wait | |
helm install loki-otlp grafana/alloy -f "${GRAFANA_ALLOY_LOKI_OTLP_VALUES}" -n loki --wait | |
- name: Deploy Tempo | |
if: (steps.list-changed.outputs.changed == 'true') || (contains(github.event.pull_request.labels.*.name, 'full_test_required')) | |
run: | | |
helm install tempo grafana/tempo -n tempo --create-namespace --wait | |
- name: Deploy Pyroscope | |
if: (steps.list-changed.outputs.changed == 'true') || (contains(github.event.pull_request.labels.*.name, 'full_test_required')) | |
run: | | |
helm install pyroscope grafana/pyroscope -f "${PYROSCOPE_VALUES}" -n pyroscope --create-namespace --wait | |
- name: Deploy Grafana | |
if: (steps.list-changed.outputs.changed == 'true') || (contains(github.event.pull_request.labels.*.name, 'full_test_required')) | |
run: | | |
helm install grafana grafana/grafana -f "${GRAFANA_VALUES}" -n grafana --create-namespace --wait | |
kubectl apply -f "${PODLOGS_OBJECTS}" | |
- name: Test chart | |
if: (steps.list-changed.outputs.changed == 'true') || (contains(github.event.pull_request.labels.*.name, 'full_test_required')) | |
run: | | |
latestRelease=$(git describe --abbrev=0 --tags) | |
ct install --all --config "${CT_CONFIGFILE}" --since "${latestRelease}" --helm-extra-args "--timeout 10m" --charts "k8s-monitoring-v1" |