Add persistent storage to the Operator pod

Add persistent storage to the Operator pod for app downloads.

Configure a persistent storage volume for the Operator pod to use as a staging area for app package downloads.

Note: If the persistent storage volume is not configured for the Operator, by default, the App Framework uses main memory (RAM) as the staging area for app package downloads. To avoid pressure on main memory, use a persistent volume for the Operator pod.
  1. Create the persistent volume used by the Operator pod to cache apps and add-ons.
    CODE
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: operator-volume-claim
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 8Gi
      storageClassName: gp2
  2. Associate the persistent volume with the Operator pod by updating the Operator configuration.
    CODE
    volumes:
    - name: app-staging
      persistentVolumeClaim:
        claimName: operator-volume-claim
  3. Mount the volume on the path.
    CODE
    volumeMounts:
    - mountPath: /opt/splunk/appframework/
      name: app-staging

The following example shows a full Operator configuration with the persistent volume:

CODE
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: operator-volume-claim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 8Gi
  storageClassName: gp2
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: splunk-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: splunk-operator
  template:
    metadata:
      labels:
        name: splunk-operator
    spec:
      securityContext:
        fsGroup: 1001
      serviceAccountName: splunk-operator
      containers:
      - name: splunk-operator
        image: "docker.io/splunk/splunk-operator:<version>"
        volumeMounts:
        - mountPath: /opt/splunk/appframework/
          name: app-staging
        imagePullPolicy: IfNotPresent
        env:
        - name: WATCH_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: OPERATOR_NAME
          value: "splunk-operator"
        - name: RELATED_IMAGE_SPLUNK_ENTERPRISE
          value: "docker.io/splunk/splunk:<version>"
        - name: SPLUNK_GENERAL_TERMS
          value: ""
      volumes:
      - name: app-staging
        persistentVolumeClaim:
          claimName: operator-volume-claim