apiVersion: v1 kind: ServiceAccount metadata: name: statefulset-demo namespace: default --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: statefulset-demo namespace: default roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: stash-sidecar subjects: - kind: ServiceAccount name: statefulset-demo namespace: default --- apiVersion: v1 data: RESTIC_PASSWORD: bm90QHNlY3JldA== kind: Secret metadata: name: statefulset-secret namespace: default type: Opaque --- apiVersion: stash.appscode.com/v1alpha1 kind: Restic metadata: name: statefulset-restic namespace: default spec: selector: matchLabels: app: statefulset-demo fileGroups: - path: /source/data retentionPolicyName: 'keep-last-5' backend: local: mountPath: /repo hostPath: path: /data/stash-test/restic-repo storageSecretName: statefulset-secret schedule: '@every 1m' volumeMounts: - mountPath: /source/data name: source-data retentionPolicies: - name: 'keep-last-5' keepLast: 5 prune: true --- apiVersion: v1 kind: Service metadata: name: headless namespace: default spec: clusterIP: None ports: - name: http port: 80 protocol: TCP targetPort: 80 selector: app: statefulset-demo type: ClusterIP --- apiVersion: apps/v1 kind: StatefulSet metadata: labels: app: statefulset-demo name: workload namespace: default spec: replicas: 1 serviceName: headless selector: matchLabels: app: statefulset-demo template: metadata: labels: app: statefulset-demo name: busybox spec: serviceAccountName: statefulset-demo containers: - image: busybox name: busybox imagePullPolicy: IfNotPresent command: - sleep - "3600" resources: {} volumeMounts: - mountPath: /source/data name: source-data - image: appscode/stash:0.8.3 name: stash imagePullPolicy: IfNotPresent args: - backup - --restic-name=statefulset-restic - --workload-kind=Statefulset - --workload-name=workload - --run-via-cron=true - --v=3 env: - name: NODE_NAME valueFrom: fieldRef: apiVersion: v1 fieldPath: spec.nodeName - name: POD_NAME valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.name resources: {} volumeMounts: - mountPath: /tmp name: stash-scratchdir - mountPath: /etc/stash name: stash-podinfo - mountPath: /source/data name: source-data readOnly: true - mountPath: /safe/data name: stash-local volumes: - gitRepo: repository: https://github.com/appscode/stash-data.git name: source-data - hostPath: path: /data/stash-test/restic-repo type: "" name: stash-local - emptyDir: {} name: stash-scratchdir - downwardAPI: defaultMode: 420 items: - fieldRef: apiVersion: v1 fieldPath: metadata.labels path: labels name: stash-podinfo