From d5f8bc96011ca2681ba87d93e4119057ecfe9c8c Mon Sep 17 00:00:00 2001 From: Tim Goodwin Date: Tue, 7 May 2024 15:08:20 -0700 Subject: [PATCH] changes --- Dockerfile | 3 +++ Makefile | 10 ++++++++++ go.mod | 7 ++++++- main.go | 3 ++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b5813dd1..1fc129fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,8 @@ COPY cmd ./cmd COPY go.mod go.mod COPY go.sum go.sum +COPY custom/ custom/ + # Download all dependencies. RUN go mod download @@ -25,6 +27,7 @@ COPY main.go main.go COPY api/ api/ COPY controllers/ controllers/ + # Build RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \ -ldflags "-X ${REPO_PATH}/pkg/version.Version=${VERSION} -X ${REPO_PATH}/pkg/version.GitSHA=${GIT_SHA}" main.go diff --git a/Makefile b/Makefile index 0017afbb..3f49cbed 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,11 @@ else GOBIN=$(shell go env GOBIN) endif +# +# SLEEVELESS +# +SLEEVELESS_REPO=docker.io/tlg2132/$(PROJECT_NAME) + # Install CRDs into a cluster install: manifests kustomize $(KUSTOMIZE) build config/crd | kubectl apply -f - @@ -98,6 +103,11 @@ $(CONTROLLER_GEN): $(LOCALBIN) all: generate check build +sleeveless: build-image + docker tag $(REPO):$(VERSION) $(SLEEVELESS_REPO):sleeveless + docker push $(SLEEVELESS_REPO):sleeveless + + generate: $(CONTROLLER_GEN) object paths="./..." make manifests diff --git a/go.mod b/go.mod index cc67621a..9404f267 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/pravega/zookeeper-operator -go 1.21 +go 1.21.0 + +toolchain go1.21.6 require ( github.com/ghodss/yaml v1.0.0 @@ -11,6 +13,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414 github.com/sirupsen/logrus v1.9.0 + github.com/tgoodwin/sleeveless/client v0.0.1 golang.org/x/net v0.17.0 k8s.io/api v0.27.5 k8s.io/apimachinery v0.27.5 @@ -75,3 +78,5 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) + +replace github.com/tgoodwin/sleeveless/client => ./custom/sleeveless-client diff --git a/main.go b/main.go index 75b9ab48..f452fe3c 100644 --- a/main.go +++ b/main.go @@ -36,6 +36,7 @@ import ( api "github.com/pravega/zookeeper-operator/api/v1beta1" "github.com/pravega/zookeeper-operator/controllers" + sleeve "github.com/tgoodwin/sleeveless/client" // +kubebuilder:scaffold:imports ) @@ -127,7 +128,7 @@ func main() { } if err = (&controllers.ZookeeperClusterReconciler{ - Client: mgr.GetClient(), + Client: sleeve.Wrap(mgr.GetClient()), Log: ctrl.Log.WithName("controllers").WithName("ZookeeperCluster"), Scheme: mgr.GetScheme(), ZkClient: new(zkClient.DefaultZookeeperClient),