apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: s3bucket
  namespace: default
  labels:
    k8s-app: s3bucket
spec:
  selector:
    matchLabels:
      name: s3bucket
  template:
    metadata:
      annotations:
        cni: "flannel"
      labels:
        name: s3bucket
    spec:
      containers:
        - name: s3fs
          image: ipfs/testground:s3fs
          imagePullPolicy: Always
          securityContext:
            privileged: true
          env:
            - name: AWS_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  name: assets-s3-bucket
                  key: access-key
            - name: AWS_SECRET_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: assets-s3-bucket
                  key: secret-key
            - name: S3_BUCKET
              valueFrom:
                secretKeyRef:
                  name: assets-s3-bucket
                  key: bucket-name
            - name: MNT_POINT
              value: "/s3fs-mount"
            - name: S3_ENDPOINT
              value: "https://s3.eu-central-1.amazonaws.com:443"
            - name: S3_EXTRAVARS
              value: ",use_path_request_style"
          volumeMounts:
            - name: s3-shared
              mountPath: /s3fs-mount
              mountPropagation: Bidirectional
      volumes:
      - name: s3-shared
        hostPath:
          path: /mnt
          type: DirectoryOrCreate
