k8s-bootstrap.yaml 1.28 KB
apiVersion: batch/v1
kind: Job
metadata:
  name: k8s-bootstrap
  namespace: kube-system
spec:
  template:
    spec:
      restartPolicy: OnFailure
      securityContext:
        runAsUser: 1234
        runAsGroup: 1234
        fsGroup: 1234

        tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/master

      volumes:
        - name: git-storage
          emptyDir: {}
        - name: cluster-ssh-key
          secret:
            name: cluster-ssh-key
            defaultMode: 0600

      initContainers:
        - name: clone-k8s-start-of-day
          image: bitnami/git
          volumeMounts:
            - name: cluster-ssh-key
              mountPath: /tmp/cluster-ssh-key
            - name: git-storage
              mountPath: /tmp/git-storage
          command: |
            #!/bin/sh
            set -ex
            GIT_SSH_COMMAND="ssh -i /tmp/cluster-ssh-key/ssh-private-key"
            git clone git@gitlab.brainfood.com:brainfood/k8s-start-of-day.git /tmp/git-storage/k8s-start-of-day


      containers:
        - name: show-status
          image: bash
          command: |
            #!/bin/sh
            set -ex
            ls -al /tmp/git-storage
          volumeMounts:
            - name: git-storage
              mountPath: /tmp/git-storage