Skip to content

Commit 50b452b

Browse files
Update operator SDK version v1.38.0 -> v1.42.2
* Get rid of kube-rbac-proxy container
1 parent 84e0ab7 commit 50b452b

57 files changed

Lines changed: 1344 additions & 838 deletions

Some content is hidden

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

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: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# To re-generate a bundle for another specific version without changing the standard setup, you can:
44
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
55
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
6-
VERSION ?= 1.0.0
6+
VERSION ?= 1.0.1
77

88
# CHANNELS define the bundle channels used in the bundle.
99
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
@@ -28,8 +28,8 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
2828
# This variable is used to construct full image tags for bundle and catalog images.
2929
#
3030
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
31-
# aureumcloud/frp-operator-bundle:$VERSION and aureumcloud/frp-operator-catalog:$VERSION.
32-
IMAGE_TAG_BASE ?= aureumcloud/frp-operator
31+
# aureum.cloud/frp-operator-bundle:$VERSION and aureum.cloud/frp-operator-catalog:$VERSION.
32+
IMAGE_TAG_BASE ?= aureum.cloud/frp-operator
3333

3434
# BUNDLE_IMG defines the image:tag used for the bundle.
3535
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
@@ -48,11 +48,9 @@ endif
4848

4949
# Set the Operator SDK version to use. By default, what is installed on the system is used.
5050
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
51-
OPERATOR_SDK_VERSION ?= v1.38.0
51+
OPERATOR_SDK_VERSION ?= v1.42.2
5252
# Image URL to use all building/pushing image targets
5353
IMG ?= controller:latest
54-
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
55-
ENVTEST_K8S_VERSION = 1.30.0
5654

5755
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
5856
ifeq (,$(shell go env GOBIN))
@@ -111,13 +109,37 @@ vet: ## Run go vet against code.
111109
go vet ./...
112110

113111
.PHONY: test
114-
test: manifests generate fmt vet envtest ## Run tests.
112+
test: manifests generate fmt vet setup-envtest ## Run tests.
115113
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
116114

117-
# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
118-
.PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
119-
test-e2e:
120-
go test ./test/e2e/ -v -ginkgo.v
115+
# TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'.
116+
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
117+
# CertManager is installed by default; skip with:
118+
# - CERT_MANAGER_INSTALL_SKIP=true
119+
KIND_CLUSTER ?= frp-operator-test-e2e
120+
121+
.PHONY: setup-test-e2e
122+
setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
123+
@command -v $(KIND) >/dev/null 2>&1 || { \
124+
echo "Kind is not installed. Please install Kind manually."; \
125+
exit 1; \
126+
}
127+
@case "$$($(KIND) get clusters)" in \
128+
*"$(KIND_CLUSTER)"*) \
129+
echo "Kind cluster '$(KIND_CLUSTER)' already exists. Skipping creation." ;; \
130+
*) \
131+
echo "Creating Kind cluster '$(KIND_CLUSTER)'..."; \
132+
$(KIND) create cluster --name $(KIND_CLUSTER) ;; \
133+
esac
134+
135+
.PHONY: test-e2e
136+
test-e2e: setup-test-e2e manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
137+
KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v
138+
$(MAKE) cleanup-test-e2e
139+
140+
.PHONY: cleanup-test-e2e
141+
cleanup-test-e2e: ## Tear down the Kind cluster used for e2e tests
142+
@$(KIND) delete cluster --name $(KIND_CLUSTER)
121143

122144
.PHONY: lint
123145
lint: golangci-lint ## Run golangci-lint linter
@@ -127,6 +149,10 @@ lint: golangci-lint ## Run golangci-lint linter
127149
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
128150
$(GOLANGCI_LINT) run --fix
129151

152+
.PHONY: lint-config
153+
lint-config: golangci-lint ## Verify golangci-lint linter configuration
154+
$(GOLANGCI_LINT) config verify
155+
130156
##@ Build
131157

132158
.PHONY: build
@@ -203,16 +229,20 @@ $(LOCALBIN):
203229

204230
## Tool Binaries
205231
KUBECTL ?= kubectl
232+
KIND ?= kind
206233
KUSTOMIZE ?= $(LOCALBIN)/kustomize
207234
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
208235
ENVTEST ?= $(LOCALBIN)/setup-envtest
209236
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
210237

211238
## Tool Versions
212-
KUSTOMIZE_VERSION ?= v5.4.2
213-
CONTROLLER_TOOLS_VERSION ?= v0.15.0
214-
ENVTEST_VERSION ?= release-0.18
215-
GOLANGCI_LINT_VERSION ?= v1.59.1
239+
KUSTOMIZE_VERSION ?= v5.6.0
240+
CONTROLLER_TOOLS_VERSION ?= v0.18.0
241+
#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
242+
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
243+
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
244+
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
245+
GOLANGCI_LINT_VERSION ?= v2.1.0
216246

217247
.PHONY: kustomize
218248
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -224,6 +254,14 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
224254
$(CONTROLLER_GEN): $(LOCALBIN)
225255
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
226256

257+
.PHONY: setup-envtest
258+
setup-envtest: envtest ## Download the binaries required for ENVTEST in the local bin directory.
259+
@echo "Setting up envtest binaries for Kubernetes version $(ENVTEST_K8S_VERSION)..."
260+
@$(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path || { \
261+
echo "Error: Failed to set up envtest binaries for version $(ENVTEST_K8S_VERSION)."; \
262+
exit 1; \
263+
}
264+
227265
.PHONY: envtest
228266
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
229267
$(ENVTEST): $(LOCALBIN)
@@ -232,7 +270,7 @@ $(ENVTEST): $(LOCALBIN)
232270
.PHONY: golangci-lint
233271
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
234272
$(GOLANGCI_LINT): $(LOCALBIN)
235-
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
273+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
236274

237275
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
238276
# $1 - target path with name of binary
@@ -276,7 +314,7 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada
276314

277315
.PHONY: bundle-build
278316
bundle-build: ## Build the bundle image.
279-
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
317+
$(CONTAINER_TOOL) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
280318

281319
.PHONY: bundle-push
282320
bundle-push: ## Push the bundle image.
@@ -291,7 +329,7 @@ ifeq (,$(shell which opm 2>/dev/null))
291329
set -e ;\
292330
mkdir -p $(dir $(OPM)) ;\
293331
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
294-
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$${OS}-$${ARCH}-opm ;\
332+
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.55.0/$${OS}-$${ARCH}-opm ;\
295333
chmod +x $(OPM) ;\
296334
}
297335
else
@@ -316,7 +354,7 @@ endif
316354
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
317355
.PHONY: catalog-build
318356
catalog-build: opm ## Build a catalog image.
319-
$(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
357+
$(OPM) index add --container-tool $(CONTAINER_TOOL) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
320358

321359
# Push the catalog image.
322360
.PHONY: catalog-push

PROJECT

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ resources:
1414
- api:
1515
crdVersion: v1
1616
namespaced: true
17-
controller: true
1817
domain: aureum.cloud
1918
group: frp
20-
kind: ExitServer
19+
kind: Tunnel
2120
path: frp-operator/api/v1
2221
version: v1
2322
- api:
2423
crdVersion: v1
2524
namespaced: true
25+
controller: true
2626
domain: aureum.cloud
2727
group: frp
28-
kind: Tunnel
28+
kind: ExitServer
2929
path: frp-operator/api/v1
3030
version: v1
3131
version: "3"

api/v1/exitserver_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2024 Aureum Cloud, N-Bit, Niek Berenschot.
2+
Copyright 2026 Aureum Cloud, N-Bit, Niek Berenschot.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

api/v1/groupversion_info.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2024 Aureum Cloud, N-Bit, Niek Berenschot.
2+
Copyright 2026 Aureum Cloud, N-Bit, Niek Berenschot.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package v1 contains API Schema definitions for the frp v1 API group
17+
// Package v1 contains API Schema definitions for the frp v1 API group.
1818
// +kubebuilder:object:generate=true
1919
// +groupName=frp.aureum.cloud
2020
package v1
@@ -25,10 +25,10 @@ import (
2525
)
2626

2727
var (
28-
// GroupVersion is group version used to register these objects
28+
// GroupVersion is group version used to register these objects.
2929
GroupVersion = schema.GroupVersion{Group: "frp.aureum.cloud", Version: "v1"}
3030

31-
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
31+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
3232
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
3333

3434
// AddToScheme adds the types in this group-version to the given scheme.

api/v1/tunnel_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2024 Aureum Cloud, N-Bit, Niek Berenschot.
2+
Copyright 2026 Aureum Cloud, N-Bit, Niek Berenschot.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)