#!/usr/bin/env bash set -euo pipefail export KUBECONFIG=/Users/chrisfu/dev/knoe/knoe-k3s.kubeconfig kubectl -n gitlab delete daemonset jemalloc-builder --ignore-not-found sleep 5 kubectl apply -f - <<'DS' 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: ubuntu:22.04 command: - bash - -c - | set -e TARGET=/hostlib/libjemalloc.so.2 if [ -f "$TARGET" ]; then echo "Already built"; exit 0; fi apt-get update -qq && apt-get install -y -q gcc make wget bzip2 2>&1 cd /tmp wget -q -O jemalloc.tar.bz2 \ https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2 tar xjf jemalloc.tar.bz2 && cd jemalloc-5.3.0 ./configure --with-lg-page=14 --disable-stats --disable-prof --disable-fill 2>&1 make -j2 lib/libjemalloc.so.2 2>&1 cp lib/libjemalloc.so.2 "$TARGET" && chmod 755 "$TARGET" file "$TARGET" && echo "Done: $(ls -lh $TARGET)" volumeMounts: - name: hostlib mountPath: /hostlib containers: - name: keepalive image: ubuntu:22.04 command: [bash, -c, "echo 'glibc jemalloc-16k ready'; sleep infinity"] volumes: - name: hostlib hostPath: path: /opt/gitlab-jemalloc type: DirectoryOrCreate DS echo "DaemonSet applied. Waiting 15min for builds to complete..." sleep 900 kubectl -n gitlab get pods -l app=jemalloc-builder