Skip to content

Commit ebe88d9

Browse files
authored
Update manifest tests, their dependencies and GH workflows (#2000)
1 parent ff4ab89 commit ebe88d9

File tree

11 files changed

+87
-698
lines changed

11 files changed

+87
-698
lines changed

.github/workflows/check_examples.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- "1.0.11"
2222
- "1.1.9"
2323
- "1.2.9"
24-
- "1.3.6"
24+
- "1.3.8"
2525
env:
2626
TF_X_KUBERNETES_MANIFEST_RESOURCE: 1
2727
KUBE_CONFIG_PATH: "~/.kube/config"

.github/workflows/manifest_acc.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: kubernetes_manifest acceptance tests
1+
name: Manifest acceptance tests
2+
23
on:
34
push:
45
branches:
@@ -10,23 +11,30 @@ on:
1011
- main
1112
paths:
1213
- "manifest/**/*.go"
14+
workflow_dispatch:
15+
1316
jobs:
1417
acceptance_tests:
1518
runs-on: ubuntu-latest
1619
strategy:
20+
# Don't cancel all in-progress and queued jobs in the matrix if any job in the matrix fails.
21+
# That will be helpful to catch any issues related to a particular Kubernetes version.
22+
fail-fast: false
1723
matrix:
1824
kubernetes_version:
19-
# NOTE exact sha for image is required for kind
20-
- v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
21-
- v1.20.7@sha256:cbeaf907fc78ac97ce7b625e4bf0de16e3ea725daf6b04f930bd14c67c671ff9
22-
# FIXME this is disabled for now as there is a regression in v1.19.11
23-
# and there is no image available for the latest v1.19.x
24-
# - v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729
25+
# kind images: https://github.com/kubernetes-sigs/kind/releases
26+
- v1.25.3@sha256:f52781bc0d7a19fb6c405c2af83abfeb311f130707a0e219175677e366cc45d1
27+
- v1.24.7@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315
28+
- v1.23.13@sha256:ef453bb7c79f0e3caba88d2067d4196f427794086a7d0df8df4f019d5e336b61
2529
terraform_version:
26-
- 1.3.6
30+
- 1.3.8
2731
- 1.2.9
2832
- 1.1.9
2933
- 1.0.11
34+
# BONUS: Run tests on the latest available Kubernetes(1.X) and Terraform(1.X) versions.
35+
include:
36+
- kubernetes_version: v1.26.0@sha256:691e24bd2417609db7e589e1a479b902d2e209892a10ce375fab60a8407c7352
37+
terraform_version: 1.3.8
3038
steps:
3139
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
3240
- name: Set up Go
@@ -35,7 +43,7 @@ jobs:
3543
go-version-file: 'go.mod'
3644
- uses: engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 # v0.5.0
3745
with:
38-
version: v0.11.1
46+
version: v0.17.0
3947
image: kindest/node:${{ matrix.kubernetes_version }}
4048
- name: Build annotations webhook
4149
run: |

.github/workflows/manifest_unit.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
name: Unit tests
1+
name: Manifest unit tests
2+
23
on:
34
push:
45
branches:
5-
- master
66
- main
77
paths:
8-
- "**.go"
8+
- "manifest/**/*.go"
99
pull_request:
1010
branches:
11-
- master
11+
- main
1212
paths:
13-
- "**.go"
13+
- "manifest/**/*.go"
14+
workflow_dispatch:
15+
1416
jobs:
1517
unit_tests:
1618
runs-on: ubuntu-latest

manifest/test/acceptance/cronjob_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestKubernetesManifest_CronJob(t *testing.T) {
2929
defer func() {
3030
tf.Destroy(ctx)
3131
tf.Close()
32-
k8shelper.AssertNamespacedResourceDoesNotExist(t, "batch/v1beta1", "cronjobs", namespace, name)
32+
k8shelper.AssertNamespacedResourceDoesNotExist(t, "batch/v1", "cronjobs", namespace, name)
3333
}()
3434

3535
k8shelper.CreateNamespace(t, namespace)
@@ -44,7 +44,7 @@ func TestKubernetesManifest_CronJob(t *testing.T) {
4444
tf.Init(ctx)
4545
tf.Apply(ctx)
4646

47-
k8shelper.AssertNamespacedResourceExists(t, "batch/v1beta1", "cronjobs", namespace, name)
47+
k8shelper.AssertNamespacedResourceExists(t, "batch/v1", "cronjobs", namespace, name)
4848

4949
s, err := tf.State(ctx)
5050
if err != nil {

manifest/test/acceptance/hpa_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestKubernetesManifest_HPA(t *testing.T) {
3030
tf.Destroy(ctx)
3131
tf.Close()
3232
k8shelper.AssertNamespacedResourceDoesNotExist(t,
33-
"autoscaling/v2beta2", "horizontalpodautoscalers", namespace, name)
33+
"autoscaling/v2", "horizontalpodautoscalers", namespace, name)
3434
}()
3535

3636
k8shelper.CreateNamespace(t, namespace)
@@ -46,7 +46,7 @@ func TestKubernetesManifest_HPA(t *testing.T) {
4646
tf.Apply(ctx)
4747

4848
k8shelper.AssertNamespacedResourceExists(t,
49-
"autoscaling/v2beta2", "horizontalpodautoscalers", namespace, name)
49+
"autoscaling/v2", "horizontalpodautoscalers", namespace, name)
5050

5151
s, err := tf.State(ctx)
5252
if err != nil {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.17 AS builder
1+
FROM golang:1.19 AS builder
22
WORKDIR /src/k8s-manifest-hook
33
ADD *.go ./
44
ADD go.* ./
@@ -7,4 +7,4 @@ RUN CGO_ENABLED=0 go build
77
FROM alpine:latest
88
COPY --from=builder /src/k8s-manifest-hook/k8s-manifest-hook /k8s-manifest-hook
99
VOLUME /etc/webhook/certs
10-
ENTRYPOINT /k8s-manifest-hook
10+
ENTRYPOINT /k8s-manifest-hook
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
module github.com/hashicorp/k8s-manifest-hook
22

3-
go 1.17
3+
go 1.19
44

55
require (
6-
github.com/sirupsen/logrus v1.8.1
7-
github.com/slok/kubewebhook/v2 v2.1.0
8-
k8s.io/api v0.22.1
9-
k8s.io/apimachinery v0.22.1
6+
github.com/sirupsen/logrus v1.9.0
7+
github.com/slok/kubewebhook/v2 v2.5.0
8+
k8s.io/apimachinery v0.25.5
109
)
1110

1211
require (
13-
github.com/go-logr/logr v0.4.0 // indirect
12+
github.com/go-logr/logr v1.2.3 // indirect
1413
github.com/gogo/protobuf v1.3.2 // indirect
15-
github.com/google/go-cmp v0.5.5 // indirect
1614
github.com/google/gofuzz v1.1.0 // indirect
17-
github.com/json-iterator/go v1.1.11 // indirect
15+
github.com/json-iterator/go v1.1.12 // indirect
1816
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
19-
github.com/modern-go/reflect2 v1.0.1 // indirect
20-
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 // indirect
21-
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
22-
golang.org/x/text v0.3.6 // indirect
17+
github.com/modern-go/reflect2 v1.0.2 // indirect
18+
golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 // indirect
19+
golang.org/x/sys v0.3.0 // indirect
20+
golang.org/x/text v0.5.0 // indirect
2321
gomodules.xyz/jsonpatch/v3 v3.0.1 // indirect
2422
gomodules.xyz/orderedmap v0.1.0 // indirect
2523
gopkg.in/inf.v0 v0.9.1 // indirect
2624
gopkg.in/yaml.v2 v2.4.0 // indirect
27-
k8s.io/client-go v0.21.1 // indirect
28-
k8s.io/klog/v2 v2.9.0 // indirect
29-
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
25+
k8s.io/api v0.25.5 // indirect
26+
k8s.io/client-go v0.25.3 // indirect
27+
k8s.io/klog/v2 v2.70.1 // indirect
28+
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
29+
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
30+
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
3031
sigs.k8s.io/yaml v1.2.0 // indirect
3132
)

0 commit comments

Comments
 (0)