diff --git a/.github/env b/.github/env index 61ba8b53179e9b09c9e0e5ff8606f7696f56126a..ece489c22f0fcf2d366e23eb583aa2827bb2cb28 100644 --- a/.github/env +++ b/.github/env @@ -1,2 +1,2 @@ -kind-version=v0.27.0 +kind-version=v0.28.0 golang-version=1.24 diff --git a/.github/workflows/action-lint.yaml b/.github/workflows/action-lint.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4a073d0b24f8fc37089278a5257a281c6e879c37 --- /dev/null +++ b/.github/workflows/action-lint.yaml @@ -0,0 +1,22 @@ +name: lint gitHub action workflows +on: + push: + paths: + - ".github/workflows/**" + pull_request: + paths: + - ".github/workflows/**" + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Download actionlint + id: get_actionlint + run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/v1.7.7/scripts/download-actionlint.bash) + shell: bash + - name: Check workflow files + run: ${{ steps.get_actionlint.outputs.executable }} -color + shell: bash diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eeaf7a91c611b8c57630219788b462c2ec326c06..5a002e70d4cc28dee719441c394ec57b541086f1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,115 +12,115 @@ jobs: - ubuntu-latest name: Generate steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Import environment variables from file - run: cat ".github/env" >> "$GITHUB_ENV" - - uses: actions/setup-go@v5 - with: - go-version: ${{ env.golang-version }} - - run: make --always-make generate validate && git diff --exit-code + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Import environment variables from file + run: cat ".github/env" >> "$GITHUB_ENV" + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.golang-version }} + - run: make --always-make generate validate && git diff --exit-code check-docs: runs-on: ubuntu-latest name: Check Documentation formatting and links steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Import environment variables from file - run: cat ".github/env" >> "$GITHUB_ENV" - - uses: actions/setup-go@v5 - with: - go-version: ${{ env.golang-version }} - - run: make check-docs + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Import environment variables from file + run: cat ".github/env" >> "$GITHUB_ENV" + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.golang-version }} + - run: make check-docs lint: runs-on: ubuntu-latest name: Jsonnet linter steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Import environment variables from file - run: cat ".github/env" >> "$GITHUB_ENV" - - uses: actions/setup-go@v5 - with: - go-version: ${{ env.golang-version }} - - run: make --always-make lint + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Import environment variables from file + run: cat ".github/env" >> "$GITHUB_ENV" + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.golang-version }} + - run: make --always-make lint fmt: runs-on: ubuntu-latest name: Jsonnet formatter steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Import environment variables from file - run: cat ".github/env" >> "$GITHUB_ENV" - - uses: actions/setup-go@v5 - with: - go-version: ${{ env.golang-version }} - - run: make --always-make fmt && git diff --exit-code + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Import environment variables from file + run: cat ".github/env" >> "$GITHUB_ENV" + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.golang-version }} + - run: make --always-make fmt && git diff --exit-code unit-tests: runs-on: ubuntu-latest name: Unit tests steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Import environment variables from file - run: cat ".github/env" >> "$GITHUB_ENV" - - uses: actions/setup-go@v5 - with: - go-version: ${{ env.golang-version }} - - run: make --always-make test + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Import environment variables from file + run: cat ".github/env" >> "$GITHUB_ENV" + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.golang-version }} + - run: make --always-make test security-audit: runs-on: ubuntu-latest name: Run security analysis on manifests steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - run: make --always-make kubescape + - uses: actions/checkout@v4 + with: + persist-credentials: false + - run: make --always-make kubescape e2e-tests: name: E2E tests runs-on: ubuntu-latest strategy: matrix: kind-image: - - 'kindest/node:v1.33.0' - - 'kindest/node:v1.32.3' - - 'kindest/node:v1.31.6' + - "kindest/node:v1.33.1" + - "kindest/node:v1.32.5" + - "kindest/node:v1.31.9" steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Import environment variables from file - run: cat ".github/env" >> "$GITHUB_ENV" - - uses: actions/setup-go@v5 - with: - go-version: ${{ env.golang-version }} - - name: Start kind cluster - uses: helm/kind-action@v1.12.0 - with: - version: ${{ env.kind-version }} - node_image: ${{ matrix.kind-image }} - wait: 10s # Without default CNI, control-plane doesn't get ready until Cilium is installed - config: .github/workflows/kind/config.yml - cluster_name: e2e - - name: Install kube-router for NetworkPolicy support - run: | - kubectl apply -f .github/workflows/kind/kube-router.yaml - - name: Wait for cluster to finish bootstraping - run: kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s - - name: Create kube-prometheus stack - run: | - kubectl create -f manifests/setup - until kubectl get servicemonitors --all-namespaces ; do date; sleep 1; echo ""; done - kubectl create -f manifests/ - - name: Run tests - run: | - export KUBECONFIG="${HOME}/.kube/config" - make test-e2e + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Import environment variables from file + run: cat ".github/env" >> "$GITHUB_ENV" + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.golang-version }} + - name: Start kind cluster + uses: helm/kind-action@v1.12.0 + with: + version: ${{ env.kind-version }} + node_image: ${{ matrix.kind-image }} + wait: 10s # Without default CNI, control-plane doesn't get ready until Cilium is installed + config: tests/e2e/kind/config.yml + cluster_name: e2e + - name: Install kube-router for NetworkPolicy support + run: | + kubectl apply -f tests/e2e/kind/kube-router.yaml + - name: Wait for cluster to finish bootstraping + run: kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s + - name: Create kube-prometheus stack + run: | + kubectl create -f manifests/setup + until kubectl get servicemonitors --all-namespaces ; do date; sleep 1; echo ""; done + kubectl create -f manifests/ + - name: Run tests + run: | + export KUBECONFIG="${HOME}/.kube/config" + make test-e2e # Added to summarize the matrix and allow easy branch protection rules setup e2e-tests-result: diff --git a/.github/workflows/versions.yaml b/.github/workflows/versions.yaml index 784cdb58613097da8e6deb87a68e642be7eddc58..56ca7f2d51967ad54817cf845226c950973b7f2c 100644 --- a/.github/workflows/versions.yaml +++ b/.github/workflows/versions.yaml @@ -3,84 +3,84 @@ name: Upgrade to latest versions on: workflow_dispatch: schedule: - - cron: '37 7 * * 1' + - cron: "37 7 * * 1" jobs: versions: runs-on: ubuntu-latest strategy: matrix: branch: - - 'release-0.11' - - 'release-0.12' - - 'release-0.13' - - 'main' + - "release-0.11" + - "release-0.12" + - "release-0.13" + - "main" steps: - - uses: actions/checkout@v4 - with: - ref: ${{ matrix.branch }} - - name: Import environment variables from file - run: cat ".github/env" >> "$GITHUB_ENV" - - uses: actions/setup-go@v5 - with: - go-version: ${{ env.golang-version }} - - name: Upgrade versions - id: versions - run: | - export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - # Write to temporary file to make update atomic - scripts/generate-versions.sh > /tmp/versions.json - mv /tmp/versions.json jsonnet/kube-prometheus/versions.json - # Display the raw diff between versions. - git diff - # Get the links to the changelogs of the updated versions and make them - # available to the reviewers - { - echo 'new_changelogs<<EOF' - echo $(scripts/get-new-changelogs.sh) - echo EOF - } >> $GITHUB_OUTPUT - if: matrix.branch == 'main' - - name: Update jsonnet dependencies - run: | - make update - make generate + - uses: actions/checkout@v4 + with: + ref: ${{ matrix.branch }} + - name: Import environment variables from file + run: cat ".github/env" >> "$GITHUB_ENV" + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.golang-version }} + - name: Upgrade versions + id: versions + run: | + export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" + # Write to temporary file to make update atomic + scripts/generate-versions.sh > /tmp/versions.json + mv /tmp/versions.json jsonnet/kube-prometheus/versions.json + # Display the raw diff between versions. + git diff + # Get the links to the changelogs of the updated versions and make them + # available to the reviewers + { + echo "new_changelogs<<EOF" + scripts/get-new-changelogs.sh + echo "EOF" + } >> "$GITHUB_OUTPUT" + if: matrix.branch == 'main' + - name: Update jsonnet dependencies + run: | + make update + make generate - # Reset jsonnetfile.lock.json if no dependencies were updated - changedFiles=$(git diff --name-only | grep -v 'jsonnetfile.lock.json' | wc -l) - if [[ "$changedFiles" -eq 0 ]]; then - git checkout -- jsonnetfile.lock.json; - fi - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - commit-message: "[bot] [${{ matrix.branch }}] Automated version update" - title: "[bot] [${{ matrix.branch }}] Automated version update" - body: | - ## Description + # Reset jsonnetfile.lock.json if no dependencies were updated + changedFiles=$(git diff --name-only | grep -vc 'jsonnetfile.lock.json') + if [[ "$changedFiles" -eq 0 ]]; then + git checkout -- jsonnetfile.lock.json; + fi + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + commit-message: "[bot] [${{ matrix.branch }}] Automated version update" + title: "[bot] [${{ matrix.branch }}] Automated version update" + body: | + ## Description - This is an automated version and jsonnet dependencies update performed from CI. + This is an automated version and jsonnet dependencies update performed from CI. - Please review the following changelogs to make sure that we don't miss any important - changes before merging this PR. + Please review the following changelogs to make sure that we don't miss any important + changes before merging this PR. - ${{ steps.versions.outputs.new_changelogs }} + ${{ steps.versions.outputs.new_changelogs }} - Configuration of the workflow is located in `.github/workflows/versions.yaml`. + Configuration of the workflow is located in `.github/workflows/versions.yaml`. - ## Type of change + ## Type of change - - [x] `NONE` (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.) + - [x] `NONE` (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.) - ## Changelog entry + ## Changelog entry - ```release-note + ```release-note - ``` - team-reviewers: kube-prometheus-reviewers - committer: Prometheus Operator Bot <prom-op-bot@users.noreply.github.com> - author: Prometheus Operator Bot <prom-op-bot@users.noreply.github.com> - branch: automated-updates-${{ matrix.branch }} - delete-branch: true - # GITHUB_TOKEN cannot be used as it won't trigger CI in a created PR - # More in https://github.com/peter-evans/create-pull-request/issues/155 - token: ${{ secrets.PROM_OP_BOT_PAT }} + ``` + team-reviewers: kube-prometheus-reviewers + committer: Prometheus Operator Bot <prom-op-bot@users.noreply.github.com> + author: Prometheus Operator Bot <prom-op-bot@users.noreply.github.com> + branch: automated-updates-${{ matrix.branch }} + delete-branch: true + # GITHUB_TOKEN cannot be used as it won't trigger CI in a created PR + # More in https://github.com/peter-evans/create-pull-request/issues/155 + token: ${{ secrets.PROM_OP_BOT_PAT }} diff --git a/README.md b/README.md index 671a00ba1f09864ee231a8215a2d02fb3b094975..511803b1c6dba9867db35ffc59833e36be493386 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ be created successfully. kubectl delete --ignore-not-found=true -f manifests/ -f manifests/setup ``` -The [official documentation](https://prometheus-operator.dev/docs/prologue/quick-start/) contains the full version of this quick-start guide, and includes instructions on how to access Prometheus, AlertManager, and Grafana. +The [official documentation](http://prometheus-operator.dev/docs/getting-started/installation/) contains the full version of this quick-start guide, and includes [instructions](https://prometheus-operator.dev/kube-prometheus/kube/access-ui/) on how to access Prometheus, AlertManager, and Grafana. ### minikube diff --git a/.github/workflows/kind/config.yml b/tests/e2e/kind/config.yml similarity index 100% rename from .github/workflows/kind/config.yml rename to tests/e2e/kind/config.yml diff --git a/.github/workflows/kind/kube-router.yaml b/tests/e2e/kind/kube-router.yaml similarity index 100% rename from .github/workflows/kind/kube-router.yaml rename to tests/e2e/kind/kube-router.yaml diff --git a/.github/workflows/kind/patches/kube-controller-manager.yaml b/tests/e2e/kind/patches/kube-controller-manager.yaml similarity index 100% rename from .github/workflows/kind/patches/kube-controller-manager.yaml rename to tests/e2e/kind/patches/kube-controller-manager.yaml