apiVersion: apps/v1 kind: DaemonSet metadata: name: jemalloc-builder namespace: gitlab labels: app: jemalloc-builder spec: selector: matchLabels: app: jemalloc-builder template: metadata: labels: app: jemalloc-builder spec: tolerations: - operator: Exists initContainers: - name: build image: alpine:latest command: - sh - -c - | set -e TARGET=/hostlib/libjemalloc.so.2 if [ -f "$TARGET" ]; then echo "Already built at $TARGET — skipping." exit 0 fi echo "Installing build tools..." apk add --no-cache gcc musl-dev make wget autoconf 2>&1 cd /tmp echo "Downloading jemalloc 5.3.0..." wget -q -O jemalloc.tar.bz2 \ https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2 tar xf jemalloc.tar.bz2 cd jemalloc-5.3.0 echo "Configuring with --with-lg-page=14 (16KB page support)..." ./configure --with-lg-page=14 --disable-stats --disable-prof --disable-fill 2>&1 echo "Building..." make -j2 lib/libjemalloc.so.2 2>&1 cp lib/libjemalloc.so.2 "$TARGET" chmod 755 "$TARGET" echo "Done: $(ls -lh $TARGET)" volumeMounts: - name: hostlib mountPath: /hostlib containers: - name: keepalive image: alpine:latest command: [sh, -c, "echo 'jemalloc ready at /opt/gitlab-jemalloc/libjemalloc.so.2'; sleep infinity"] volumeMounts: - name: hostlib mountPath: /hostlib volumes: - name: hostlib hostPath: path: /opt/gitlab-jemalloc type: DirectoryOrCreate