Skip to content

Commit

Permalink
Always spin up KinD cluster for pulumi-kubernetes-* providers in test…
Browse files Browse the repository at this point in the history
… step (#1235)

We need to create the KinD cluster in all workflows that run tests, not
just the `run-acceptance` workflow. For the pulumi-kubernetes provider,
we don't need to create a KinD cluster as we create a GKE cluster for
testing instead.

Closes:
pulumi/pulumi-kubernetes-cert-manager#254
  • Loading branch information
rquitales authored Dec 17, 2024
1 parent 342f2b5 commit 1243b9e
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ jobs:
with:
version: v2.5.0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup KinD cluster
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
cluster_name: kind-integration-tests-${{ matrix.language }}
node_image: kindest/node:v1.29.2
- name: Run tests
run: >-
set -euo pipefail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ jobs:
with:
version: v2.5.0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup KinD cluster
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
cluster_name: kind-integration-tests-${{ matrix.language }}
node_image: kindest/node:v1.29.2
- name: Run tests
run: >-
set -euo pipefail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ jobs:
with:
version: v2.5.0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup KinD cluster
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
cluster_name: kind-integration-tests-${{ matrix.language }}
node_image: kindest/node:v1.29.2
- name: Run tests
run: >-
set -euo pipefail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Test Provider Library
run: make test_provider
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- if: failure() && github.event_name == 'push'
Expand Down Expand Up @@ -339,6 +339,11 @@ jobs:
with:
version: v2.5.0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup KinD cluster
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
cluster_name: kind-integration-tests-${{ matrix.language }}
node_image: kindest/node:v1.29.2
- name: Run tests
run: >-
set -euo pipefail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
- name: Test Provider Library
run: make test_provider
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- if: failure() && github.event_name == 'push'
Expand Down Expand Up @@ -330,6 +330,11 @@ jobs:
with:
version: v2.5.0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup KinD cluster
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
cluster_name: kind-integration-tests-${{ matrix.language }}
node_image: kindest/node:v1.29.2
- name: Run tests
run: >-
set -euo pipefail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
- name: Test Provider Library
run: make test_provider
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- if: failure() && github.event_name == 'push'
Expand Down Expand Up @@ -330,6 +330,11 @@ jobs:
with:
version: v2.5.0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup KinD cluster
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
cluster_name: kind-integration-tests-${{ matrix.language }}
node_image: kindest/node:v1.29.2
- name: Run tests
run: >-
set -euo pipefail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
- name: Test Provider Library
run: make test_provider
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- if: failure() && github.event_name == 'push'
Expand Down
32 changes: 18 additions & 14 deletions native-provider-ci/src/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1270,20 +1270,24 @@ export function FreeDiskSpace(runner: string): Step {
}

export function CreateKindCluster(provider: string, name: string): Step {
if (
(provider === "kubernetes" ||
provider == "kubernetes-cert-manager" ||
provider == "kubernetes-ingress-nginx") &&
name === "run-acceptance-tests"
) {
return {
name: "Setup KinD cluster",
uses: action.createKindCluster,
with: {
cluster_name: "kind-integration-tests-${{ matrix.language }}",
node_image: "kindest/node:v1.29.2",
},
};
// Always create a KinD cluster for any jobs in "kubernetes-*" providers.
// For the "kubernetes" provider, create a KinD cluster only for the "run-acceptance-tests" job,
// as other jobs will use GKE clusters for testing.
const step = {
name: "Setup KinD cluster",
uses: action.createKindCluster,
with: {
cluster_name: "kind-integration-tests-${{ matrix.language }}",
node_image: "kindest/node:v1.29.2",
},
};

switch (provider) {
case "kubernetes":
return name === "run-acceptance-tests" ? step : {};
case "kubernetes-cert-manager":
case "kubernetes-ingress-nginx":
return step;
}

return {};
Expand Down

0 comments on commit 1243b9e

Please sign in to comment.