Skip to content

Julien ben/ar push staging #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: atomic-releases
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public/architectures/**/secrets/*

docker/mongodb-kubernetes-appdb/content/readinessprobe
mongodb-kubernetes
docker/mongodb-kubernetes-operator/Dockerfile
docker/mongodb-kubernetes-database/Dockerfile
docker/mongodb-enterprise-ops-manager/Dockerfile
docker/mongodb-kubernetes-init-database/Dockerfile
docker/mongodb-kubernetes-init-ops-manager/Dockerfile
docker/mongodb-kubernetes-operator/content/mongodb-kubernetes-operator.tar
docker/mongodb-kubernetes-tests/helm_chart/
docker/mongodb-kubernetes-tests/public/
Expand Down
13 changes: 11 additions & 2 deletions docker/mongodb-agent-non-matrix/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
ARG imagebase
FROM ${imagebase} as base
FROM scratch AS base

ARG agent_version
ARG agent_distro
ARG tools_version
ARG tools_distro

ADD https://mciuploads.s3.amazonaws.com/mms-automation/mongodb-mms-build-agent/builds/automation-agent/prod/mongodb-mms-automation-agent-${agent_version}.${agent_distro}.tar.gz /data/mongodb-agent.tar.gz
ADD https://downloads.mongodb.org/tools/db/mongodb-database-tools-${tools_distro}-${tools_version}.tgz /data/mongodb-tools.tgz

COPY ./docker/mongodb-kubernetes-init-database/content/LICENSE /data/LICENSE

FROM registry.access.redhat.com/ubi9/ubi-minimal

Expand Down
17 changes: 17 additions & 0 deletions docker/mongodb-agent-non-matrix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### Building locally

For building the MongoDB Agent (non-static) image locally use the example command:

TODO: What to do with label quay.expires-after=48h?
```bash
AGENT_VERSION="108.0.7.8810-1"
TOOLS_VERSION="100.12.0"
AGENT_DISTRO="rhel9_x86_64"
TOOLS_DISTRO="rhel93-x86_64"
docker buildx build --load --progress plain . -f docker/mongodb-agent/Dockerfile -t "mongodb-agent:${AGENT_VERSION}" \
--build-arg version="${VERSION}" \
--build-arg agent_version="${AGENT_VERSION}" \
--build-arg tools_version="${TOOLS_VERSION}" \
--build-arg agent_distro="${AGENT_DISTRO}" \
--build-arg tools_distro="${TOOLS_DISTRO}"
```
39 changes: 37 additions & 2 deletions docker/mongodb-agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
ARG imagebase
FROM ${imagebase} as base
# the init database image gets supplied by pipeline.py and corresponds to the operator version we want to release
# the agent with. This enables us to release the agent for older operator.
ARG init_database_image
FROM ${init_database_image} AS init_database

FROM public.ecr.aws/docker/library/golang:1.24 AS dependency_downloader

WORKDIR /go/src/github.com/mongodb/mongodb-kubernetes/

COPY go.mod go.sum ./

RUN go mod download

FROM public.ecr.aws/docker/library/golang:1.24 AS readiness_builder

WORKDIR /go/src/github.com/mongodb/mongodb-kubernetes/

COPY --from=dependency_downloader /go/pkg /go/pkg
COPY . /go/src/github.com/mongodb/mongodb-kubernetes

RUN CGO_ENABLED=0 GOFLAGS=-buildvcs=false go build -o /readinessprobe ./mongodb-community-operator/cmd/readiness/main.go
RUN CGO_ENABLED=0 GOFLAGS=-buildvcs=false go build -o /version-upgrade-hook ./mongodb-community-operator/cmd/versionhook/main.go

FROM scratch AS base
ARG mongodb_tools_url_ubi
ARG mongodb_agent_url_ubi

COPY --from=readiness_builder /readinessprobe /data/
COPY --from=readiness_builder /version-upgrade-hook /data/

ADD ${mongodb_tools_url_ubi} /data/mongodb_tools_ubi.tgz
ADD ${mongodb_agent_url_ubi} /data/mongodb_agent_ubi.tgz

COPY --from=init_database /probes/probe.sh /data/probe.sh
COPY --from=init_database /scripts/agent-launcher-lib.sh /data/
COPY --from=init_database /scripts/agent-launcher.sh /data/
COPY --from=init_database /licenses/LICENSE /data/

FROM registry.access.redhat.com/ubi9/ubi-minimal

Expand Down
20 changes: 18 additions & 2 deletions docker/mongodb-agent/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# Mongodb-Agent
The agent gets released in a matrix style with the init-database image, which gets tagged with the operator version.
This works by using the multi-stage pattern and build-args. First - retrieve the `init-database:<version>` and retrieve the
binaries from there. Then we continue with the other steps to fully build the image.
This works by using the multi-stage pattern and build-args. First - retrieve the `init-database:<version>` and retrieve the
binaries from there. Then we continue with the other steps to fully build the image.

### Building locally

For building the MongoDB Agent image locally use the example command:

```bash
VERSION="108.0.7.8810-1"
INIT_DATABASE_IMAGE="268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-database:1.1.0"
MONGODB_TOOLS_URL_UBI="https://downloads.mongodb.org/tools/db/mongodb-database-tools-rhel93-x86_64-100.12.0.tgz"
MONGODB_AGENT_URL_UBI="https://mciuploads.s3.amazonaws.com/mms-automation/mongodb-mms-build-agent/builds/automation-agent/prod/mongodb-mms-automation-agent-108.0.7.8810-1.rhel9_x86_64.tar.gz"
docker buildx build --load --progress plain . -f docker/mongodb-agent/Dockerfile -t "mongodb-agent:${VERSION}_1.1.0" \
--build-arg version="${VERSION}" \
--build-arg init_database_image="${INIT_DATABASE_IMAGE}" \
--build-arg mongodb_tools_url_ubi="${MONGODB_TOOLS_URL_UBI}" \
--build-arg mongodb_agent_url_ubi="${MONGODB_AGENT_URL_UBI}"
```
95 changes: 95 additions & 0 deletions docker/mongodb-enterprise-ops-manager/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Build compilable stuff

FROM public.ecr.aws/docker/library/golang:1.24 AS readiness_builder
COPY . /go/src/github.com/mongodb/mongodb-kubernetes
WORKDIR /go/src/github.com/mongodb/mongodb-kubernetes

RUN CGO_ENABLED=0 go build -a -buildvcs=false -o /data/scripts/mmsconfiguration ./docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration/edit_mms_configuration.go
RUN CGO_ENABLED=0 go build -a -buildvcs=false -o /data/scripts/backup-daemon-readiness-probe ./docker/mongodb-kubernetes-init-ops-manager/backupdaemon_readinessprobe/backupdaemon_readiness.go

# Move binaries and scripts
FROM scratch AS base

COPY --from=readiness_builder /data/scripts/mmsconfiguration /data/scripts/mmsconfiguration
COPY --from=readiness_builder /data/scripts/backup-daemon-readiness-probe /data/scripts/backup-daemon-readiness-probe

# After v2.0, when non-Static Agent images will be removed, please ensure to copy those files
# into ./docker/mongodb-enterprise-ops-manager directory. Leaving it this way will make the maintenance easier.
COPY ./docker/mongodb-kubernetes-init-ops-manager/scripts/docker-entry-point.sh /data/scripts
COPY ./docker/mongodb-kubernetes-init-ops-manager/scripts/backup-daemon-liveness-probe.sh /data/scripts
COPY ./docker/mongodb-kubernetes-init-ops-manager/LICENSE /data/licenses/mongodb-enterprise-ops-manager

FROM registry.access.redhat.com/ubi9/ubi-minimal

ARG version
ARG om_download_url

LABEL name="MongoDB Enterprise Ops Manager" \
maintainer="[email protected]" \
vendor="MongoDB" \
version=${version} \
release="1" \
summary="MongoDB Enterprise Ops Manager Image" \
description="MongoDB Enterprise Ops Manager"

ENV MMS_HOME=/mongodb-ops-manager
ENV MMS_PROP_FILE=${MMS_HOME}/conf/conf-mms.properties
ENV MMS_CONF_FILE=${MMS_HOME}/conf/mms.conf
ENV MMS_LOG_DIR=${MMS_HOME}/logs
ENV MMS_TMP_DIR=${MMS_HOME}/tmp

EXPOSE 8080

# OpsManager docker image needs to have the MongoDB dependencies because the
# backup daemon is running its database locally

# Replace libcurl-minimal and curl-minimal with the full versions
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
RUN microdnf install -y libssh libpsl libbrotli \
&& microdnf download curl libcurl \
&& rpm -Uvh --nodeps --replacefiles "*curl*$( uname -i ).rpm" \
&& microdnf remove -y libcurl-minimal curl-minimal

RUN microdnf install --disableplugin=subscription-manager -y \
cyrus-sasl \
cyrus-sasl-gssapi \
cyrus-sasl-plain \
krb5-libs \
libpcap \
lm_sensors-libs \
net-snmp \
net-snmp-agent-libs \
openldap \
openssl \
tar \
rpm-libs \
net-tools \
procps-ng \
ncurses

COPY --from=base /data/licenses /licenses/
COPY --from=base /data/scripts /opt/scripts

RUN curl --fail -L -o ops_manager.tar.gz ${om_download_url} \
&& tar -xzf ops_manager.tar.gz \
&& rm ops_manager.tar.gz \
&& mv mongodb-mms* "${MMS_HOME}"

# permissions
RUN chmod -R 0777 "${MMS_LOG_DIR}" \
&& chmod -R 0777 "${MMS_TMP_DIR}" \
&& chmod -R 0775 "${MMS_HOME}/conf" \
&& chmod -R 0775 "${MMS_HOME}/jdk" \
&& mkdir "${MMS_HOME}/mongodb-releases/" \
&& chmod -R 0775 "${MMS_HOME}/mongodb-releases" \
&& chmod -R 0777 "${MMS_CONF_FILE}" \
&& chmod -R 0777 "${MMS_PROP_FILE}"

# The "${MMS_HOME}/conf" will be populated by the docker-entry-point.sh.
# For now we need to move into the templates directory.
RUN cp -r "${MMS_HOME}/conf" "${MMS_HOME}/conf-template"

USER 2000

# operator to change the entrypoint to: /mongodb-ops-manager/bin/mongodb-mms start_mms (or a wrapper around this)
ENTRYPOINT [ "sleep infinity" ]
25 changes: 0 additions & 25 deletions docker/mongodb-enterprise-ops-manager/Dockerfile.dcar

This file was deleted.

84 changes: 84 additions & 0 deletions docker/mongodb-enterprise-ops-manager/Dockerfile.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
ARG imagebase
FROM ${imagebase} as base

FROM registry.access.redhat.com/ubi9/ubi-minimal


LABEL name="MongoDB Enterprise Ops Manager" \
maintainer="[email protected]" \
vendor="MongoDB" \
version="8.0.7" \
release="1" \
summary="MongoDB Enterprise Ops Manager Image" \
description="MongoDB Enterprise Ops Manager"


ENV MMS_HOME /mongodb-ops-manager
ENV MMS_PROP_FILE ${MMS_HOME}/conf/conf-mms.properties
ENV MMS_CONF_FILE ${MMS_HOME}/conf/mms.conf
ENV MMS_LOG_DIR ${MMS_HOME}/logs
ENV MMS_TMP_DIR ${MMS_HOME}/tmp

EXPOSE 8080

# OpsManager docker image needs to have the MongoDB dependencies because the
# backup daemon is running its database locally


# Replace libcurl-minimal and curl-minimal with the full versions
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
RUN microdnf install -y libssh libpsl libbrotli \
&& microdnf download curl libcurl \
&& rpm -Uvh --nodeps --replacefiles "*curl*$( uname -i ).rpm" \
&& microdnf remove -y libcurl-minimal curl-minimal

RUN microdnf install --disableplugin=subscription-manager -y \
cyrus-sasl \
cyrus-sasl-gssapi \
cyrus-sasl-plain \
krb5-libs \
libpcap \
lm_sensors-libs \
net-snmp \
net-snmp-agent-libs \
openldap \
openssl \
tar \
rpm-libs \
net-tools \
procps-ng \
ncurses


COPY --from=base /data/licenses /licenses/

COPY --from=base /data/scripts /opt/scripts



RUN curl --fail -L -o ops_manager.tar.gz https://downloads.mongodb.com/on-prem-mms/tar/mongodb-mms-8.0.7.500.20250505T1426Z.tar.gz \
&& tar -xzf ops_manager.tar.gz \
&& rm ops_manager.tar.gz \
&& mv mongodb-mms* "${MMS_HOME}"


# permissions
RUN chmod -R 0777 "${MMS_LOG_DIR}" \
&& chmod -R 0777 "${MMS_TMP_DIR}" \
&& chmod -R 0775 "${MMS_HOME}/conf" \
&& chmod -R 0775 "${MMS_HOME}/jdk" \
&& mkdir "${MMS_HOME}/mongodb-releases/" \
&& chmod -R 0775 "${MMS_HOME}/mongodb-releases" \
&& chmod -R 0777 "${MMS_CONF_FILE}" \
&& chmod -R 0777 "${MMS_PROP_FILE}"

# The "${MMS_HOME}/conf" will be populated by the docker-entry-point.sh.
# For now we need to move into the templates directory.
RUN cp -r "${MMS_HOME}/conf" "${MMS_HOME}/conf-template"

USER 2000

# operator to change the entrypoint to: /mongodb-ops-manager/bin/mongodb-mms start_mms (or a wrapper around this)
ENTRYPOINT [ "sleep infinity" ]


3 changes: 0 additions & 3 deletions docker/mongodb-enterprise-ops-manager/LICENSE

This file was deleted.

11 changes: 11 additions & 0 deletions docker/mongodb-enterprise-ops-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Building locally

For building the MongoDB Enterprise Ops Manager Docker image locally use the example command:

```bash
VERSION="8.0.7"
OM_DOWNLOAD_URL="https://downloads.mongodb.com/on-prem-mms/tar/mongodb-mms-8.0.7.500.20250505T1426Z.tar.gz"
docker buildx build --load --progress plain . -f docker/mongodb-enterprise-ops-manager/Dockerfile -t "mongodb-enterprise-ops-manager:${VERSION}" \
--build-arg version="${VERSION}" \
--build-arg om_download_url="${OM_DOWNLOAD_URL}"
```
Loading