Skip to content

Commit 88c15da

Browse files
committed
Add downstream container files and update the konflux pipeline
Signed-off-by: Mohamed Mahmoud <[email protected]>
1 parent c4290ef commit 88c15da

6 files changed

+106
-4
lines changed

.tekton/bpfman-agent-pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ spec:
2727
- name: image-expires-after
2828
value: 5d
2929
- name: dockerfile
30-
value: Containerfile.bpfman-agent
30+
value: Containerfile.bpfman-agent.openshift
3131
pipelineSpec:
3232
finally:
3333
- name: show-sbom

.tekton/bpfman-agent-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spec:
2424
- name: output-image
2525
value: quay.io/redhat-user-workloads/ocp-bpfman-tenant/bpfman-operator/bpfman-agent:{{revision}}
2626
- name: dockerfile
27-
value: Containerfile.bpfman-agent
27+
value: Containerfile.bpfman-agent.openshift
2828
pipelineSpec:
2929
finally:
3030
- name: show-sbom

.tekton/bpfman-operator-pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ spec:
2727
- name: image-expires-after
2828
value: 5d
2929
- name: dockerfile
30-
value: Containerfile.bpfman-operator
30+
value: Containerfile.bpfman-operator.openshift
3131
pipelineSpec:
3232
finally:
3333
- name: show-sbom

.tekton/bpfman-operator-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spec:
2424
- name: output-image
2525
value: quay.io/redhat-user-workloads/ocp-bpfman-tenant/bpfman-operator/bpfman-operator:{{revision}}
2626
- name: dockerfile
27-
value: Containerfile.bpfman-operator
27+
value: Containerfile.bpfman-operator.openshift
2828
pipelineSpec:
2929
finally:
3030
- name: show-sbom

Containerfile.bpfman-agent.openshift

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Build the manager binary
2+
ARG BUILDPLATFORM=linux/amd64
3+
4+
FROM --platform=$BUILDPLATFORM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-openshift-4.17 AS bpfman-agent-build
5+
6+
# The following ARGs are set internally by docker/build-push-action in github actions
7+
ARG TARGETOS
8+
ARG TARGETARCH
9+
ARG TARGETPLATFORM
10+
11+
RUN echo "TARGETOS=${TARGETOS} TARGETARCH=${TARGETARCH} BUILDPLATFORM=${BUILDPLATFORM} TARGETPLATFORM=${TARGETPLATFORM}"
12+
13+
WORKDIR /usr/src/bpfman-operator
14+
15+
# Copy the Go Modules manifests
16+
COPY go.mod go.mod
17+
COPY go.sum go.sum
18+
19+
COPY vendor/ vendor/
20+
21+
# cache deps before building and copying source so that we don't need to re-download as much
22+
# and so that source changes don't invalidate our downloaded layer
23+
RUN go mod download
24+
25+
# Copy the go source
26+
COPY . .
27+
28+
# Build
29+
# the GOARCH has not a default value to allow the binary be built according to the host where the command
30+
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
31+
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
32+
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
33+
WORKDIR /usr/src/bpfman-operator
34+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -mod vendor -a -o bpfman-agent ./cmd/bpfman-agent/main.go
35+
36+
FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9/ubi-minimal:9.4
37+
38+
ARG TARGETARCH
39+
ARG TARGETPLATFORM
40+
41+
WORKDIR /
42+
COPY --from=bpfman-agent-build /usr/src/bpfman-operator/bpfman-agent .
43+
44+
# Install crictl
45+
RUN dnf -y install wget tar gzip
46+
ARG VERSION="v1.28.0"
47+
RUN wget --no-check-certificate https://github.com/kubernetes-sigs/cri-tools/releases/download/${VERSION}/crictl-${VERSION}-linux-${TARGETARCH}.tar.gz
48+
RUN tar zxvf crictl-${VERSION}-linux-${TARGETARCH}.tar.gz -C /usr/local/bin
49+
RUN rm -f crictl-${VERSION}-linux-${TARGETARCH}.tar.gz
50+
RUN dnf -y clean all
51+
52+
ENTRYPOINT ["/bpfman-agent"]
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Build the manager binary
2+
ARG BUILDPLATFORM=linux/amd64
3+
4+
FROM --platform=$BUILDPLATFORM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-openshift-4.17 AS bpfman-operator-build
5+
6+
ARG BUILDPLATFORM
7+
8+
# The following ARGs are set internally by docker/build-push-action in github actions
9+
ARG TARGETOS
10+
ARG TARGETARCH
11+
ARG TARGETPLATFORM
12+
13+
RUN echo "TARGETOS=${TARGETOS} TARGETARCH=${TARGETARCH} BUILDPLATFORM=${BUILDPLATFORM} TARGETPLATFORM=${TARGETPLATFORM}"
14+
15+
WORKDIR /usr/src/bpfman-operator
16+
17+
# Copy the Go Modules manifests
18+
COPY go.mod go.mod
19+
COPY go.sum go.sum
20+
21+
COPY vendor/ vendor/
22+
23+
# cache deps before building and copying source so that we don't need to re-download as much
24+
# and so that source changes don't invalidate our downloaded layer
25+
RUN go mod download
26+
27+
# Copy the go source
28+
COPY . .
29+
30+
# Build
31+
# the GOARCH has not a default value to allow the binary be built according to the host where the command
32+
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
33+
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
34+
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
35+
WORKDIR /usr/src/bpfman-operator
36+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -mod vendor -a -o bpfman-operator ./cmd/bpfman-operator/main.go
37+
38+
FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9/ubi-minimal:9.4
39+
40+
# The following ARGs are set internally by docker or podman on multiarch builds
41+
ARG TARGETPLATFORM
42+
43+
WORKDIR /
44+
COPY --from=bpfman-operator-build /usr/src/bpfman-operator/config/bpfman-deployment/daemonset.yaml ./config/bpfman-deployment/daemonset.yaml
45+
COPY --from=bpfman-operator-build /usr/src/bpfman-operator/config/bpfman-deployment/csidriverinfo.yaml ./config/bpfman-deployment/csidriverinfo.yaml
46+
COPY --from=bpfman-operator-build /usr/src/bpfman-operator/config/openshift/restricted-scc.yaml ./config/openshift/restricted-scc.yaml
47+
COPY --from=bpfman-operator-build /usr/src/bpfman-operator/bpfman-operator .
48+
USER 65532:65532
49+
50+
ENTRYPOINT ["/bpfman-operator"]

0 commit comments

Comments
 (0)