Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit 6319279

Browse files
committed
Update for SDK change
1 parent 883ccf6 commit 6319279

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ IMG ?= $(IMAGE_TAG_BASE):$(VERSION)
4040
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
4141
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
4242

43+
# Change DOCKERFILE tp openshift.Dockerfile to build Openshift image
44+
DOCKERFILE ?= Dockerfile
45+
RH_RBAC_IMAGE ?= registry.redhat.io/openshift4/ose-kube-rbac-proxy:v4.7
46+
4347
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
4448
ifeq (,$(shell go env GOBIN))
4549
GOBIN=$(shell go env GOPATH)/bin
@@ -100,7 +104,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
100104
go run -ldflags "-X main.version=${VERSION}" ./main.go $(ARGS)
101105

102106
docker-build: test ## Build docker image with the manager.
103-
docker build -t ${IMG} . --build-arg VERSION=${VERSION}
107+
docker build -t ${IMG} -f ${DOCKERFILE} . --build-arg VERSION=${VERSION}
104108

105109
docker-push: ## Push docker image with the manager.
106110
docker push ${IMG}
@@ -117,6 +121,12 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
117121
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
118122
$(KUSTOMIZE) build config/default | kubectl apply -f -
119123

124+
openshift-deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
125+
VAL="${RH_RBAC_IMAGE}" yq e '.spec.template.spec.containers[0].image = strenv(VAL)' -i config/default/manager_auth_proxy_patch.yaml
126+
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
127+
128+
##$(KUSTOMIZE) build config/default | kubectl apply -f -
129+
120130
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
121131
$(KUSTOMIZE) build config/default | kubectl delete -f -
122132

openshift.Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Build the manager binary
2+
FROM golang:1.16 as builder
3+
ARG VERSION
4+
5+
WORKDIR /workspace
6+
# Copy the Go Modules manifests
7+
COPY go.mod go.mod
8+
COPY go.sum go.sum
9+
# cache deps before building and copying source so that we don't need to re-download as much
10+
# and so that source changes don't invalidate our downloaded layer
11+
RUN go mod download
12+
13+
# Copy the go source
14+
COPY main.go main.go
15+
COPY api/ api/
16+
COPY controllers/ controllers/
17+
18+
# Build
19+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.version=${VERSION}" -a -o manager main.go
20+
21+
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
22+
WORKDIR /
23+
COPY --from=builder --chown=65532:65532 /workspace/manager .
24+
COPY config/crd/kic ./config/crd/kic
25+
26+
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)