Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 5a23c78

Browse files
authored
Bump dependencies (#3)
1 parent 3ae080e commit 5a23c78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1039
-493
lines changed

.github/workflows/docker-publish.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,27 @@ jobs:
2828

2929
steps:
3030
- name: Checkout repository
31-
uses: actions/checkout@v3
31+
uses: actions/checkout@v4
3232

3333
# Install the cosign tool except on PR
3434
# https://github.com/sigstore/cosign-installer
3535
- name: Install cosign
3636
if: github.event_name != 'pull_request'
37-
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
37+
uses: sigstore/cosign-installer@v3.5.0
3838
with:
39-
cosign-release: 'v2.1.1'
39+
cosign-release: 'v2.2.4'
4040

4141
# Set up BuildKit Docker container builder to be able to build
4242
# multi-platform images and export cache
4343
# https://github.com/docker/setup-buildx-action
4444
- name: Set up Docker Buildx
45-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
45+
uses: docker/setup-buildx-action@v3.3.0
4646

4747
# Login against a Docker registry except on PR
4848
# https://github.com/docker/login-action
4949
- name: Log into registry ${{ env.REGISTRY }}
5050
if: github.event_name != 'pull_request'
51-
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
51+
uses: docker/login-action@v3.1.0
5252
with:
5353
registry: ${{ env.REGISTRY }}
5454
username: ${{ github.actor }}
@@ -58,15 +58,15 @@ jobs:
5858
# https://github.com/docker/metadata-action
5959
- name: Extract Docker metadata
6060
id: meta
61-
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
61+
uses: docker/metadata-action@v5.5.1
6262
with:
6363
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
6464

6565
# Build and push Docker image with Buildx (don't push on PR)
6666
# https://github.com/docker/build-push-action
6767
- name: Build and push Docker image
6868
id: build-and-push
69-
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
69+
uses: docker/build-push-action@v5.3.0
7070
with:
7171
context: .
7272
push: ${{ github.event_name != 'pull_request' }}

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Binaries for programs and plugins
32
*.exe
43
*.exe~
@@ -8,14 +7,16 @@
87
bin/*
98
Dockerfile.cross
109

11-
# Test binary, build with `go test -c`
10+
# Test binary, built with `go test -c`
1211
*.test
1312

1413
# Output of the go coverage tool, specifically when used with LiteIDE
1514
*.out
1615

17-
# Kubernetes Generated files - skip generated files, except for vendored files
16+
# Go workspace file
17+
go.work
1818

19+
# Kubernetes Generated files - skip generated files, except for vendored files
1920
!vendor/**/zz_generated.*
2021

2122
# editor and IDE paraphernalia

.golangci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
run:
2+
deadline: 5m
3+
allow-parallel-runners: true
4+
5+
issues:
6+
# don't skip warning about doc comments
7+
# don't exclude the default set of lint
8+
exclude-use-default: false
9+
# restore some of the defaults
10+
# (fill in the rest as needed)
11+
exclude-rules:
12+
- path: "api/*"
13+
linters:
14+
- lll
15+
- path: "internal/*"
16+
linters:
17+
- dupl
18+
- lll
19+
linters:
20+
disable-all: true
21+
enable:
22+
- dupl
23+
- errcheck
24+
- exportloopref
25+
- goconst
26+
- gocyclo
27+
- gofmt
28+
- goimports
29+
- gosimple
30+
- govet
31+
- ineffassign
32+
- lll
33+
- misspell
34+
- nakedret
35+
- prealloc
36+
- staticcheck
37+
- typecheck
38+
- unconvert
39+
- unparam
40+
- unused

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.20 as builder
2+
FROM golang:1.22 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

Makefile

Lines changed: 66 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
21
# Image URL to use all building/pushing image targets
32
IMG ?= controller:latest
43
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5-
ENVTEST_K8S_VERSION = 1.27.1
4+
ENVTEST_K8S_VERSION = 1.29.0
65

76
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
87
ifeq (,$(shell go env GOBIN))
@@ -29,7 +28,7 @@ all: build
2928

3029
# The help target prints out all targets with their descriptions organized
3130
# beneath their categories. The categories are represented by '##@' and the
32-
# target descriptions by '##'. The awk commands is responsible for reading the
31+
# target descriptions by '##'. The awk command is responsible for reading the
3332
# entire set of makefiles included in this invocation, looking for lines of the
3433
# file as xyz: ## something, and then pretty-format the target and help. Then,
3534
# if there's a line with ##@ something, that gets pretty-printed as a category.
@@ -62,7 +61,20 @@ vet: ## Run go vet against code.
6261

6362
.PHONY: test
6463
test: manifests generate fmt vet envtest ## Run tests.
65-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
64+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
65+
66+
# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
67+
.PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
68+
test-e2e:
69+
go test ./test/e2e/ -v -ginkgo.v
70+
71+
.PHONY: lint
72+
lint: golangci-lint ## Run golangci-lint linter & yamllint
73+
$(GOLANGCI_LINT) run
74+
75+
.PHONY: lint-fix
76+
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
77+
$(GOLANGCI_LINT) run --fix
6678

6779
##@ Build
6880

@@ -74,26 +86,26 @@ build: manifests generate fmt vet ## Build manager binary.
7486
run: manifests generate fmt vet ## Run a controller from your host.
7587
go run ./cmd/main.go
7688

77-
# If you wish built the manager image targeting other platforms you can use the --platform flag.
78-
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
89+
# If you wish to build the manager image targeting other platforms you can use the --platform flag.
90+
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
7991
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
8092
.PHONY: docker-build
81-
docker-build: test ## Build docker image with the manager.
93+
docker-build: ## Build docker image with the manager.
8294
$(CONTAINER_TOOL) build -t ${IMG} .
8395

8496
.PHONY: docker-push
8597
docker-push: ## Push docker image with the manager.
8698
$(CONTAINER_TOOL) push ${IMG}
8799

88-
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
100+
# PLATFORMS defines the target platforms for the manager image be built to provide support to multiple
89101
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
90-
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
91-
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
92-
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
93-
# To properly provided solutions that supports more than one platform you should use this option.
102+
# - be able to use docker buildx. More info: https://docs.docker.com/build/buildx/
103+
# - have enabled BuildKit. More info: https://docs.docker.com/develop/develop-images/build_enhancements/
104+
# - be able to push the image to your registry (i.e. if you do not set a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
105+
# To adequately provide solutions that are compatible with multiple platforms, you should consider using this option.
94106
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
95107
.PHONY: docker-buildx
96-
docker-buildx: test ## Build and push docker image for the manager for cross-platform support
108+
docker-buildx: ## Build and push docker image for the manager for cross-platform support
97109
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
98110
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
99111
- $(CONTAINER_TOOL) buildx create --name project-v3-builder
@@ -102,6 +114,12 @@ docker-buildx: test ## Build and push docker image for the manager for cross-pla
102114
- $(CONTAINER_TOOL) buildx rm project-v3-builder
103115
rm Dockerfile.cross
104116

117+
.PHONY: build-installer
118+
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
119+
mkdir -p dist
120+
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
121+
$(KUSTOMIZE) build config/default > dist/install.yaml
122+
105123
##@ Deployment
106124

107125
ifndef ignore-not-found
@@ -122,10 +140,10 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
122140
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
123141

124142
.PHONY: undeploy
125-
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
143+
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
126144
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
127145

128-
##@ Build Dependencies
146+
##@ Dependencies
129147

130148
## Location to install dependencies to
131149
LOCALBIN ?= $(shell pwd)/bin
@@ -134,30 +152,47 @@ $(LOCALBIN):
134152

135153
## Tool Binaries
136154
KUBECTL ?= kubectl
137-
KUSTOMIZE ?= $(LOCALBIN)/kustomize
138-
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
139-
ENVTEST ?= $(LOCALBIN)/setup-envtest
155+
KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
156+
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
157+
ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
158+
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
140159

141160
## Tool Versions
142-
KUSTOMIZE_VERSION ?= v5.0.1
143-
CONTROLLER_TOOLS_VERSION ?= v0.12.0
161+
KUSTOMIZE_VERSION ?= v5.3.0
162+
CONTROLLER_TOOLS_VERSION ?= v0.14.0
163+
ENVTEST_VERSION ?= release-0.17
164+
GOLANGCI_LINT_VERSION ?= v1.54.2
144165

145166
.PHONY: kustomize
146-
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
167+
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
147168
$(KUSTOMIZE): $(LOCALBIN)
148-
@if test -x $(LOCALBIN)/kustomize && ! $(LOCALBIN)/kustomize version | grep -q $(KUSTOMIZE_VERSION); then \
149-
echo "$(LOCALBIN)/kustomize version is not expected $(KUSTOMIZE_VERSION). Removing it before installing."; \
150-
rm -rf $(LOCALBIN)/kustomize; \
151-
fi
152-
test -s $(LOCALBIN)/kustomize || GOBIN=$(LOCALBIN) GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/v5@$(KUSTOMIZE_VERSION)
169+
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))
153170

154171
.PHONY: controller-gen
155-
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
172+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
156173
$(CONTROLLER_GEN): $(LOCALBIN)
157-
test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
158-
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
174+
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
159175

160176
.PHONY: envtest
161-
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
177+
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
162178
$(ENVTEST): $(LOCALBIN)
163-
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
179+
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))
180+
181+
.PHONY: golangci-lint
182+
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
183+
$(GOLANGCI_LINT): $(LOCALBIN)
184+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
185+
186+
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
187+
# $1 - target path with name of binary (ideally with version)
188+
# $2 - package url which can be installed
189+
# $3 - specific version of package
190+
define go-install-tool
191+
@[ -f $(1) ] || { \
192+
set -e; \
193+
package=$(2)@$(3) ;\
194+
echo "Downloading $${package}" ;\
195+
GOBIN=$(LOCALBIN) go install $${package} ;\
196+
mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\
197+
}
198+
endef

0 commit comments

Comments
 (0)