New to Stash? Please start here.
Stash operator can be used as a workload initializer. For this you need to create a InitializerConfiguration
with initializer named stash.appscode.com
. Please note that, this uses an alpha feature of Kubernetes.
$ kubectl apply -f ./hack/deploy/initializer.yaml
initializerconfiguration "stash-initializer-config" created
apiVersion: admissionregistration.k8s.io/v1alpha1
kind: InitializerConfiguration
metadata:
labels:
app: stash
name: stash-initializer
initializers:
- name: stash.appscode.com
rules:
- apiGroups:
- "*"
apiVersions:
- "*"
resources:
- daemonsets
- deployments
- replicasets
- replicationcontrollers
- statefulsets
This is helpful when you create Restic
before creating workload objects. This allows stash operator to initialize the target workloads by adding sidecar or, init-container before workload-pods are created. Thus stash operator does not need to delete workload pods for applying changes.
This is particularly helpful for workload kind StatefulSet
, since kubernetes does not adding sidecar / init containers to StatefulSets after they are created.