Add support for pre-created Kubernetes secrets in Helm chart #207
Workflow file for this run
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
| name: Integration and E2E over minikube (Internal Contribution) | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - renovate/** | |
| permissions: | |
| contents: read | |
| jobs: | |
| integration-e2e-test: | |
| name: Run Integration and E2E tests (Internal Contribution) | |
| # Do not run e2e tests if PR is from a forked repo (external contribution) | |
| if: ${{ github.event.pull_request.head.repo.full_name == 'newrelic/newrelic-k8s-metrics-adapter' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| k8sVersion: ["v1.32.0", "v1.31.0", "v1.30.0", "v1.29.5", "v1.28.3"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Kind action | |
| uses: helm/kind-action@v1.13.0 | |
| with: | |
| kubectl_version: ${{ matrix.k8sVersion }} | |
| - name: Create k8s Kind Cluster | |
| run: make kind-up | |
| - name: Run unit tests | |
| run: make test | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| with: | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Run integration tests | |
| env: | |
| NEWRELIC_API_KEY: "${{ secrets.K8S_AGENTS_E2E_API_KEY }}" | |
| NEWRELIC_ACCOUNT_ID: "${{ secrets.K8S_AGENTS_E2E_ACCOUNT_ID }}" | |
| run: make test-integration | |
| - name: Build Docker image | |
| run: make image-push IMAGE_REPO=localhost:5000/newrelic-k8s-metrics-adapter | |
| - name: Add newrelic repository | |
| run: helm repo add newrelic https://helm-charts.newrelic.com | |
| - name: Create Helm release | |
| env: | |
| KUBECONFIG: ./kubeconfig # Generated by `make kind-up` | |
| NEWRELIC_API_KEY: "${{ secrets.K8S_AGENTS_E2E_API_KEY }}" | |
| NEWRELIC_ACCOUNT_ID: "${{ secrets.K8S_AGENTS_E2E_ACCOUNT_ID }}" | |
| run: | | |
| make generate-local-values | |
| helm dependency build ./charts/newrelic-k8s-metrics-adapter | |
| helm install newrelic-k8s-metrics-adapter ./charts/newrelic-k8s-metrics-adapter \ | |
| --set image.registry=localhost:5000 \ | |
| --set image.repository=newrelic-k8s-metrics-adapter \ | |
| --set image.pullPolicy=IfNotPresent \ | |
| --values values-dev.yaml --values values-local.yaml \ | |
| --wait --timeout 240s | |
| - name: Confirm external.metrics.k8s.io API implementation details | |
| env: | |
| ENDPOINT: '/apis/external.metrics.k8s.io/v1beta1/namespaces/*/e2e/' | |
| KUBECONFIG: ./kubeconfig # Generated by `make kind-up` | |
| run: | | |
| sleep 30 | |
| KIND=$(kubectl get --raw "${ENDPOINT}" | jq '.kind') | |
| API_VERSION=$(kubectl get --raw "${ENDPOINT}" | jq '.apiVersion') | |
| METRIC_NAME=$(kubectl get --raw "${ENDPOINT}" | jq '.items[0].metricName') | |
| VALUE=$(kubectl get --raw "${ENDPOINT}" | jq '.items[0].value') | |
| if [[ ${KIND} != '"ExternalMetricValueList"' ]]; then | |
| echo "KIND: found '${KIND}' != expected '\"ExternalMetricValueList\"'" | |
| exit 1 | |
| fi | |
| if [[ ${API_VERSION} != '"external.metrics.k8s.io/v1beta1"' ]]; then | |
| echo "API_VERSION: found '${API_VERSION}' != expected '\"external.metrics.k8s.io/v1beta1\"'" | |
| exit 1 | |
| fi | |
| if [[ ${METRIC_NAME} != '"e2e"' ]]; then | |
| echo "METRIC_NAME: found '${METRIC_NAME}' != expected '\"e2e\"'" | |
| exit 1 | |
| fi | |
| if [[ ${VALUE} != '"123m"' ]]; then | |
| echo "VALUE: found '${VALUE}' != expected '\"123m\"'" | |
| exit 1 | |
| fi | |
| - name: Run E2E tests | |
| run: make test-e2e |