Skip to content

Commit 6280108

Browse files
committed
chore: update operator-sdk scaffold to v1.41.1
1 parent fa1c67e commit 6280108

File tree

8 files changed

+34
-23
lines changed

8 files changed

+34
-23
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Kubebuilder DevContainer",
3-
"image": "docker.io/golang:1.23",
3+
"image": "docker.io/golang:1.24",
44
"features": {
55
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
66
"ghcr.io/devcontainers/features/git:1": {}

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ linters:
2525
revive:
2626
rules:
2727
- name: comment-spacings
28+
- name: import-shadowing
2829
exclusions:
2930
generated: lax
3031
rules:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.22 AS builder
2+
FROM golang:1.24 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

Makefile

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,31 @@ vet: ## Run go vet against code.
128128
test: manifests generate fmt vet setup-envtest ## Run tests.
129129
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
130130

131+
KIND_CLUSTER ?= github-token-manager-test-e2e
132+
133+
.PHONY: setup-test-e2e
134+
setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
135+
@command -v $(KIND) >/dev/null 2>&1 || { \
136+
echo "Kind is not installed. Please install Kind manually."; \
137+
exit 1; \
138+
}
139+
@case "$$($(KIND) get clusters)" in \
140+
*"$(KIND_CLUSTER)"*) \
141+
echo "Kind cluster '$(KIND_CLUSTER)' already exists. Skipping creation." ;; \
142+
*) \
143+
echo "Creating Kind cluster '$(KIND_CLUSTER)'..."; \
144+
$(KIND) create cluster --name $(KIND_CLUSTER) ;; \
145+
esac
146+
147+
.PHONY: cleanup-test-e2e
148+
cleanup-test-e2e:
149+
$(KIND) delete cluster --name $(KIND_CLUSTER)
150+
131151
# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
132-
.PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
133-
test-e2e:
134-
go test ./test/e2e/ -v -ginkgo.v
152+
.PHONY: test-e2e
153+
test-e2e: setup-test-e2e manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
154+
KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v
155+
$(MAKE) cleanup-test-e2e
135156

136157
.PHONY: lint
137158
lint: golangci-lint ## Run golangci-lint linter
@@ -227,16 +248,17 @@ $(LOCALBIN):
227248

228249
## Tool Binaries
229250
KUBECTL ?= kubectl
251+
KIND ?= kind
230252
KUSTOMIZE ?= $(LOCALBIN)/kustomize
231253
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
232254
ENVTEST ?= $(LOCALBIN)/setup-envtest
233255
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
234256

235257
## Tool Versions
236258
KUSTOMIZE_VERSION ?= v5.5.0
237-
CONTROLLER_TOOLS_VERSION ?= v0.16.4
259+
CONTROLLER_TOOLS_VERSION ?= v0.18.0
238260
ENVTEST_VERSION := $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
239-
GOLANGCI_LINT_VERSION ?= v1.59.1
261+
GOLANGCI_LINT_VERSION ?= v2.1.0
240262

241263
.PHONY: kustomize
242264
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -264,7 +286,7 @@ $(ENVTEST): $(LOCALBIN)
264286
.PHONY: golangci-lint
265287
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
266288
$(GOLANGCI_LINT): $(LOCALBIN)
267-
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
289+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
268290

269291
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
270292
# $1 - target path with name of binary

config/crd/bases/github.as-code.io_clustertokens.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.16.4
6+
controller-gen.kubebuilder.io/version: v0.18.0
77
name: clustertokens.github.as-code.io
88
spec:
99
group: github.as-code.io

config/crd/bases/github.as-code.io_tokens.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.16.4
6+
controller-gen.kubebuilder.io/version: v0.18.0
77
name: tokens.github.as-code.io
88
spec:
99
group: github.as-code.io

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/isometry/github-token-manager
22

33
go 1.24.0
44

5-
toolchain go1.24.2
5+
toolchain go1.24.5
66

77
require (
88
github.com/go-logr/logr v1.4.3

test/e2e/e2e_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,12 @@ const namespace = "github-token-manager-system"
3131

3232
var _ = Describe("controller", Ordered, func() {
3333
BeforeAll(func() {
34-
By("installing prometheus operator")
35-
Expect(utils.InstallPrometheusOperator()).To(Succeed())
36-
37-
By("installing the cert-manager")
38-
Expect(utils.InstallCertManager()).To(Succeed())
39-
4034
By("creating manager namespace")
4135
cmd := exec.Command("kubectl", "create", "ns", namespace)
4236
_, _ = utils.Run(cmd)
4337
})
4438

4539
AfterAll(func() {
46-
By("uninstalling the Prometheus manager bundle")
47-
utils.UninstallPrometheusOperator()
48-
49-
By("uninstalling the cert-manager bundle")
50-
utils.UninstallCertManager()
51-
5240
By("removing manager namespace")
5341
cmd := exec.Command("kubectl", "delete", "ns", namespace)
5442
_, _ = utils.Run(cmd)

0 commit comments

Comments
 (0)