···11# Build the manager binary
22-FROM golang:1.21 AS builder
22+FROM golang:1.22 AS builder
33ARG TARGETOS
44ARG TARGETARCH
55
+22-20
Makefile
···48484949# 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.
5151-OPERATOR_SDK_VERSION ?= v1.37.0
5151+OPERATOR_SDK_VERSION ?= v1.39.2
5252# Image URL to use all building/pushing image targets
5353IMG ?= controller:latest
5454# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5555-ENVTEST_K8S_VERSION = 1.29.0
5555+ENVTEST_K8S_VERSION = 1.31.0
56565757# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
5858ifeq (,$(shell go env GOBIN))
···6565# Be aware that the target commands are only tested with Docker which is
6666# scaffolded by default. However, you might want to replace it to use other
6767# tools. (i.e. podman)
6868-CONTAINER_TOOL ?= podman
6868+CONTAINER_TOOL ?= docker
69697070# Setting SHELL to bash allows bash commands to be executed by recipes.
7171# Options are set to exit when a recipe line exits non-zero or a piped command fails.
···120120 go test ./test/e2e/ -v -ginkgo.v
121121122122.PHONY: lint
123123-lint: golangci-lint ## Run golangci-lint linter & yamllint
123123+lint: golangci-lint ## Run golangci-lint linter
124124 $(GOLANGCI_LINT) run
125125126126.PHONY: lint-fix
···159159docker-buildx: ## Build and push docker image for the manager for cross-platform support
160160 # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
161161 sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
162162- - $(CONTAINER_TOOL) buildx create --name project-v3-builder
163163- $(CONTAINER_TOOL) buildx use project-v3-builder
162162+ - $(CONTAINER_TOOL) buildx create --name secret-service-operator-builder
163163+ $(CONTAINER_TOOL) buildx use secret-service-operator-builder
164164 - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
165165- - $(CONTAINER_TOOL) buildx rm project-v3-builder
165165+ - $(CONTAINER_TOOL) buildx rm secret-service-operator-builder
166166 rm Dockerfile.cross
167167168168.PHONY: build-installer
···203203204204## Tool Binaries
205205KUBECTL ?= kubectl
206206-KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
207207-CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
208208-ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
209209-GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
206206+KUSTOMIZE ?= $(LOCALBIN)/kustomize
207207+CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
208208+ENVTEST ?= $(LOCALBIN)/setup-envtest
209209+GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
210210211211## Tool Versions
212212-KUSTOMIZE_VERSION ?= v5.3.0
213213-CONTROLLER_TOOLS_VERSION ?= v0.14.0
214214-ENVTEST_VERSION ?= release-0.17
215215-GOLANGCI_LINT_VERSION ?= v1.57.2
212212+KUSTOMIZE_VERSION ?= v5.4.3
213213+CONTROLLER_TOOLS_VERSION ?= v0.16.1
214214+ENVTEST_VERSION ?= release-0.19
215215+GOLANGCI_LINT_VERSION ?= v1.59.1
216216217217.PHONY: kustomize
218218kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
···232232.PHONY: golangci-lint
233233golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
234234$(GOLANGCI_LINT): $(LOCALBIN)
235235- $(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
235235+ $(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
236236237237# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
238238-# $1 - target path with name of binary (ideally with version)
238238+# $1 - target path with name of binary
239239# $2 - package url which can be installed
240240# $3 - specific version of package
241241define go-install-tool
242242-@[ -f $(1) ] || { \
242242+@[ -f "$(1)-$(3)" ] || { \
243243set -e; \
244244package=$(2)@$(3) ;\
245245echo "Downloading $${package}" ;\
246246+rm -f $(1) || true ;\
246247GOBIN=$(LOCALBIN) go install $${package} ;\
247247-mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\
248248-}
248248+mv $(1) $(1)-$(3) ;\
249249+} ;\
250250+ln -sf $(1)-$(3) $(1)
249251endef
250252251253.PHONY: operator-sdk
+7-3
README.md
···1010## Getting Started
11111212### Prerequisites
1313-- go version v1.21.0+
1313+- go version v1.22.0+
1414- docker version 17.03+.
1515- kubectl version v1.11.3+.
1616- Access to a Kubernetes v1.11.3+ cluster.
···1919**Build and push your image to the location specified by `IMG`:**
20202121```sh
2222-make docker-build IMG=<some-registry>/secret-service-operator:tag
2222+make docker-build docker-push IMG=<some-registry>/secret-service-operator:tag
2323```
2424+2525+**NOTE:** This image ought to be published in the personal registry you specified.
2626+And it is required to have access to pull the image from the working environment.
2727+Make sure you have the proper permission to the registry if the above commands don’t work.
24282529**Install the CRDs into the cluster:**
2630···9710198102## License
99103100100-Copyright 2024.
104104+Copyright 2025.
101105102106Licensed under the Apache License, Version 2.0 (the "License");
103107you may not use this file except in compliance with the License.
+1-1
api/v1/groupversion_info.go
···11/*
22-Copyright 2024.
22+Copyright 2025.
3344Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
+4-4
api/v1/secretservice_types.go
···11/*
22-Copyright 2024.
22+Copyright 2025.
3344Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
···3737 // Important: Run "make" to regenerate code after modifying this file
3838}
39394040-//+kubebuilder:object:root=true
4141-//+kubebuilder:subresource:status
4040+// +kubebuilder:object:root=true
4141+// +kubebuilder:subresource:status
42424343// SecretService is the Schema for the secretservices API
4444type SecretService struct {
···4949 Status SecretServiceStatus `json:"status,omitempty"`
5050}
51515252-//+kubebuilder:object:root=true
5252+// +kubebuilder:object:root=true
53535454// SecretServiceList contains a list of SecretService
5555type SecretServiceList struct {
+1-1
api/v1/zz_generated.deepcopy.go
···11//go:build !ignore_autogenerated
2233/*
44-Copyright 2024.
44+Copyright 2025.
5566Licensed under the Apache License, Version 2.0 (the "License");
77you may not use this file except in compliance with the License.
+2-2
charts/secret-service-operator/Chart.yaml
···1616# This is the chart version. This version number should be incremented each time you make changes
1717# to the chart and its templates, including the app version.
1818# Versions are expected to follow Semantic Versioning (https://semver.org/)
1919-version: 0.1.7
1919+version: 0.2.0
20202121# This is the version number of the application being deployed. This version number should be
2222# incremented each time you make changes to the application. Versions are not expected to
2323# follow Semantic Versioning. They should reflect the version the application is using.
2424# It is recommended to use it with quotes.
2525-appVersion: "0.1.7"
2525+appVersion: "0.2.0"
26262727maintainers:
2828- name: evanjarrett
+36-14
cmd/main.go
···11/*
22-Copyright 2024.
22+Copyright 2025.
3344Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
···3131 ctrl "sigs.k8s.io/controller-runtime"
3232 "sigs.k8s.io/controller-runtime/pkg/healthz"
3333 "sigs.k8s.io/controller-runtime/pkg/log/zap"
3434+ "sigs.k8s.io/controller-runtime/pkg/metrics/filters"
3435 metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
3536 "sigs.k8s.io/controller-runtime/pkg/webhook"
36373738 appsv1 "github.com/evanjarrett/secret-service-operator/api/v1"
3839 "github.com/evanjarrett/secret-service-operator/internal/controller"
3939- //+kubebuilder:scaffold:imports
4040+ // +kubebuilder:scaffold:imports
4041)
41424243var (
···4849 utilruntime.Must(clientgoscheme.AddToScheme(scheme))
49505051 utilruntime.Must(appsv1.AddToScheme(scheme))
5151- //+kubebuilder:scaffold:scheme
5252+ // +kubebuilder:scaffold:scheme
5253}
53545455func main() {
···5758 var probeAddr string
5859 var secureMetrics bool
5960 var enableHTTP2 bool
6060- flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
6161+ var tlsOpts []func(*tls.Config)
6262+ flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+
6363+ "Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.")
6164 flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
6265 flag.BoolVar(&enableLeaderElection, "leader-elect", false,
6366 "Enable leader election for controller manager. "+
6467 "Enabling this will ensure there is only one active controller manager.")
6565- flag.BoolVar(&secureMetrics, "metrics-secure", false,
6666- "If set the metrics endpoint is served securely")
6868+ flag.BoolVar(&secureMetrics, "metrics-secure", true,
6969+ "If set, the metrics endpoint is served securely via HTTPS. Use --metrics-secure=false to use HTTP instead.")
6770 flag.BoolVar(&enableHTTP2, "enable-http2", false,
6871 "If set, HTTP/2 will be enabled for the metrics and webhook servers")
6972 opts := zap.Options{
···8588 c.NextProtos = []string{"http/1.1"}
8689 }
87908888- tlsOpts := []func(*tls.Config){}
8991 if !enableHTTP2 {
9092 tlsOpts = append(tlsOpts, disableHTTP2)
9193 }
···9496 TLSOpts: tlsOpts,
9597 })
96989999+ // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server.
100100+ // More info:
101101+ // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/metrics/server
102102+ // - https://book.kubebuilder.io/reference/metrics.html
103103+ metricsServerOptions := metricsserver.Options{
104104+ BindAddress: metricsAddr,
105105+ SecureServing: secureMetrics,
106106+ // TODO(user): TLSOpts is used to allow configuring the TLS config used for the server. If certificates are
107107+ // not provided, self-signed certificates will be generated by default. This option is not recommended for
108108+ // production environments as self-signed certificates do not offer the same level of trust and security
109109+ // as certificates issued by a trusted Certificate Authority (CA). The primary risk is potentially allowing
110110+ // unauthorized access to sensitive metrics data. Consider replacing with CertDir, CertName, and KeyName
111111+ // to provide certificates, ensuring the server communicates using trusted and secure certificates.
112112+ TLSOpts: tlsOpts,
113113+ }
114114+115115+ if secureMetrics {
116116+ // FilterProvider is used to protect the metrics endpoint with authn/authz.
117117+ // These configurations ensure that only authorized users and service accounts
118118+ // can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info:
119119+ // https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/metrics/filters#WithAuthenticationAndAuthorization
120120+ metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization
121121+ }
122122+97123 mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
9898- Scheme: scheme,
9999- Metrics: metricsserver.Options{
100100- BindAddress: metricsAddr,
101101- SecureServing: secureMetrics,
102102- TLSOpts: tlsOpts,
103103- },
124124+ Scheme: scheme,
125125+ Metrics: metricsServerOptions,
104126 WebhookServer: webhookServer,
105127 HealthProbeBindAddress: probeAddr,
106128 LeaderElection: enableLeaderElection,
···129151 setupLog.Error(err, "unable to create controller", "controller", "SecretService")
130152 os.Exit(1)
131153 }
132132- //+kubebuilder:scaffold:builder
154154+ // +kubebuilder:scaffold:builder
133155134156 if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
135157 setupLog.Error(err, "unable to set up health check")
···22# since it depends on service name and namespace that are out of this kustomize package.
33# It should be run by config/default
44resources:
55+- bases/apps.j5t.io.j5t.io_secretservices.yaml
56- bases/apps.j5t.io_secretservices.yaml
66-#+kubebuilder:scaffold:crdkustomizeresource
77+# +kubebuilder:scaffold:crdkustomizeresource
7889patches:
910# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1011# patches here are for enabling the conversion webhook for each CRD
1111-#+kubebuilder:scaffold:crdkustomizewebhookpatch
1212+# +kubebuilder:scaffold:crdkustomizewebhookpatch
12131314# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
1415# patches here are for enabling the CA injection for each CRD
1516#- path: patches/cainjection_in_secretservices.yaml
1616-#+kubebuilder:scaffold:crdkustomizecainjectionpatch
1717+# +kubebuilder:scaffold:crdkustomizecainjectionpatch
17181819# [WEBHOOK] To enable webhook, uncomment the following section
1920# the following config is for teaching kustomize how to do kustomization for CRDs.
+13-4
config/default/kustomization.yaml
···2525#- ../certmanager
2626# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2727#- ../prometheus
2828+# [METRICS] Expose the controller manager metrics service.
2929+- metrics_service.yaml
3030+# [NETWORK POLICY] Protect the /metrics endpoint and Webhook Server with NetworkPolicy.
3131+# Only Pod(s) running a namespace labeled with 'metrics: enabled' will be able to gather the metrics.
3232+# Only CR(s) which requires webhooks and are applied on namespaces labeled with 'webhooks: enabled' will
3333+# be able to communicate with the Webhook Server.
3434+#- ../network-policy
28353636+# Uncomment the patches line if you enable Metrics, and/or are using webhooks and cert-manager
2937patches:
3030-# Protect the /metrics endpoint by putting it behind auth.
3131-# If you want your controller-manager to expose the /metrics
3232-# endpoint w/o any authn/z, please comment the following line.
3333-- path: manager_auth_proxy_patch.yaml
3838+# [METRICS] The following patch will enable the metrics endpoint using HTTPS and the port :8443.
3939+# More info: https://book.kubebuilder.io/reference/metrics
4040+- path: manager_metrics_patch.yaml
4141+ target:
4242+ kind: Deployment
34433544# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
3645# crd/kustomization.yaml
-39
config/default/manager_auth_proxy_patch.yaml
···11-# This patch inject a sidecar container which is a HTTP proxy for the
22-# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
33-apiVersion: apps/v1
44-kind: Deployment
55-metadata:
66- name: controller-manager
77- namespace: system
88-spec:
99- template:
1010- spec:
1111- containers:
1212- - name: kube-rbac-proxy
1313- securityContext:
1414- allowPrivilegeEscalation: false
1515- capabilities:
1616- drop:
1717- - "ALL"
1818- image: gcr.io/kubebuilder/kube-rbac-proxy:v0.16.0
1919- args:
2020- - "--secure-listen-address=0.0.0.0:8443"
2121- - "--upstream=http://127.0.0.1:8080/"
2222- - "--logtostderr=true"
2323- - "--v=0"
2424- ports:
2525- - containerPort: 8443
2626- protocol: TCP
2727- name: https
2828- resources:
2929- limits:
3030- cpu: 500m
3131- memory: 128Mi
3232- requests:
3333- cpu: 5m
3434- memory: 64Mi
3535- - name: manager
3636- args:
3737- - "--health-probe-bind-address=:8081"
3838- - "--metrics-bind-address=127.0.0.1:8080"
3939- - "--leader-elect"
···11+# This patch adds the args to allow exposing the metrics endpoint using HTTPS
22+- op: add
33+ path: /spec/template/spec/containers/0/args/0
44+ value: --metrics-bind-address=:8443
···99# [WEBHOOK] To enable webhooks, uncomment all the sections with [WEBHOOK] prefix.
1010# Do NOT uncomment sections with prefix [CERTMANAGER], as OLM does not support cert-manager.
1111# These patches remove the unnecessary "cert" volume and its manager container volumeMount.
1212-#patchesJson6902:
1212+#patches:
1313#- target:
1414# group: apps
1515# version: v1
+26
config/network-policy/allow-metrics-traffic.yaml
···11+# This NetworkPolicy allows ingress traffic
22+# with Pods running on namespaces labeled with 'metrics: enabled'. Only Pods on those
33+# namespaces are able to gathering data from the metrics endpoint.
44+apiVersion: networking.k8s.io/v1
55+kind: NetworkPolicy
66+metadata:
77+ labels:
88+ app.kubernetes.io/name: secret-service-operator
99+ app.kubernetes.io/managed-by: kustomize
1010+ name: allow-metrics-traffic
1111+ namespace: system
1212+spec:
1313+ podSelector:
1414+ matchLabels:
1515+ control-plane: controller-manager
1616+ policyTypes:
1717+ - Ingress
1818+ ingress:
1919+ # This allows ingress traffic from any namespace with the label metrics: enabled
2020+ - from:
2121+ - namespaceSelector:
2222+ matchLabels:
2323+ metrics: enabled # Only from namespaces with this label
2424+ ports:
2525+ - port: 8443
2626+ protocol: TCP
···1111spec:
1212 endpoints:
1313 - path: /metrics
1414- port: https
1414+ port: https # Ensure this is the name of the port that exposes HTTPS metrics
1515 scheme: https
1616 bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
1717 tlsConfig:
1818+ # TODO(user): The option insecureSkipVerify: true is not recommended for production since it disables
1919+ # certificate verification. This poses a significant security risk by making the system vulnerable to
2020+ # man-in-the-middle attacks, where an attacker could intercept and manipulate the communication between
2121+ # Prometheus and the monitored services. This could lead to unauthorized access to sensitive metrics data,
2222+ # compromising the integrity and confidentiality of the information.
2323+ # Please use the following options for secure configurations:
2424+ # caFile: /etc/metrics-certs/ca.crt
2525+ # certFile: /etc/metrics-certs/tls.crt
2626+ # keyFile: /etc/metrics-certs/tls.key
1827 insecureSkipVerify: true
1928 selector:
2029 matchLabels:
···99- role_binding.yaml
1010- leader_election_role.yaml
1111- leader_election_role_binding.yaml
1212-# Comment the following 4 lines if you want to disable
1313-# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
1414-# which protects your /metrics endpoint.
1515-- auth_proxy_service.yaml
1616-- auth_proxy_role.yaml
1717-- auth_proxy_role_binding.yaml
1818-- auth_proxy_client_clusterrole.yaml
1212+# The following RBAC configurations are used to protect
1313+# the metrics endpoint with authn/authz. These configurations
1414+# ensure that only authorized users and service accounts
1515+# can access the metrics endpoint. Comment the following
1616+# permissions if you want to disable this protection.
1717+# More info: https://book.kubebuilder.io/reference/metrics.html
1818+- metrics_auth_role.yaml
1919+- metrics_auth_role_binding.yaml
2020+- metrics_reader_role.yaml
1921# For each CRD, "Editor" and "Viewer" roles are scaffolded by
2022# default, aiding admins in cluster management. Those roles are
2123# not used by the Project itself. You can comment the following lines
2224# if you do not want those helpers be installed with your Project.
2325- secretservice_editor_role.yaml
2426- secretservice_viewer_role.yaml
2727+
···11/*
22-Copyright 2024.
22+Copyright 2025.
3344Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
+5-5
internal/controller/secretservice_controller.go
···11/*
22-Copyright 2024.
22+Copyright 2025.
3344Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
···4343 Scheme *runtime.Scheme
4444}
45454646-//+kubebuilder:rbac:groups=apps.j5t.io,resources=secretservices,verbs=get;list;watch;create;update;patch;delete
4747-//+kubebuilder:rbac:groups=apps.j5t.io,resources=secretservices/status,verbs=get;update;patch
4848-//+kubebuilder:rbac:groups=apps.j5t.io,resources=secretservices/finalizers,verbs=update
4646+// +kubebuilder:rbac:groups=apps.j5t.io,resources=secretservices,verbs=get;list;watch;create;update;patch;delete
4747+// +kubebuilder:rbac:groups=apps.j5t.io,resources=secretservices/status,verbs=get;update;patch
4848+// +kubebuilder:rbac:groups=apps.j5t.io,resources=secretservices/finalizers,verbs=update
49495050// Reconcile is part of the main kubernetes reconciliation loop which aims to
5151// move the current state of the cluster closer to the desired state.
···5555// the user.
5656//
5757// For more details, check Reconcile and its Result here:
5858-// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.3/pkg/reconcile
5858+// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile
5959func (r *SecretServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
6060 logger := log.FromContext(ctx)
6161
···11/*
22-Copyright 2024.
22+Copyright 2025.
3344Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
+10-4
internal/controller/suite_test.go
···11/*
22-Copyright 2024.
22+Copyright 2025.
3344Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
···1717package controller
18181919import (
2020+ "context"
2021 "fmt"
2122 "path/filepath"
2223 "runtime"
···3334 "sigs.k8s.io/controller-runtime/pkg/log/zap"
34353536 appsv1 "github.com/evanjarrett/secret-service-operator/api/v1"
3636- //+kubebuilder:scaffold:imports
3737+ // +kubebuilder:scaffold:imports
3738)
38393940// These tests use Ginkgo (BDD-style Go testing framework). Refer to
···4243var cfg *rest.Config
4344var k8sClient client.Client
4445var testEnv *envtest.Environment
4646+var ctx context.Context
4747+var cancel context.CancelFunc
45484649func TestControllers(t *testing.T) {
4750 RegisterFailHandler(Fail)
···5255var _ = BeforeSuite(func() {
5356 logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
54575858+ ctx, cancel = context.WithCancel(context.TODO())
5959+5560 By("bootstrapping test environment")
5661 testEnv = &envtest.Environment{
5762 CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
···6368 // Note that you must have the required binaries setup under the bin directory to perform
6469 // the tests directly. When we run make test it will be setup and used automatically.
6570 BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s",
6666- fmt.Sprintf("1.29.0-%s-%s", runtime.GOOS, runtime.GOARCH)),
7171+ fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)),
6772 }
68736974 var err error
···7580 err = appsv1.AddToScheme(scheme.Scheme)
7681 Expect(err).NotTo(HaveOccurred())
77827878- //+kubebuilder:scaffold:scheme
8383+ // +kubebuilder:scaffold:scheme
79848085 k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
8186 Expect(err).NotTo(HaveOccurred())
···85908691var _ = AfterSuite(func() {
8792 By("tearing down the test environment")
9393+ cancel()
8894 err := testEnv.Stop()
8995 Expect(err).NotTo(HaveOccurred())
9096})
+2-2
test/e2e/e2e_suite_test.go
···11/*
22-Copyright 2024.
22+Copyright 2025.
3344Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
···2727// Run e2e tests using the Ginkgo runner.
2828func TestE2E(t *testing.T) {
2929 RegisterFailHandler(Fail)
3030- fmt.Fprintf(GinkgoWriter, "Starting secret-service-operator suite\n")
3030+ _, _ = fmt.Fprintf(GinkgoWriter, "Starting secret-service-operator suite\n")
3131 RunSpecs(t, "e2e suite")
3232}
+1-1
test/e2e/e2e_test.go
···11/*
22-Copyright 2024.
22+Copyright 2025.
3344Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
+5-5
test/utils/utils.go
···11/*
22-Copyright 2024.
22+Copyright 2025.
3344Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
···3535)
36363737func warnError(err error) {
3838- fmt.Fprintf(GinkgoWriter, "warning: %v\n", err)
3838+ _, _ = fmt.Fprintf(GinkgoWriter, "warning: %v\n", err)
3939}
40404141// InstallPrometheusOperator installs the prometheus Operator to be used to export the enabled metrics.
···5252 cmd.Dir = dir
53535454 if err := os.Chdir(cmd.Dir); err != nil {
5555- fmt.Fprintf(GinkgoWriter, "chdir dir: %s\n", err)
5555+ _, _ = fmt.Fprintf(GinkgoWriter, "chdir dir: %s\n", err)
5656 }
57575858 cmd.Env = append(os.Environ(), "GO111MODULE=on")
5959 command := strings.Join(cmd.Args, " ")
6060- fmt.Fprintf(GinkgoWriter, "running: %s\n", command)
6060+ _, _ = fmt.Fprintf(GinkgoWriter, "running: %s\n", command)
6161 output, err := cmd.CombinedOutput()
6262 if err != nil {
6363 return output, fmt.Errorf("%s failed with error: (%v) %s", command, err, string(output))
···103103 return err
104104}
105105106106-// LoadImageToKindCluster loads a local docker image to the kind cluster
106106+// LoadImageToKindClusterWithName loads a local docker image to the kind cluster
107107func LoadImageToKindClusterWithName(name string) error {
108108 cluster := "kind"
109109 if v, ok := os.LookupEnv("KIND_CLUSTER"); ok {