Skip to content

Commit dd3345b

Browse files
committed
Merge branch 'master' into maciejk/ar-image-staging
2 parents 29aa352 + 7853899 commit dd3345b

File tree

13 files changed

+210
-74
lines changed

13 files changed

+210
-74
lines changed

docker/mongodb-agent/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ RUN mkdir -p /agent \
8585
&& chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
8686

8787
# Copy scripts to a safe location that won't be overwritten by volume mount
88-
COPY ./docker/mongodb-kubernetes-init-database/content/LICENSE /data/LICENSE
88+
COPY ./docker/mongodb-kubernetes-init-database/content/LICENSE /licenses/LICENSE
8989
COPY ./docker/mongodb-agent/agent-launcher-shim.sh /usr/local/bin/agent-launcher-shim.sh
9090
COPY ./docker/mongodb-agent/setup-agent-files.sh /usr/local/bin/setup-agent-files.sh
9191
COPY ./docker/mongodb-agent/dummy-probe.sh /usr/local/bin/dummy-probe.sh
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export K8S_CTX="${CLUSTER_NAME}"
22

3-
export PRERELEASE_VERSION="1.4.0-prerelease-68b5c0bb136a0d0007a4c8a2"
4-
5-
export PRERELEASE_IMAGE_PULLSECRET="${PRERELEASE_PULLSECRET_DOCKERCONFIGJSON}"
6-
export OPERATOR_ADDITIONAL_HELM_VALUES="registry.imagePullSecrets=prerelease-image-pullsecret"
7-
export OPERATOR_HELM_CHART="oci://quay.io/mongodb/staging/helm-chart/mongodb-kubernetes:${PRERELEASE_VERSION}"
3+
export PRERELEASE_IMAGE_PULLSECRET=""
4+
export OPERATOR_ADDITIONAL_HELM_VALUES=""
5+
export OPERATOR_HELM_CHART=${PROJECT_DIR}/helm_chart

docs/search/02-search-enterprise-deploy/env_variables_e2e_prerelease.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
export K8S_CTX="${CLUSTER_NAME}"
22

3-
export PRERELEASE_VERSION="1.4.0-prerelease-68b9584ac0a75a00070384a0"
4-
5-
export PRERELEASE_IMAGE_PULLSECRET="${PRERELEASE_PULLSECRET_DOCKERCONFIGJSON}"
6-
export OPERATOR_ADDITIONAL_HELM_VALUES="registry.imagePullSecrets=prerelease-image-pullsecret"
7-
export OPERATOR_HELM_CHART="oci://quay.io/mongodb/staging/helm-chart/mongodb-kubernetes:${PRERELEASE_VERSION}"
3+
export PRERELEASE_IMAGE_PULLSECRET=""
4+
export OPERATOR_ADDITIONAL_HELM_VALUES=""
5+
export OPERATOR_HELM_CHART=${PROJECT_DIR}/helm_chart
86

97
# we need project name with a timestamp (NAMESPACE in evg is randomized) to allow for cloud-qa cleanups
108
export OPS_MANAGER_PROJECT_NAME="${NAMESPACE}-${MDB_RESOURCE_NAME}"
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export K8S_CTX="${CLUSTER_NAME}"
22

3-
export OPERATOR_ADDITIONAL_HELM_VALUES=""
4-
export OPERATOR_HELM_CHART="${PROJECT_DIR}/helm_chart"
3+
export OPERATOR_HELM_CHART=${PROJECT_DIR}/helm_chart

public/architectures/setup-multi-cluster/ra-09-setup-externaldns/env_variables.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
# ${K8S_CLUSTER_2_CONTEXT_NAME}
1313
# ${MDB_GKE_PROJECT}
1414

15-
# Example K8S_CLUSTER_SUFFIX when running in evg: "-68c1dc3ffdfb5800075ecee0-26080"
1615
suffix_short="${K8S_CLUSTER_SUFFIX}"
17-
# Ensure suffix_short is no longer than 19 characters to make DNS_SA_NAME fit max 30 characters
16+
# Ensure suffix_short is no longer than 19 characters to make GKE identifiers fit under 30 characters
1817
if [[ -n "${suffix_short}" && ${#suffix_short} -gt 19 ]]; then
1918
# Calculate positions for cutting from the middle
2019
prefix_len=$(((19 - 1) / 2)) # -1 for the 'x' replacement
@@ -27,4 +26,4 @@ export DNS_SA_NAME="ext-dns-sa${suffix_short}"
2726
export DNS_SA_EMAIL="${DNS_SA_NAME}@${MDB_GKE_PROJECT}.iam.gserviceaccount.com"
2827

2928
export CUSTOM_DOMAIN="mongodb.custom"
30-
export DNS_ZONE="mongodb"
29+
export DNS_ZONE="mongodb${suffix_short}"
Lines changed: 76 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,60 @@
1-
ARG imagebase
2-
FROM ${imagebase} as base
1+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS tools_downloader
32

4-
FROM registry.access.redhat.com/ubi9/ubi-minimal
3+
ARG TARGETPLATFORM
4+
ARG mongodb_tools_url
5+
ARG mongodb_tools_version_s390x
6+
ARG mongodb_tools_version_ppc64le
7+
ARG mongodb_tools_version_amd64
8+
ARG mongodb_tools_version_arm64
59

6-
ARG version
10+
RUN microdnf -y update --nodocs \
11+
&& microdnf -y install --nodocs tar gzip \
12+
&& microdnf clean all
713

8-
LABEL name="MongoDB Agent" \
9-
version="${version}" \
10-
summary="MongoDB Agent" \
11-
description="MongoDB Agent" \
12-
vendor="MongoDB" \
13-
release="1" \
14-
maintainer="[email protected]"
14+
RUN case ${TARGETPLATFORM} in \
15+
"linux/amd64") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_amd64} ;; \
16+
"linux/arm64") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_arm64} ;; \
17+
"linux/s390x") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_s390x} ;; \
18+
"linux/ppc64le") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_ppc64le} ;; \
19+
esac \
20+
&& mkdir -p /tools \
21+
&& curl -o /tools/mongodb_tools.tgz "${mongodb_tools_url}/${MONGODB_TOOLS_VERSION}"
22+
23+
RUN tar xfz /tools/mongodb_tools.tgz \
24+
&& mv mongodb-database-tools-*/bin/* /tools \
25+
&& chmod +x /tools/* \
26+
&& rm /tools/mongodb_tools.tgz \
27+
&& rm -r mongodb-database-tools-*
28+
29+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS agent_downloader
30+
31+
ARG TARGETPLATFORM
32+
ARG mongodb_agent_url
33+
ARG mongodb_agent_version_s390x
34+
ARG mongodb_agent_version_ppc64le
35+
ARG mongodb_agent_version_amd64
36+
ARG mongodb_agent_version_arm64
37+
38+
RUN microdnf -y update --nodocs \
39+
&& microdnf -y install --nodocs tar gzip \
40+
&& microdnf clean all
41+
42+
RUN case ${TARGETPLATFORM} in \
43+
"linux/amd64") export MONGODB_AGENT_VERSION=${mongodb_agent_version_amd64} ;; \
44+
"linux/arm64") export MONGODB_AGENT_VERSION=${mongodb_agent_version_arm64} ;; \
45+
"linux/s390x") export MONGODB_AGENT_VERSION=${mongodb_agent_version_s390x} ;; \
46+
"linux/ppc64le") export MONGODB_AGENT_VERSION=${mongodb_agent_version_ppc64le} ;; \
47+
esac \
48+
&& mkdir -p /agent \
49+
&& curl -o /agent/mongodb_agent.tgz "${mongodb_agent_url}/${MONGODB_AGENT_VERSION}"
50+
51+
RUN tar xfz /agent/mongodb_agent.tgz \
52+
&& mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
53+
&& chmod +x /agent/mongodb-agent \
54+
&& rm /agent/mongodb_agent.tgz \
55+
&& rm -r mongodb-mms-automation-agent-*
56+
57+
FROM registry.access.redhat.com/ubi9/ubi-minimal
1558

1659
# Replace libcurl-minimal and curl-minimal with the full versions
1760
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
@@ -41,20 +84,30 @@ RUN mkdir -p /agent \
4184
&& touch /var/log/mongodb-mms-automation/readiness.log \
4285
&& chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
4386

87+
# Copy scripts to a safe location that won't be overwritten by volume mount
88+
COPY ./docker/mongodb-kubernetes-init-database/content/LICENSE /licenses/LICENSE
89+
COPY ./docker/mongodb-agent/agent-launcher-shim.sh /usr/local/bin/agent-launcher-shim.sh
90+
COPY ./docker/mongodb-agent/setup-agent-files.sh /usr/local/bin/setup-agent-files.sh
91+
COPY ./docker/mongodb-agent/dummy-probe.sh /usr/local/bin/dummy-probe.sh
92+
COPY ./docker/mongodb-agent/dummy-readinessprobe /usr/local/bin/dummy-readinessprobe
4493

45-
COPY --from=base /data/mongodb-agent.tar.gz /agent
46-
COPY --from=base /data/mongodb-tools.tgz /agent
47-
COPY --from=base /data/LICENSE /licenses/LICENSE
94+
RUN mkdir -p /var/lib/automation/config \
95+
&& chmod -R +r /var/lib/automation/config
4896

49-
RUN tar xfz /agent/mongodb-agent.tar.gz \
50-
&& mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
51-
&& chmod +x /agent/mongodb-agent \
52-
&& mkdir -p /var/lib/automation/config \
53-
&& chmod -R +r /var/lib/automation/config \
54-
&& rm /agent/mongodb-agent.tar.gz \
55-
&& rm -r mongodb-mms-automation-agent-*
97+
RUN mkdir -p /tools /agent
98+
99+
COPY --from=tools_downloader "/tools/" /tools/
100+
COPY --from=agent_downloader "/agent/" /agent/
101+
102+
ARG version
56103

57-
RUN tar xfz /agent/mongodb-tools.tgz --directory /var/lib/mongodb-mms-automation/ && rm /agent/mongodb-tools.tgz
104+
LABEL name="MongoDB Agent" \
105+
version="${version}" \
106+
summary="MongoDB Agent" \
107+
description="MongoDB Agent" \
108+
vendor="MongoDB" \
109+
release="1" \
110+
maintainer="[email protected]"
58111

59112
USER 2000
60-
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]
113+
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]
Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,60 @@
1-
ARG imagebase
2-
FROM ${imagebase} as base
1+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS tools_downloader
32

4-
FROM registry.access.redhat.com/ubi9/ubi-minimal
3+
ARG TARGETPLATFORM
4+
ARG mongodb_tools_url
5+
ARG mongodb_tools_version_s390x
6+
ARG mongodb_tools_version_ppc64le
7+
ARG mongodb_tools_version_amd64
8+
ARG mongodb_tools_version_arm64
59

6-
ARG version
10+
RUN microdnf -y update --nodocs \
11+
&& microdnf -y install --nodocs tar gzip \
12+
&& microdnf clean all
713

8-
LABEL name="MongoDB Agent" \
9-
version="${version}" \
10-
summary="MongoDB Agent" \
11-
description="MongoDB Agent" \
12-
vendor="MongoDB" \
13-
release="1" \
14-
maintainer="[email protected]"
14+
RUN case ${TARGETPLATFORM} in \
15+
"linux/amd64") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_amd64} ;; \
16+
"linux/arm64") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_arm64} ;; \
17+
"linux/s390x") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_s390x} ;; \
18+
"linux/ppc64le") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_ppc64le} ;; \
19+
esac \
20+
&& mkdir -p /tools \
21+
&& curl -o /tools/mongodb_tools.tgz "${mongodb_tools_url}/${MONGODB_TOOLS_VERSION}"
22+
23+
RUN tar xfz /tools/mongodb_tools.tgz \
24+
&& mv mongodb-database-tools-*/bin/* /tools \
25+
&& chmod +x /tools/* \
26+
&& rm /tools/mongodb_tools.tgz \
27+
&& rm -r mongodb-database-tools-*
28+
29+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS agent_downloader
30+
31+
ARG TARGETPLATFORM
32+
ARG mongodb_agent_url
33+
ARG mongodb_agent_version_s390x
34+
ARG mongodb_agent_version_ppc64le
35+
ARG mongodb_agent_version_amd64
36+
ARG mongodb_agent_version_arm64
37+
38+
RUN microdnf -y update --nodocs \
39+
&& microdnf -y install --nodocs tar gzip \
40+
&& microdnf clean all
41+
42+
RUN case ${TARGETPLATFORM} in \
43+
"linux/amd64") export MONGODB_AGENT_VERSION=${mongodb_agent_version_amd64} ;; \
44+
"linux/arm64") export MONGODB_AGENT_VERSION=${mongodb_agent_version_arm64} ;; \
45+
"linux/s390x") export MONGODB_AGENT_VERSION=${mongodb_agent_version_s390x} ;; \
46+
"linux/ppc64le") export MONGODB_AGENT_VERSION=${mongodb_agent_version_ppc64le} ;; \
47+
esac \
48+
&& mkdir -p /agent \
49+
&& curl -o /agent/mongodb_agent.tgz "${mongodb_agent_url}/${MONGODB_AGENT_VERSION}"
50+
51+
RUN tar xfz /agent/mongodb_agent.tgz \
52+
&& mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
53+
&& chmod +x /agent/mongodb-agent \
54+
&& rm /agent/mongodb_agent.tgz \
55+
&& rm -r mongodb-mms-automation-agent-*
56+
57+
FROM registry.access.redhat.com/ubi9/ubi-minimal
1558

1659
# Replace libcurl-minimal and curl-minimal with the full versions
1760
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
@@ -41,25 +84,30 @@ RUN mkdir -p /agent \
4184
&& touch /var/log/mongodb-mms-automation/readiness.log \
4285
&& chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
4386

44-
COPY --from=base /data/mongodb-agent.tar.gz /agent
45-
COPY --from=base /data/mongodb-tools.tgz /agent
46-
COPY --from=base /data/LICENSE /licenses/LICENSE
47-
4887
# Copy scripts to a safe location that won't be overwritten by volume mount
49-
COPY --from=base /opt/scripts/agent-launcher-shim.sh /usr/local/bin/agent-launcher-shim.sh
50-
COPY --from=base /opt/scripts/setup-agent-files.sh /usr/local/bin/setup-agent-files.sh
51-
COPY --from=base /opt/scripts/dummy-probe.sh /usr/local/bin/dummy-probe.sh
52-
COPY --from=base /opt/scripts/dummy-readinessprobe.sh /usr/local/bin/dummy-readinessprobe
88+
COPY ./docker/mongodb-kubernetes-init-database/content/LICENSE /licenses/LICENSE
89+
COPY ./docker/mongodb-agent/agent-launcher-shim.sh /usr/local/bin/agent-launcher-shim.sh
90+
COPY ./docker/mongodb-agent/setup-agent-files.sh /usr/local/bin/setup-agent-files.sh
91+
COPY ./docker/mongodb-agent/dummy-probe.sh /usr/local/bin/dummy-probe.sh
92+
COPY ./docker/mongodb-agent/dummy-readinessprobe /usr/local/bin/dummy-readinessprobe
5393

54-
RUN tar xfz /agent/mongodb-agent.tar.gz \
55-
&& mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
56-
&& chmod +x /agent/mongodb-agent \
57-
&& mkdir -p /var/lib/automation/config \
58-
&& chmod -R +r /var/lib/automation/config \
59-
&& rm /agent/mongodb-agent.tar.gz \
60-
&& rm -r mongodb-mms-automation-agent-*
94+
RUN mkdir -p /var/lib/automation/config \
95+
&& chmod -R +r /var/lib/automation/config
96+
97+
RUN mkdir -p /tools /agent
6198

62-
RUN tar xfz /agent/mongodb-tools.tgz --directory /var/lib/mongodb-mms-automation/ && rm /agent/mongodb-tools.tgz
99+
COPY --from=tools_downloader "/tools/" /tools/
100+
COPY --from=agent_downloader "/agent/" /agent/
101+
102+
ARG version
103+
104+
LABEL name="MongoDB Agent" \
105+
version="${version}" \
106+
summary="MongoDB Agent" \
107+
description="MongoDB Agent" \
108+
vendor="MongoDB" \
109+
release="1" \
110+
maintainer="[email protected]"
63111

64112
USER 2000
65-
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]
113+
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]

scripts/dev/contexts/funcs/gke

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Function to normalize identifier to contain only alphanumeric characters.
2+
# It's also cutting the string in the middle if exceeds max_len.
3+
# Example:
4+
# normalize_identifier "mongodb_kubernetes_1.4.0_68c913f767d52d00076a2698" 25 -> mongodb-kubex2d00076a2698
5+
normalize_identifier() {
6+
local str=$1
7+
local max_len=$(($2 - 1))
8+
9+
# Convert to lowercase and replace invalid characters with hyphens
10+
str=$(echo -n "${str}" | tr '[:upper:]_' '[:lower:]-' | sed 's/[^a-z0-9-]/-/g')
11+
# Ensure it ends with alphanumeric
12+
13+
# Truncate to ${max_len} chars by cutting from middle
14+
if [[ ${#str} -gt ${max_len} ]]; then
15+
half_idx=$((max_len / 2))
16+
local start_part="${str:0:${half_idx}}"
17+
local end_part="${str: -${half_idx}}"
18+
str="${start_part}x${end_part}"
19+
fi
20+
21+
[[ ${str} =~ -$ ]] && str="${str}0"
22+
echo -n "${str}"
23+
}
24+
25+
# for prerelease tag builds we have:
26+
# version_id=mongodb_kubernetes_1.4.0_68c913f767d52d00076a2698-9041 (len=54)
27+
# k8s cluster name prefix: k8s-mdb-0- (len=10)
28+
# random suffix: -1234 (len=5)
29+
# K8S_CLUSTER_PREFIX must be shorter than 25 to make the final
30+
# gke identifier shorter than 40 characters.
31+
create_k8s_cluster_suffix() {
32+
echo -n "$(normalize_identifier "${K8S_CLUSTER_SUFFIX:-"-${version_id}-${RANDOM}"}" 25)"
33+
}

scripts/dev/contexts/prerelease_gke_code_snippets

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}")
88
script_dir=$(dirname "${script_name}")
99

1010
source "${script_dir}/root-context"
11+
source "${script_dir}/funcs/gke"
12+
K8S_CLUSTER_SUFFIX="$(create_k8s_cluster_suffix)"
13+
export K8S_CLUSTER_SUFFIX
1114

1215
export MDB_GKE_PROJECT="scratch-kubernetes-team"
13-
export K8S_CLUSTER_SUFFIX="${K8S_CLUSTER_SUFFIX:-"-${version_id}-${RANDOM}"}"
16+
1417
export CODE_SNIPPETS_COMMIT_OUTPUT=true
1518

1619
# we reset evg host to use a default ~/.kube/config for GKE instead of the one from evg host

scripts/dev/contexts/prerelease_kind_code_snippets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# this context file is for code snippets running on GKE clusters
3+
# this context file is for code snippets running on kind clusters
44
set -Eeou pipefail
55

66
# overrides of public env_variables.sh
@@ -9,9 +9,9 @@ script_dir=$(dirname "${script_name}")
99

1010
source "${script_dir}/root-context"
1111

12-
export NAMESPACE=mongodb
1312
export CODE_SNIPPETS_FLAVOR=e2e_prerelease
1413
export CODE_SNIPPETS_COMMIT_OUTPUT=true
14+
export ops_manager_version="cloud_qa"
1515

1616
export ops_manager_version="cloud_qa"
1717

0 commit comments

Comments
 (0)