|
| 1 | +# Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# Runtime Kind test for the nvsentinel-event-exporter mixin. |
| 16 | +# |
| 17 | +# Checks the bundle gate refuses the exporter without a usable sink, installs |
| 18 | +# the observe step with the exporter via the bundle's own install.sh beside an |
| 19 | +# in-cluster mock OAuth token endpoint and CloudEvents sink, sends synthetic |
| 20 | +# health events into platform-connectors, and asserts what reaches the sink: |
| 21 | +# a client-credentials token taken with the Secret's client secret, the |
| 22 | +# mixin's filter, the CloudEvent shape and metadata, resume tokens in the |
| 23 | +# datastore's database, and delivery after a restart. Not wired into |
| 24 | +# `make qualify`: it needs a Kind cluster. |
| 25 | +# |
| 26 | +# Path filter kept narrow for the same reason as nvsentinel-preflight-e2e.yaml. |
| 27 | + |
| 28 | +name: NVSentinel Event Exporter E2E |
| 29 | + |
| 30 | +on: |
| 31 | + push: |
| 32 | + branches: [main] |
| 33 | + paths: &paths |
| 34 | + - 'recipes/mixins/nvsentinel-observe.yaml' |
| 35 | + - 'recipes/mixins/nvsentinel-event-exporter.yaml' |
| 36 | + - 'recipes/registry.yaml' |
| 37 | + - 'recipes/components/nvsentinel/**' |
| 38 | + - 'recipes/components/nvsentinel-mongodb/**' |
| 39 | + - 'recipes/components/psmdb-operator/**' |
| 40 | + # The tested overlay inherits kind.yaml, which inherits base.yaml, and |
| 41 | + # base.yaml is where nvsentinel enters the chain at all. |
| 42 | + - 'recipes/overlays/h100-kind-training.yaml' |
| 43 | + - 'recipes/overlays/kind.yaml' |
| 44 | + - 'recipes/overlays/base.yaml' |
| 45 | + - 'recipes/components/cert-manager/**' |
| 46 | + - 'recipes/components/prometheus-operator-crds/**' |
| 47 | + - 'pkg/bundler/validations/nvsentinel_event_exporter.go' |
| 48 | + - 'tests/e2e/nvsentinel-event-exporter/**' |
| 49 | + - 'pkg/bundler/deployer/localformat/templates/**' |
| 50 | + # run.sh sources tools/common and is invoked through a make target. |
| 51 | + - 'tools/common' |
| 52 | + - 'Makefile' |
| 53 | + - '.github/workflows/nvsentinel-event-exporter-e2e.yaml' |
| 54 | + - '.github/actions/setup-build-tools/**' |
| 55 | + - '.github/actions/prep-kind-runner/**' |
| 56 | + - '.github/actions/load-versions/**' |
| 57 | + - '.settings.yaml' |
| 58 | + pull_request: |
| 59 | + branches: [main] |
| 60 | + paths: *paths |
| 61 | + workflow_dispatch: {} |
| 62 | + |
| 63 | +permissions: |
| 64 | + contents: read |
| 65 | + |
| 66 | +concurrency: |
| 67 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 68 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 69 | + |
| 70 | +jobs: |
| 71 | + test: |
| 72 | + name: NVSentinel Event Exporter E2E |
| 73 | + # mongod 8.0 before 8.0.35 exits at startup on the ubuntu-24.04 image's |
| 74 | + # 7.0 kernel (https://jira.mongodb.org/browse/SERVER-131779). Return to |
| 75 | + # ubuntu-24.04 once the Percona MongoDB pin is 8.0.35 or newer. |
| 76 | + runs-on: ubuntu-22.04 |
| 77 | + # The script's bounded waits sum to ~92 minutes worst case (node Ready 2, |
| 78 | + # mock 5, cert-manager 10, Percona datastore 15, nvsentinel rollout 15, |
| 79 | + # event pods 12, event delivery 12, filter settle 1, stop and restart 10, |
| 80 | + # proto fetch 1), before kind create, go build and the installs. A healthy |
| 81 | + # run takes a fraction of that. |
| 82 | + timeout-minutes: 110 |
| 83 | + steps: |
| 84 | + - name: Checkout Code |
| 85 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 86 | + with: |
| 87 | + persist-credentials: false |
| 88 | + |
| 89 | + - name: Load versions |
| 90 | + id: versions |
| 91 | + uses: ./.github/actions/load-versions |
| 92 | + |
| 93 | + - name: Prep Kind runner |
| 94 | + uses: ./.github/actions/prep-kind-runner |
| 95 | + |
| 96 | + - name: Set up Go |
| 97 | + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 |
| 98 | + with: |
| 99 | + go-version: ${{ steps.versions.outputs.go }} |
| 100 | + cache: false |
| 101 | + |
| 102 | + # run.sh's has_tools gate also needs jq and curl, which the runner image |
| 103 | + # already ships; installing only some of the rest fails the lane before |
| 104 | + # it exercises anything. |
| 105 | + - name: Install Kind, kubectl, Helm and yq |
| 106 | + uses: ./.github/actions/setup-build-tools |
| 107 | + with: |
| 108 | + install_kind: 'true' |
| 109 | + kind_version: '${{ steps.versions.outputs.kind }}' |
| 110 | + install_kubectl: 'true' |
| 111 | + kubectl_version: '${{ steps.versions.outputs.kubectl }}' |
| 112 | + install_helm: 'true' |
| 113 | + helm_version: '${{ steps.versions.outputs.helm }}' |
| 114 | + install_yq: 'true' |
| 115 | + yq_version: '${{ steps.versions.outputs.yq }}' |
| 116 | + |
| 117 | + # KEEP_CLUSTER so the cluster survives for the diagnostics below; the |
| 118 | + # script's own EXIT trap would otherwise delete it before they run. |
| 119 | + - name: Run nvsentinel-event-exporter e2e |
| 120 | + env: |
| 121 | + KEEP_CLUSTER: 'true' |
| 122 | + run: make nvsentinel-event-exporter-e2e |
| 123 | + |
| 124 | + # run.sh writes its kubeconfig inside a mktemp dir and removes that dir on |
| 125 | + # exit, so re-export before querying anything. cancelled() because a job |
| 126 | + # timeout cancels rather than fails. |
| 127 | + - name: Collect diagnostics on failure |
| 128 | + if: ${{ failure() || cancelled() }} |
| 129 | + run: | |
| 130 | + set +e |
| 131 | + cluster=aicr-nvsentinel-ee-e2e |
| 132 | + export KUBECONFIG="${RUNNER_TEMP}/ee-diag.kubeconfig" |
| 133 | + kind export kubeconfig --name "$cluster" --kubeconfig "$KUBECONFIG" || exit 0 |
| 134 | + kubectl get pods -A |
| 135 | + kubectl -n nvsentinel get events --sort-by=.lastTimestamp |
| 136 | + kubectl -n nvsentinel get pvc,statefulset,deployment,perconaservermongodb,certificate |
| 137 | + kubectl -n nvsentinel describe pods -l app.kubernetes.io/name=event-exporter |
| 138 | + kubectl -n nvsentinel logs deployment/event-exporter --tail=200 |
| 139 | + kubectl -n ee-mock logs deployment/ee-mock --tail=100 |
| 140 | + kubectl -n nvsentinel logs daemonset/platform-connectors --tail=200 |
| 141 | + kubectl -n nvsentinel logs statefulset/nvsentinel-mongodb-rs0 -c mongod --tail=100 |
| 142 | +
|
| 143 | + - name: Delete Kind cluster |
| 144 | + if: ${{ always() }} |
| 145 | + run: kind delete cluster --name aicr-nvsentinel-ee-e2e || true |
0 commit comments