From 92f5a754831af6290b8a4b3ecd58327af1feba5a Mon Sep 17 00:00:00 2001 From: Matteo Ruina Date: Sat, 25 Nov 2023 13:34:02 +0100 Subject: [PATCH 1/6] Update to go v1.21 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 95a646c..4e6633d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Skyscanner/kms-issuer/v4 -go 1.17 +go 1.21 require ( github.com/aws/aws-sdk-go-v2/credentials v1.12.15 diff --git a/go.sum b/go.sum index 3b013b4..691067b 100644 --- a/go.sum +++ b/go.sum @@ -526,6 +526,7 @@ github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY= +github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= @@ -688,6 +689,7 @@ go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= From 254860c64c34ce1df1e4cf51dd5186b10c834f75 Mon Sep 17 00:00:00 2001 From: Matteo Ruina Date: Sat, 25 Nov 2023 13:34:27 +0100 Subject: [PATCH 2/6] Update to controller-gen v0.13.0 --- Makefile | 4 ++-- apis/certmanager/v1alpha1/zz_generated.deepcopy.go | 1 - .../crds/cert-manager.skyscanner.net_kmsissuers.yaml | 9 +-------- .../crds/cert-manager.skyscanner.net_kmskeys.yaml | 9 +-------- .../bases/cert-manager.skyscanner.net_kmsissuers.yaml | 9 +-------- .../crd/bases/cert-manager.skyscanner.net_kmskeys.yaml | 9 +-------- config/rbac/role.yaml | 1 - 7 files changed, 6 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index 165827a..d73d23f 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Image URL to use all building/pushing image targets IMG ?= skyscanner/kms-issuer:dev # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -ENVTEST_K8S_VERSION = 1.23 +ENVTEST_K8S_VERSION = 1.28 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -115,7 +115,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest ## Tool Versions KUSTOMIZE_VERSION ?= v3.8.7 -CONTROLLER_TOOLS_VERSION ?= v0.8.0 +CONTROLLER_TOOLS_VERSION ?= v0.13.0 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" .PHONY: kustomize diff --git a/apis/certmanager/v1alpha1/zz_generated.deepcopy.go b/apis/certmanager/v1alpha1/zz_generated.deepcopy.go index d27ce25..c630019 100644 --- a/apis/certmanager/v1alpha1/zz_generated.deepcopy.go +++ b/apis/certmanager/v1alpha1/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated /* Copyright 2021. diff --git a/charts/kms-issuer/crds/cert-manager.skyscanner.net_kmsissuers.yaml b/charts/kms-issuer/crds/cert-manager.skyscanner.net_kmsissuers.yaml index ab271bb..7db5303 100644 --- a/charts/kms-issuer/crds/cert-manager.skyscanner.net_kmsissuers.yaml +++ b/charts/kms-issuer/crds/cert-manager.skyscanner.net_kmsissuers.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.13.0 name: kmsissuers.cert-manager.skyscanner.net spec: group: cert-manager.skyscanner.net @@ -112,9 +111,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/charts/kms-issuer/crds/cert-manager.skyscanner.net_kmskeys.yaml b/charts/kms-issuer/crds/cert-manager.skyscanner.net_kmskeys.yaml index 6141f25..38a7168 100644 --- a/charts/kms-issuer/crds/cert-manager.skyscanner.net_kmskeys.yaml +++ b/charts/kms-issuer/crds/cert-manager.skyscanner.net_kmskeys.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.13.0 name: kmskeys.cert-manager.skyscanner.net spec: group: cert-manager.skyscanner.net @@ -122,9 +121,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/cert-manager.skyscanner.net_kmsissuers.yaml b/config/crd/bases/cert-manager.skyscanner.net_kmsissuers.yaml index ab271bb..7db5303 100644 --- a/config/crd/bases/cert-manager.skyscanner.net_kmsissuers.yaml +++ b/config/crd/bases/cert-manager.skyscanner.net_kmsissuers.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.13.0 name: kmsissuers.cert-manager.skyscanner.net spec: group: cert-manager.skyscanner.net @@ -112,9 +111,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/cert-manager.skyscanner.net_kmskeys.yaml b/config/crd/bases/cert-manager.skyscanner.net_kmskeys.yaml index 6141f25..38a7168 100644 --- a/config/crd/bases/cert-manager.skyscanner.net_kmskeys.yaml +++ b/config/crd/bases/cert-manager.skyscanner.net_kmskeys.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.13.0 name: kmskeys.cert-manager.skyscanner.net spec: group: cert-manager.skyscanner.net @@ -122,9 +121,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 63cc6b4..2301a74 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -2,7 +2,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - creationTimestamp: null name: manager-role rules: - apiGroups: From 990ab6037bd4728acefd49fd2f26fad7b139c76e Mon Sep 17 00:00:00 2001 From: Matteo Ruina Date: Sat, 25 Nov 2023 13:38:41 +0100 Subject: [PATCH 3/6] Update actions to go v1.21 --- .github/workflows/code-quality.yml | 2 +- .github/workflows/e2e.yaml | 4 ++-- .github/workflows/helm.yml | 4 ++-- .github/workflows/test-build.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 89b4768..0c56347 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: ^1.17 + go-version: ^1.21 - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 5e7a1cc..ffc6b33 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest env: IMG: skyscanner/kms-issuer:dev - CERT_MANAGER_VERSION: v1.8.0 + CERT_MANAGER_VERSION: v1.13.2 steps: - uses: actions/checkout@v3.1.0 @@ -77,7 +77,7 @@ jobs: - name: Apply Certificate from sample run: kubectl apply -f ./config/samples/certificate.yaml - - name: Wait for Certificate to be ready + - name: Wait for Certificate to be ready run: kubectl wait --for=condition=Ready certificate.cert-manager.io/example-com - name: Delete certificate diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml index 1cf0133..04400c7 100644 --- a/.github/workflows/helm.yml +++ b/.github/workflows/helm.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest env: IMG: skyscanner/kms-issuer:dev - CERT_MANAGER_VERSION: v1.8.0 + CERT_MANAGER_VERSION: v1.13.2 steps: - name: Checkout @@ -23,7 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: 1.17 + go-version: ^1.21 - name: Set up Helm uses: azure/setup-helm@v3.5 diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index c2c77f1..4a0d99b 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/setup-go@v2 with: - go-version: ^1.17 + go-version: ^1.21 - name: Test run: make test From 81b6ca8ff2b4b341e624188d11d6b642b4ec8293 Mon Sep 17 00:00:00 2001 From: Matteo Ruina Date: Sat, 25 Nov 2023 13:38:57 +0100 Subject: [PATCH 4/6] Update Dockerfile to go v1.21 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e197d6d..08e4ff2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.17 as builder +FROM golang:1.21 as builder ARG TARGETARCH WORKDIR /workspace From aa4e72bacbaff2ea23ad28b9b20747d698d00ae6 Mon Sep 17 00:00:00 2001 From: Matteo Ruina Date: Mon, 11 Dec 2023 21:51:02 +0100 Subject: [PATCH 5/6] Bump golanci-lint --- .github/workflows/code-quality.yml | 5 +++-- .golangci.yml | 1 - charts/kms-issuer/Chart.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 0c56347..24386ea 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -26,9 +26,10 @@ jobs: languages: go - name: golangci-lint - uses: golangci/golangci-lint-action@v3.4.0 + uses: golangci/golangci-lint-action@v3.7.0 with: - version: latest + version: v1.55.2 + args: --timeout=5m - name: Build run: make build diff --git a/.golangci.yml b/.golangci.yml index 6bf03c3..8d907d4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -50,7 +50,6 @@ linters: disable-all: true enable: - bodyclose - - depguard - dogsled - dupl - errcheck diff --git a/charts/kms-issuer/Chart.yaml b/charts/kms-issuer/Chart.yaml index 27c3fae..db3c6d2 100644 --- a/charts/kms-issuer/Chart.yaml +++ b/charts/kms-issuer/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.2 +version: 1.0.3 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to From cb5d4d53e3f3fa7a808277e1f75b743262df5166 Mon Sep 17 00:00:00 2001 From: Matteo Ruina Date: Sun, 17 Dec 2023 15:13:56 +0100 Subject: [PATCH 6/6] Fix dot import --- pkg/kmsca/suite_test.go | 16 ++++++++-------- pkg/kmsmock/suite_test.go | 16 ++++++++-------- pkg/signer/suite_test.go | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pkg/kmsca/suite_test.go b/pkg/kmsca/suite_test.go index d0a9360..dc555bf 100644 --- a/pkg/kmsca/suite_test.go +++ b/pkg/kmsca/suite_test.go @@ -19,8 +19,8 @@ package kmsca import ( "testing" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" + "github.com/onsi/ginkgo" + "github.com/onsi/gomega" "sigs.k8s.io/controller-runtime/pkg/envtest/printer" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" @@ -30,17 +30,17 @@ import ( // http://onsi.github.io/ginkgo/ to learn more about Ginkgo. func TestAPIs(t *testing.T) { - RegisterFailHandler(Fail) + gomega.RegisterFailHandler(ginkgo.Fail) - RunSpecsWithDefaultAndCustomReporters(t, + ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Controller Suite", - []Reporter{printer.NewlineReporter{}}) + []ginkgo.Reporter{printer.NewlineReporter{}}) } -var _ = BeforeSuite(func(done Done) { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter))) +var _ = ginkgo.BeforeSuite(func(done ginkgo.Done) { + logf.SetLogger(zap.New(zap.WriteTo(ginkgo.GinkgoWriter))) close(done) }, 60) -var _ = AfterSuite(func() { +var _ = ginkgo.AfterSuite(func() { }) diff --git a/pkg/kmsmock/suite_test.go b/pkg/kmsmock/suite_test.go index 0e2776a..1301bb5 100644 --- a/pkg/kmsmock/suite_test.go +++ b/pkg/kmsmock/suite_test.go @@ -19,8 +19,8 @@ package kmsmock import ( "testing" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" + "github.com/onsi/ginkgo" + "github.com/onsi/gomega" "sigs.k8s.io/controller-runtime/pkg/envtest/printer" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" @@ -30,17 +30,17 @@ import ( // http://onsi.github.io/ginkgo/ to learn more about Ginkgo. func TestAPIs(t *testing.T) { - RegisterFailHandler(Fail) + gomega.RegisterFailHandler(ginkgo.Fail) - RunSpecsWithDefaultAndCustomReporters(t, + ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Controller Suite", - []Reporter{printer.NewlineReporter{}}) + []ginkgo.Reporter{printer.NewlineReporter{}}) } -var _ = BeforeSuite(func(done Done) { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter))) +var _ = ginkgo.BeforeSuite(func(done ginkgo.Done) { + logf.SetLogger(zap.New(zap.WriteTo(ginkgo.GinkgoWriter))) close(done) }, 60) -var _ = AfterSuite(func() { +var _ = ginkgo.AfterSuite(func() { }) diff --git a/pkg/signer/suite_test.go b/pkg/signer/suite_test.go index 4f6cdc2..d71c502 100644 --- a/pkg/signer/suite_test.go +++ b/pkg/signer/suite_test.go @@ -19,8 +19,8 @@ package signer import ( "testing" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" + "github.com/onsi/ginkgo" + "github.com/onsi/gomega" "sigs.k8s.io/controller-runtime/pkg/envtest/printer" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" @@ -30,17 +30,17 @@ import ( // http://onsi.github.io/ginkgo/ to learn more about Ginkgo. func TestAPIs(t *testing.T) { - RegisterFailHandler(Fail) + gomega.RegisterFailHandler(ginkgo.Fail) - RunSpecsWithDefaultAndCustomReporters(t, + ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Controller Suite", - []Reporter{printer.NewlineReporter{}}) + []ginkgo.Reporter{printer.NewlineReporter{}}) } -var _ = BeforeSuite(func(done Done) { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter))) +var _ = ginkgo.BeforeSuite(func(done ginkgo.Done) { + logf.SetLogger(zap.New(zap.WriteTo(ginkgo.GinkgoWriter))) close(done) }, 60) -var _ = AfterSuite(func() { +var _ = ginkgo.AfterSuite(func() { })