Skip to content

Commit 986a84e

Browse files
authored
cleanup: go folder (#795)
- go dir structure: move controller folder under pkg and internal - remove webhook: we don't have it anyway
1 parent 7601292 commit 986a84e

Some content is hidden

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

67 files changed

+118
-257
lines changed
File renamed without changes.

go/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ RUN --mount=type=cache,target=/root/go/pkg/mod,rw \
1818
go mod download
1919

2020
# Copy the go source
21+
COPY api api
22+
COPY cmd cmd
2123
COPY pkg pkg
2224
COPY internal internal
23-
COPY controller controller
2425
# Build
2526
# the GOARCH has not a default value to allow the binary be built according to the host where the command
2627
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
@@ -30,7 +31,7 @@ ARG LDFLAGS
3031
RUN --mount=type=cache,target=/root/go/pkg/mod,rw \
3132
--mount=type=cache,target=/root/.cache/go-build,rw \
3233
echo "Building on $BUILDPLATFORM -> linux/$TARGETARCH" && \
33-
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -ldflags "$LDFLAGS" -o manager controller/cmd/main.go
34+
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -ldflags "$LDFLAGS" -o manager cmd/controller/main.go
3435

3536
### STAGE 2: final image
3637
# Use distroless as minimal base image to package the manager binary

go/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ endif
1616
##@ Development
1717

1818
.PHONY: manifests
19-
manifests: controller-gen generate ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
20-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
19+
manifests: controller-gen generate ## Generate ClusterRole and CustomResourceDefinition objects.
20+
$(CONTROLLER_GEN) rbac:roleName=manager-role crd paths="./..." output:crd:artifacts:config=config/crd/bases
2121

2222
.PHONY: generate
2323
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
24-
$(CONTROLLER_GEN) object:headerFile="controller/hack/boilerplate.go.txt" paths="./..."
24+
$(CONTROLLER_GEN) object:headerFile="internal/controller/hack/boilerplate.go.txt" paths="./..."
2525

2626
.PHONY: fmt
2727
fmt: ## Run go fmt against code.
@@ -94,7 +94,7 @@ build: bin/kagent-linux-amd64.sha256 bin/kagent-linux-arm64.sha256 bin/kagent-da
9494

9595
.PHONY: run
9696
run: manifests generate fmt vet ## Run a controller from your host.
97-
go run ./controller/cmd/main.go
97+
go run ./cmd/controller/main.go
9898

9999
.PHONY: test
100100
test:

0 commit comments

Comments
 (0)