apiVersion: apps/v1
kind: Deployment
metadata:
  name: of-builder
  namespace: openfaas
  labels:
    app: of-builder
spec:
  replicas: 1
  selector:
    matchLabels:
      app: of-builder
  template:
    metadata:
      annotations:
        prometheus.io.scrape: "false"
      labels:
        app: of-builder
    spec:
      volumes:
        - name: registry-secret
          secret:
            defaultMode: 420
            secretName: registry-secret
        - name: payload-secret
          secret:
            defaultMode: 420
            secretName: payload-secret
      containers:
      - name: of-builder
        image: ghcr.io/openfaas/ofc-of-builder:0.14.4
        imagePullPolicy: Always
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
          initialDelaySeconds: 2
          periodSeconds: 10
          timeoutSeconds: 2
        env:
          - name: enable_lchown
            value: "true"
          - name: insecure
            value: "false"
          - name: buildkit_url  
            value: "tcp://127.0.0.1:1234"
          - name: "disable_hmac"
            value: "false"
        ports:
        - containerPort: 8080
          protocol: TCP
        volumeMounts:
        - name: registry-secret
          readOnly: true
          mountPath: "/home/app/.docker/"
        - name: payload-secret
          readOnly: true
          mountPath: "/var/openfaas/secrets/"
      - name: of-buildkit
        args: ["--addr", "tcp://0.0.0.0:1234"]
        image: moby/buildkit:v0.6.2
        imagePullPolicy: Always
        ports:
        - containerPort: 1234
          protocol: TCP
        securityContext:
          privileged: true
