Skip to content

Commit

Permalink
Merge pull request #111 from h3poteto/fix/build
Browse files Browse the repository at this point in the history
Fix build script and docker file for new controller
  • Loading branch information
h3poteto authored Nov 25, 2020
2 parents 26b98cc + a805fd7 commit bd9fe5c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ ENV CGO_ENABLED="0" \

WORKDIR /go/src/github.com/h3poteto/fluentd-sidecar-injector

RUN set -ex && \
apk add --no-cache \
make \
git \
bash

COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . .
RUN set -ex && \
go build -o fluentd-sidecar-injector
make build

FROM alpine:latest
COPY --from=builder /go/src/github.com/h3poteto/fluentd-sidecar-injector/fluentd-sidecar-injector /fluentd-sidecar-injector
Expand Down
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ GOBIN=$(shell go env GOBIN)
endif

CRD_OPTIONS ?= "crd:trivialVersions=true"
CODE_GENERATOR=${GOPATH}/src/k8s.io/code-generator

build: codegen manifests
go build

run: codegen manifests
go run ./main.go controller sidecar-injector
Expand All @@ -25,14 +29,19 @@ clean:
rm ./*.crt
rm ./*.key

codegen:
${GOPATH}/src/k8s.io/code-generator/generate-groups.sh "deepcopy,client,informer,lister" \
codegen: code-generator
${CODE_GENERATOR}/generate-groups.sh "deepcopy,client,informer,lister" \
github.com/h3poteto/fluentd-sidecar-injector/pkg/client github.com/h3poteto/fluentd-sidecar-injector/pkg/apis \
sidecarinjectorcontroller:v1alpha1

manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=sidecar-injector-manager-role paths=./... output:crd:artifacts:config=./config/crd/

code-generator:
ifeq (, $(wildcard ${CODE_GENERATOR}))
git clone https://github.com/kubernetes/code-generator.git ${CODE_GENERATOR}
endif

controller-gen:
ifeq (, $(shell which controller-gen))
@{ \
Expand Down

0 comments on commit bd9fe5c

Please sign in to comment.