-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Containerfile.operator files in preparation to move to RHTAP (#…
…1288) Signed-off-by: Subbarao Meduri <[email protected]>
- Loading branch information
1 parent
82f16bc
commit 01e8ac6
Showing
8 changed files
with
411 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright Contributors to the Open Cluster Management project | ||
# Licensed under the Apache License 2.0 | ||
|
||
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS builder | ||
|
||
WORKDIR /workspace | ||
COPY go.sum go.mod ./ | ||
COPY ./collectors/metrics ./collectors/metrics | ||
COPY ./operators/pkg ./operators/pkg | ||
COPY ./operators/multiclusterobservability/api ./operators/multiclusterobservability/api | ||
RUN CGO_ENABLED=1 go build -a -installsuffix cgo -v -o metrics-collector ./collectors/metrics/cmd/metrics-collector/main.go | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
||
ARG VCS_REF | ||
ARG VCS_URL | ||
ARG IMAGE_NAME | ||
ARG IMAGE_DESCRIPTION | ||
ARG IMAGE_DISPLAY_NAME | ||
ARG IMAGE_NAME_ARCH | ||
ARG IMAGE_MAINTAINER | ||
ARG IMAGE_VENDOR | ||
ARG IMAGE_VERSION | ||
ARG IMAGE_RELEASE | ||
ARG IMAGE_SUMMARY | ||
ARG IMAGE_OPENSHIFT_TAGS | ||
|
||
LABEL org.label-schema.vendor="Red Hat" \ | ||
org.label-schema.name="$IMAGE_NAME_ARCH" \ | ||
org.label-schema.description="$IMAGE_DESCRIPTION" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vcs-url=$VCS_URL \ | ||
org.label-schema.license="Red Hat Advanced Cluster Management for Kubernetes EULA" \ | ||
org.label-schema.schema-version="1.0" \ | ||
name="$IMAGE_NAME" \ | ||
maintainer="$IMAGE_MAINTAINER" \ | ||
vendor="$IMAGE_VENDOR" \ | ||
version="$IMAGE_VERSION" \ | ||
release="$IMAGE_RELEASE" \ | ||
description="$IMAGE_DESCRIPTION" \ | ||
summary="$IMAGE_SUMMARY" \ | ||
io.k8s.display-name="$IMAGE_DISPLAY_NAME" \ | ||
io.k8s.description="$IMAGE_DESCRIPTION" \ | ||
io.openshift.tags="$IMAGE_OPENSHIFT_TAGS" | ||
|
||
RUN microdnf update &&\ | ||
microdnf install ca-certificates vi --nodocs &&\ | ||
mkdir /licenses &&\ | ||
microdnf clean all | ||
|
||
USER 1001:1001 | ||
|
||
COPY --from=builder /workspace/metrics-collector /usr/bin/ | ||
|
||
# standalone required parameters | ||
ENV FROM_CA_FILE="/from/service-ca.crt" | ||
ENV INTERVAL="60s" | ||
ENV MATCH_FILE="/metrics/match-file" | ||
ENV LIMIT_BYTES=1073741824 | ||
|
||
CMD ["/bin/bash", "-c", "/usr/bin/metrics-collector --from ${FROM} --from-ca-file ${FROM_CA_FILE} --from-token ${FROM_TOKEN} --to-upload ${TO_UPLOAD} --id ${TENANT_ID} --label cluster=${CLUSTER_NAME} --label clusterID=${CLUSTER_ID} --match-file ${MATCH_FILE} --interval ${INTERVAL} --limit-bytes=${LIMIT_BYTES}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright Contributors to the Open Cluster Management project | ||
# Licensed under the Apache License 2.0 | ||
|
||
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS builder | ||
|
||
WORKDIR /workspace | ||
COPY go.sum go.mod ./loaders/dashboards ./ | ||
COPY ./loaders/dashboards ./loaders/dashboards | ||
|
||
RUN CGO_ENABLED=1 go build -a -installsuffix cgo -v -o main loaders/dashboards/cmd/main.go | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
||
ARG VCS_REF | ||
ARG VCS_URL | ||
ARG IMAGE_NAME | ||
ARG IMAGE_DESCRIPTION | ||
ARG IMAGE_DISPLAY_NAME | ||
ARG IMAGE_NAME_ARCH | ||
ARG IMAGE_MAINTAINER | ||
ARG IMAGE_VENDOR | ||
ARG IMAGE_VERSION | ||
ARG IMAGE_RELEASE | ||
ARG IMAGE_SUMMARY | ||
ARG IMAGE_OPENSHIFT_TAGS | ||
|
||
LABEL org.label-schema.vendor="Red Hat" \ | ||
org.label-schema.name="$IMAGE_NAME_ARCH" \ | ||
org.label-schema.description="$IMAGE_DESCRIPTION" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vcs-url=$VCS_URL \ | ||
org.label-schema.license="Red Hat Advanced Cluster Management for Kubernetes EULA" \ | ||
org.label-schema.schema-version="1.0" \ | ||
name="$IMAGE_NAME" \ | ||
maintainer="$IMAGE_MAINTAINER" \ | ||
vendor="$IMAGE_VENDOR" \ | ||
version="$IMAGE_VERSION" \ | ||
release="$IMAGE_RELEASE" \ | ||
description="$IMAGE_DESCRIPTION" \ | ||
summary="$IMAGE_SUMMARY" \ | ||
io.k8s.display-name="$IMAGE_DISPLAY_NAME" \ | ||
io.k8s.description="$IMAGE_DESCRIPTION" \ | ||
io.openshift.tags="$IMAGE_OPENSHIFT_TAGS" | ||
|
||
WORKDIR / | ||
|
||
RUN microdnf update -y && microdnf clean all | ||
|
||
USER 1001:1001 | ||
|
||
COPY --from=builder /workspace/main grafana-dashboard-loader | ||
|
||
EXPOSE 3002 | ||
|
||
ENTRYPOINT ["/grafana-dashboard-loader"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Copyright (c) 2021 Red Hat, Inc. | ||
# Copyright Contributors to the Open Cluster Management project. | ||
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS builder | ||
|
||
WORKDIR /workspace | ||
COPY go.sum go.mod ./ | ||
COPY ./operators/endpointmetrics ./operators/endpointmetrics | ||
COPY ./operators/multiclusterobservability/api ./operators/multiclusterobservability/api | ||
COPY ./operators/pkg ./operators/pkg | ||
|
||
RUN CGO_ENABLED=1 go build -a -installsuffix cgo -o build/_output/bin/endpoint-monitoring-operator operators/endpointmetrics/main.go | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
||
ARG VCS_REF | ||
ARG VCS_URL | ||
ARG IMAGE_NAME | ||
ARG IMAGE_DESCRIPTION | ||
ARG IMAGE_DISPLAY_NAME | ||
ARG IMAGE_NAME_ARCH | ||
ARG IMAGE_MAINTAINER | ||
ARG IMAGE_VENDOR | ||
ARG IMAGE_VERSION | ||
ARG IMAGE_RELEASE | ||
ARG IMAGE_SUMMARY | ||
ARG IMAGE_OPENSHIFT_TAGS | ||
|
||
LABEL org.label-schema.vendor="Red Hat" \ | ||
org.label-schema.name="$IMAGE_NAME_ARCH" \ | ||
org.label-schema.description="$IMAGE_DESCRIPTION" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vcs-url=$VCS_URL \ | ||
org.label-schema.license="Red Hat Advanced Cluster Management for Kubernetes EULA" \ | ||
org.label-schema.schema-version="1.0" \ | ||
name="$IMAGE_NAME" \ | ||
maintainer="$IMAGE_MAINTAINER" \ | ||
vendor="$IMAGE_VENDOR" \ | ||
version="$IMAGE_VERSION" \ | ||
release="$IMAGE_RELEASE" \ | ||
description="$IMAGE_DESCRIPTION" \ | ||
summary="$IMAGE_SUMMARY" \ | ||
io.k8s.display-name="$IMAGE_DISPLAY_NAME" \ | ||
io.k8s.description="$IMAGE_DESCRIPTION" \ | ||
io.openshift.tags="$IMAGE_OPENSHIFT_TAGS" | ||
|
||
ENV OPERATOR=/usr/local/bin/endpoint-monitoring-operator \ | ||
USER_UID=1001 \ | ||
USER_NAME=endpoint-monitoring-operator | ||
|
||
RUN microdnf update -y && microdnf clean all | ||
|
||
COPY ./operators/endpointmetrics/manifests /usr/local/manifests | ||
|
||
# install operator binary | ||
COPY --from=builder /workspace/build/_output/bin/endpoint-monitoring-operator ${OPERATOR} | ||
USER ${USER_UID} | ||
|
||
ENTRYPOINT ["/usr/local/bin/endpoint-monitoring-operator"] |
62 changes: 62 additions & 0 deletions
62
operators/multiclusterobservability/Containerfile.operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright Contributors to the Open Cluster Management project | ||
# Licensed under the Apache License 2.0 | ||
|
||
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS builder | ||
|
||
WORKDIR /workspace | ||
COPY go.sum go.mod ./ | ||
COPY ./operators/multiclusterobservability ./operators/multiclusterobservability | ||
COPY ./operators/pkg ./operators/pkg | ||
|
||
RUN CGO_ENABLED=1 go build -a -installsuffix cgo -o bin/manager operators/multiclusterobservability/main.go | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
||
ARG VCS_REF | ||
ARG VCS_URL | ||
ARG IMAGE_NAME | ||
ARG IMAGE_DESCRIPTION | ||
ARG IMAGE_DISPLAY_NAME | ||
ARG IMAGE_NAME_ARCH | ||
ARG IMAGE_MAINTAINER | ||
ARG IMAGE_VENDOR | ||
ARG IMAGE_VERSION | ||
ARG IMAGE_RELEASE | ||
ARG IMAGE_SUMMARY | ||
ARG IMAGE_OPENSHIFT_TAGS | ||
|
||
LABEL org.label-schema.vendor="Red Hat" \ | ||
org.label-schema.name="$IMAGE_NAME_ARCH" \ | ||
org.label-schema.description="$IMAGE_DESCRIPTION" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vcs-url=$VCS_URL \ | ||
org.label-schema.license="Red Hat Advanced Cluster Management for Kubernetes EULA" \ | ||
org.label-schema.schema-version="1.0" \ | ||
name="$IMAGE_NAME" \ | ||
maintainer="$IMAGE_MAINTAINER" \ | ||
vendor="$IMAGE_VENDOR" \ | ||
version="$IMAGE_VERSION" \ | ||
release="$IMAGE_RELEASE" \ | ||
description="$IMAGE_DESCRIPTION" \ | ||
summary="$IMAGE_SUMMARY" \ | ||
io.k8s.display-name="$IMAGE_DISPLAY_NAME" \ | ||
io.k8s.description="$IMAGE_DESCRIPTION" \ | ||
io.openshift.tags="$IMAGE_OPENSHIFT_TAGS" | ||
|
||
ENV OPERATOR=/usr/local/bin/mco-operator \ | ||
USER_UID=1001 \ | ||
USER_NAME=mco | ||
|
||
RUN microdnf update -y && microdnf clean all | ||
|
||
# install templates | ||
COPY ./operators/multiclusterobservability/manifests /usr/local/manifests | ||
|
||
# install the prestop script | ||
COPY ./operators/multiclusterobservability/prestop.sh /usr/local/bin/prestop.sh | ||
|
||
# install operator binary | ||
COPY --from=builder /workspace/bin/manager ${OPERATOR} | ||
USER ${USER_UID} | ||
|
||
ENTRYPOINT ["/usr/local/bin/mco-operator"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright Contributors to the Open Cluster Management project | ||
|
||
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS builder | ||
|
||
WORKDIR /workspace | ||
COPY go.sum go.mod ./ | ||
COPY ./proxy ./proxy | ||
|
||
RUN CGO_ENABLED=1 go build -a -installsuffix cgo -v -o main proxy/cmd/main.go | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
||
ARG VCS_REF | ||
ARG VCS_URL | ||
ARG IMAGE_NAME | ||
ARG IMAGE_DESCRIPTION | ||
ARG IMAGE_DISPLAY_NAME | ||
ARG IMAGE_NAME_ARCH | ||
ARG IMAGE_MAINTAINER | ||
ARG IMAGE_VENDOR | ||
ARG IMAGE_VERSION | ||
ARG IMAGE_RELEASE | ||
ARG IMAGE_SUMMARY | ||
ARG IMAGE_OPENSHIFT_TAGS | ||
|
||
LABEL org.label-schema.vendor="Red Hat" \ | ||
org.label-schema.name="$IMAGE_NAME_ARCH" \ | ||
org.label-schema.description="$IMAGE_DESCRIPTION" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vcs-url=$VCS_URL \ | ||
org.label-schema.license="Red Hat Advanced Cluster Management for Kubernetes EULA" \ | ||
org.label-schema.schema-version="1.0" \ | ||
name="$IMAGE_NAME" \ | ||
maintainer="$IMAGE_MAINTAINER" \ | ||
vendor="$IMAGE_VENDOR" \ | ||
version="$IMAGE_VERSION" \ | ||
release="$IMAGE_RELEASE" \ | ||
description="$IMAGE_DESCRIPTION" \ | ||
summary="$IMAGE_SUMMARY" \ | ||
io.k8s.display-name="$IMAGE_DISPLAY_NAME" \ | ||
io.k8s.description="$IMAGE_DESCRIPTION" \ | ||
io.openshift.tags="$IMAGE_OPENSHIFT_TAGS" | ||
|
||
WORKDIR / | ||
|
||
USER 1001:1001 | ||
|
||
COPY --from=builder /workspace/main rbac-query-proxy | ||
|
||
EXPOSE 3002 | ||
|
||
ENTRYPOINT ["/rbac-query-proxy"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright Contributors to the Open Cluster Management project | ||
# Licensed under the Apache License 2.0 | ||
|
||
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS builder | ||
|
||
WORKDIR /workspace | ||
# copy go tests into build image | ||
COPY go.sum go.mod ./ | ||
COPY ./tests ./tests | ||
|
||
# compile go tests in build image | ||
RUN go install github.com/onsi/ginkgo/[email protected] && go mod vendor && ginkgo build ./tests/pkg/tests/ | ||
|
||
# create new docker image to hold built artifacts | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
||
# run as non-root | ||
USER 1001:1001 | ||
|
||
# expose env vars for runtime | ||
ENV KUBECONFIG "/opt/.kube/config" | ||
ENV IMPORT_KUBECONFIG "/opt/.kube/import-kubeconfig" | ||
ENV OPTIONS "/resources/options.yaml" | ||
ENV REPORT_FILE "/results/results.xml" | ||
ENV GINKGO_DEFAULT_FLAGS "-slowSpecThreshold=120 -timeout 7200s" | ||
ENV GINKGO_NODES "1" | ||
ENV GINKGO_FLAGS="" | ||
ENV GINKGO_FOCUS="" | ||
ENV GINKGO_SKIP="Integration" | ||
ENV SKIP_INTEGRATION_CASES="true" | ||
ENV IS_CANARY_ENV="true" | ||
|
||
# install ginkgo into built image | ||
COPY --from=builder /go/bin/ /usr/local/bin | ||
|
||
# oc exists in the base image. copy oc into built image | ||
COPY --from=builder /usr/local/bin/oc /usr/local/bin/oc | ||
RUN oc version | ||
|
||
WORKDIR /workspace/opt/tests/ | ||
# copy compiled tests into built image | ||
COPY --from=builder /workspace/tests/pkg/tests/tests.test ./observability-e2e-test.test | ||
COPY ./examples /examples | ||
COPY --from=builder /workspace/tests/format-results.sh . | ||
|
||
VOLUME /results | ||
|
||
|
||
# execute compiled ginkgo tests | ||
CMD ["/bin/bash", "-c", "ginkgo --v --focus=${GINKGO_FOCUS} --skip=${GINKGO_SKIP} -nodes=${GINKGO_NODES} --reportFile=${REPORT_FILE} -x -debug -trace observability-e2e-test.test -- -v=3 ; ./format-results.sh ${REPORT_FILE}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright Contributors to the Open Cluster Management project | ||
# Licensed under the Apache License 2.0 | ||
|
||
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS builder | ||
|
||
WORKDIR /workspace | ||
COPY go.sum go.mod ./ | ||
COPY tools/simulator/alert-forward/main.go tools/simulator/alert-forward/main.go | ||
|
||
RUN CGO_ENABLED=1 go build -a -installsuffix cgo -o bin/alert-forwarder tools/simulator/alert-forward/main.go | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
||
ENV MAIN_BINARY=/usr/local/bin/alert-forwarder \ | ||
USER_UID=1001 \ | ||
USER_NAME=alert-forwarder | ||
|
||
# install the binary | ||
COPY --from=builder /workspace/bin/alert-forwarder ${MAIN_BINARY} | ||
COPY tools/simulator/alert-forward/alerts.json /tmp/ | ||
|
||
USER ${USER_UID} | ||
|
||
ENTRYPOINT ["/usr/local/bin/alert-forwarder"] | ||
|
Oops, something went wrong.