Skip to content

Commit

Permalink
separate server and client
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Bortnikov <[email protected]>
  • Loading branch information
aobort committed Nov 11, 2024
1 parent f96d89f commit 3468011
Show file tree
Hide file tree
Showing 36 changed files with 2,028 additions and 279 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ RUN go mod download
# Copy the go source
COPY cmd/manager/main.go cmd/manager/main.go
COPY cmd/metalprobe/main.go cmd/metalprobe/main.go
COPY cmd/fmiserver/main.go cmd/fmiserver/main.go
COPY api/ api/
COPY internal/ internal/
COPY bmc/ bmc/
COPY fmi/ fmi/

# Build
# the GOARCH has not a default value to allow the binary be built according to the host where the command
Expand All @@ -26,10 +28,15 @@ COPY bmc/ bmc/
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/manager/main.go

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o metalprobe cmd/metalprobe/main.go

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o fmi-server cmd/fmiserver/main.go


# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand All @@ -48,3 +55,11 @@ COPY --from=builder /workspace/metalprobe .
USER 65532:65532

ENTRYPOINT ["/metalprobe"]

FROM gcr.io/distroless/static:nonroot AS fmi-server
LABEL source_repository="https://github.com/ironcore-dev/metal-operator"
WORKDIR /
COPY --from=builder /workspace/fmi-server .
USER 65532:65532

ENTRYPOINT ["/fmi-server"]
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: gen-proto
gen-proto: buf
$(BUF) generate

.PHONY: fmt
fmt: goimports ## Run goimports against code.
$(GOIMPORTS) -w .
Expand Down Expand Up @@ -208,6 +212,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
GOIMPORTS ?= $(LOCALBIN)/goimports-$(GOIMPORTS_VERSION)
GEN_CRD_API_REFERENCE_DOCS ?= $(LOCALBIN)/gen-crd-api-reference-docs-$(GEN_CRD_API_REFERENCE_DOCS_VERSION)
BUF ?= $(LOCALBIN)/buf-$(BUF_VERSION)

## Tool Versions
KUSTOMIZE_VERSION ?= v5.3.0
Expand All @@ -216,6 +221,7 @@ ENVTEST_VERSION ?= latest
GOLANGCI_LINT_VERSION ?= v1.61.0
GOIMPORTS_VERSION ?= v0.25.0
GEN_CRD_API_REFERENCE_DOCS_VERSION ?= v0.3.0
BUF_VERSION ?= v1.46.0

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand Down Expand Up @@ -254,6 +260,11 @@ gen-crd-api-reference-docs: $(GEN_CRD_API_REFERENCE_DOCS) ## Download gen-crd-ap
$(GEN_CRD_API_REFERENCE_DOCS): $(LOCALBIN)
$(call go-install-tool,$(GEN_CRD_API_REFERENCE_DOCS),github.com/ahmetb/gen-crd-api-reference-docs,$(GEN_CRD_API_REFERENCE_DOCS_VERSION))

.PHONY: buf
buf: $(BUF) ## Download buf locally if necessary.
$(BUF): $(LOCALBIN)
$(call go-install-tool,$(BUF),github.com/bufbuild/buf/cmd/buf,$(BUF_VERSION))

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary (ideally with version)
# $2 - package url which can be installed
Expand Down
1 change: 1 addition & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def waitforsystem():
deploy_cert_manager()

docker_build('controller', '.', target = 'manager')
docker_build('fmi-server', '.', target = 'fmi-server')

deploy_boot()

Expand Down
149 changes: 149 additions & 0 deletions api/gen/common/v1alpha1/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3468011

Please sign in to comment.