Drop the configure init container from Mailroom, Exporter and Pages
What does this MR do?
First step of the plan in #6745: remove the configure init container from Mailroom, GitLab Exporter and GitLab Pages.
Goal
- Drop the
configurecontainer that neededgitlab-base. Theconfigureinit containers run a shell script from thegitlab-baseimage. Without them, these Pods no longer need thegitlab-baseimage. - No copy at Pod start. The init container copied the Secrets into an
emptyDironce, at Pod start. The main containers now read the projected volumes directly. The components still read the files only at startup, so Secret changes still need a Pod restart.
Before and after
flowchart LR
subgraph before["Before"]
direction LR
S1["Secrets and<br/>ConfigMaps"] --> P1["projected volume<br/>init-<x>-secrets"]
P1 -- "/init-config" --> C1["configure init container<br/>sh script from gitlab-base"]
C1 -- "copies once<br/>at Pod start" --> E1["emptyDir<br/><x>-secrets"]
E1 -- "read-only" --> M1["main container"]
end
subgraph after["After"]
direction LR
S2["Secrets and<br/>ConfigMaps"] --> P2["projected volume<br/><x>-secrets"]
P2 -- "read-only" --> M2["main container"]
endThe main container mounts <x>-secrets at the same path in both cases, so it reads the same files.
The configure script only copies files
All three scripts are rendered from the shared helper gitlab.scripts.configure.secrets. For each directory name, it runs mkdir -p and cp -f -v -r -L /init-config/<name>/. /init-secrets/<name>/. It skips optional names whose directory doesn't exist. It doesn't template, rename, generate, or change any file.
- Mailroom:
configmap.yaml#L152-153, requiredmailroom, optionalredis redis-sentinel. - GitLab Exporter:
configmap.yaml#L102-103, optionalredis redis-sentinel postgres gitlab-exporter. - GitLab Pages:
configmap.yml#L181-187, requiredpages, plus two plaincp -Lfor the metrics TLS certificate and key.
Rendered Mailroom script on master
# BEGIN gitlab.scripts.configure.secrets
set -e
config_dir="/init-config"
secret_dir="/init-secrets"
# required
for secret in mailroom ; do
mkdir -p "${secret_dir}/${secret}"
cp -f -v -r -L "${config_dir}/${secret}/." "${secret_dir}/${secret}/"
done
# optional
for secret in redis redis-sentinel ; do
if [ -e "${config_dir}/${secret}" ]; then
mkdir -p "${secret_dir}/${secret}"
cp -f -v -r -L "${config_dir}/${secret}/." "${secret_dir}/${secret}/"
fi
done
# END gitlab.scripts.configure.secretsRendered Pages script on master (metrics TLS enabled)
# BEGIN gitlab.scripts.configure.secrets
set -e
config_dir="/init-config"
secret_dir="/init-secrets"
# required
for secret in pages ; do
mkdir -p "${secret_dir}/${secret}"
cp -f -v -r -L "${config_dir}/${secret}/." "${secret_dir}/${secret}/"
done
# END gitlab.scripts.configure.secrets
mkdir -p /init-secrets/pages-metrics
cp -v -L /init-config/pages-metrics/pages-metrics.crt /init-secrets/pages-metrics/pages-metrics.crt
cp -v -L /init-config/pages-metrics/pages-metrics.key /init-secrets/pages-metrics/pages-metrics.keyA comparison of helm template output from master (732344da) with this branch confirmed this for all three Deployments, with default values and with unconsolidated object storage:
- The new
<x>-secretsprojected volume equals master'sinit-<x>-secretsvolume except for its name, and for Pages, the removedobjectstorage/pagesitem (see below). - The main container's
volumeMountsare unchanged. - Running master's rendered scripts against the source volume staged the same files that the projected volume now provides: Mailroom 6 files, Exporter 3, and Pages 3 with metrics TLS.
The files differ only in their owner: the emptyDir copies were owned by the container user (git:git), the projected files are owned by root:<fsGroup>. The mode is 0440 in both cases. The mount now also has the projected ..data symlink layout.
@WarheadsSE also deployed base and head side by side in k3d: the main containers see the same files with the same content.
Changes
Each chart mounts the projected volume directly, under the former emptyDir name.
- GitLab Exporter also drops the PostgreSQL SSL volume. Only the
configurecontainer mounted it, and its script never read it. - GitLab Pages no longer gets the Pages object storage connection. Master projected it into
init-pages-secrets, but the script never copied it, and Pages doesn't read it. Only Rails does, from its own mount. A spec checks thatpages-secretshas noobjectstorage/item. - The
init.imagevalues and their documentation rows are removed, as nothing uses them anymore.init.resourcesandinit.containerSecurityContextstay, because thecertificatesinit container uses them. - The 10.6.0 upgrade notes describe the visible changes: these charts no longer have an
init.imagesetting, the Pods still need anfsGroup, and Secret changes still need a Pod restart.
The shared shell helpers are removed in the final cleanup MR of the plan.
Related issues
Related to #6745
Author checklist
For general guidance, please follow our Contributing guide.
Required
For anything in this list which will not be completed, please provide a reason in the MR discussion.
- Merge Request Title and Description are up to date, accurate, and descriptive.
- MR targeting the appropriate branch.
- MR has a green pipeline.
- Documentation created/updated.
- Tests added/updated.
- Have you validated that your change works end-to-end on a real cluster deployment?
- The same templates were deployed in kind as part of !5555 (closed). The Exporter ran there, and the files mounted in each container matched what the configure scripts staged.
- Equivalent MR/issue for omnibus-gitlab opened. Not applicable.
- When ready for review, MR is marked as ready (not a draft) and assigned to a reviewer.
Reviewers checklist
- As soon as you begin reviewing, select Start a review on your first comment so the MR shows Reviewer started review.
- MR has a green pipeline on https://gitlab.com/gitlab-org/charts/gitlab.
- Consider downstream impact to the Operator, as per evaluating impact from changes to GitLab chart.