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

Commit f7924cb

Browse files
authored
Merge pull request #121 from nginxinc/chore/gitlab-pipeline
chore: support deploying to Openshift and add gitlab pipeline
2 parents bfbbee0 + 0b8e75b commit f7924cb

File tree

5 files changed

+48
-1
lines changed

5 files changed

+48
-1
lines changed

.gitlab-ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include:
2+
- project: "f5/nginx/kic/kic-pipelines"
3+
file: "/include/ingress-operator.yml"
4+
ref: "master"

Makefile

+10-1
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
@@ -104,7 +108,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
104108
go run -ldflags "-X main.version=${VERSION}" ./main.go $(ARGS)
105109

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

109113
docker-push: ## Push docker image with the manager.
110114
docker push ${IMG}
@@ -121,6 +125,11 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
121125
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
122126
$(KUSTOMIZE) build config/default | kubectl apply -f -
123127

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

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ require (
1212
github.com/onsi/gomega v1.13.0
1313
github.com/openshift/api v0.0.0-20201013121701-9d5ee23b507d
1414
github.com/prometheus/client_golang v1.9.0 // indirect
15+
github.com/prometheus/procfs v0.2.0 // indirect
16+
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
1517
golang.org/x/mod v0.4.0 // indirect
1618
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
1719
k8s.io/api v0.20.4

go.sum

+6
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
520520
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
521521
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE=
522522
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
523+
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e h1:gsTQYXdTw2Gq7RBsWvlQ91b+aEQ6bXFUngBGuR8sPpI=
524+
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
523525
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
524526
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
525527
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -585,6 +587,7 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R
585587
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
586588
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
587589
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
590+
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
588591
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0=
589592
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
590593
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -645,6 +648,9 @@ golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7w
645648
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
646649
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
647650
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
651+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
652+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
653+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
648654
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
649655
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
650656
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

openshift.Dockerfile

+26
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 /workspace/manager .
24+
COPY config/crd/kic ./config/crd/kic
25+
26+
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)