Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes #605

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added our custom library code under a ./custom directory in the repo just to facilitate docker build. our custom code is currently in a private repo so it's hard to pull down when the build is running from inside the docker container. In the future / when we host our custom code in a public repo, we can just pull it straight down from GitHub during the build

3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

api "github.com/pravega/zookeeper-operator/api/v1beta1"
"github.com/pravega/zookeeper-operator/controllers"
sleeve "github.com/tgoodwin/sleeveless/client"

Check failure on line 39 in main.go

View workflow job for this annotation

GitHub Actions / build

github.com/tgoodwin/sleeveless/[email protected]: replacement directory ./custom/sleeveless-client does not exist

Check failure on line 39 in main.go

View workflow job for this annotation

GitHub Actions / build

github.com/tgoodwin/sleeveless/[email protected]: replacement directory ./custom/sleeveless-client does not exist
// +kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -127,7 +128,7 @@
}

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),
Expand Down
Loading