diff --git a/deploy/crds/enterprise.splunk.com_clustermasters_crd.yaml b/deploy/crds/enterprise.splunk.com_clustermasters_crd.yaml index d02058084..939aa73c6 100644 --- a/deploy/crds/enterprise.splunk.com_clustermasters_crd.yaml +++ b/deploy/crds/enterprise.splunk.com_clustermasters_crd.yaml @@ -660,17 +660,25 @@ spec: by commas type: string defaultsUrlApps: - description: Full path or URL for one or more default.yml files for installing apps, separated - by commas - type: string - ephemeralStorage: - description: If true, ephemeral (emptyDir) storage will be used for - /opt/splunk/etc and /opt/splunk/var volumes - type: boolean - etcStorage: - description: Storage capacity to request for /opt/splunk/etc persistent - volume claims (default=”1Gi”) + description: Full path or URL for one or more defaults.yml files specific + to App install, separated by commas. The defaults listed here will + be installed on the CM, standalone, search head deployer or license + master instance. type: string + etcVolumeStorageConfig: + description: Storage configuration for /opt/splunk/etc volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object image: description: Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables) @@ -1091,9 +1099,6 @@ spec: to setup the soft links from ../master-apps/splunk-operator/local/ to /mnt/splunk-operator/local/ type: string - storageClassName: - description: Name of StorageClass to use for persistent volume claims - type: string tolerations: description: Pod's tolerations for Kubernetes node's taint items: @@ -1134,10 +1139,20 @@ spec: type: string type: object type: array - varStorage: - description: Storage capacity to request for /opt/splunk/var persistent - volume claims (default=”50Gi”) - type: string + varVolumeStorageConfig: + description: Storage configuration for /opt/splunk/var volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object volumes: description: List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ diff --git a/deploy/crds/enterprise.splunk.com_indexerclusters_crd.yaml b/deploy/crds/enterprise.splunk.com_indexerclusters_crd.yaml index 5b0f94156..615b1dc4e 100644 --- a/deploy/crds/enterprise.splunk.com_indexerclusters_crd.yaml +++ b/deploy/crds/enterprise.splunk.com_indexerclusters_crd.yaml @@ -681,14 +681,26 @@ spec: description: Full path or URL for one or more default.yml files, separated by commas type: string - ephemeralStorage: - description: If true, ephemeral (emptyDir) storage will be used for - /opt/splunk/etc and /opt/splunk/var volumes - type: boolean - etcStorage: - description: Storage capacity to request for /opt/splunk/etc persistent - volume claims (default=”1Gi”) + defaultsUrlApps: + description: Full path or URL for one or more defaults.yml files specific + to App install, separated by commas. The defaults listed here will + be installed on the CM, standalone, search head deployer or license + master instance. type: string + etcVolumeStorageConfig: + description: Storage configuration for /opt/splunk/etc volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object image: description: Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables) @@ -1005,9 +1017,6 @@ spec: type: object type: object type: object - storageClassName: - description: Name of StorageClass to use for persistent volume claims - type: string tolerations: description: Pod's tolerations for Kubernetes node's taint items: @@ -1048,10 +1057,20 @@ spec: type: string type: object type: array - varStorage: - description: Storage capacity to request for /opt/splunk/var persistent - volume claims (default=”50Gi”) - type: string + varVolumeStorageConfig: + description: Storage configuration for /opt/splunk/var volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object volumes: description: List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ diff --git a/deploy/crds/enterprise.splunk.com_licensemasters_crd.yaml b/deploy/crds/enterprise.splunk.com_licensemasters_crd.yaml index 89200ca61..6e7c0e0f3 100644 --- a/deploy/crds/enterprise.splunk.com_licensemasters_crd.yaml +++ b/deploy/crds/enterprise.splunk.com_licensemasters_crd.yaml @@ -665,17 +665,25 @@ spec: by commas type: string defaultsUrlApps: - description: Full path or URL for one or more default.yml files for installing apps, separated - by commas - type: string - ephemeralStorage: - description: If true, ephemeral (emptyDir) storage will be used for - /opt/splunk/etc and /opt/splunk/var volumes - type: boolean - etcStorage: - description: Storage capacity to request for /opt/splunk/etc persistent - volume claims (default=”1Gi”) + description: Full path or URL for one or more defaults.yml files specific + to App install, separated by commas. The defaults listed here will + be installed on the CM, standalone, search head deployer or license + master instance. type: string + etcVolumeStorageConfig: + description: Storage configuration for /opt/splunk/etc volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object image: description: Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables) @@ -987,9 +995,6 @@ spec: type: object type: object type: object - storageClassName: - description: Name of StorageClass to use for persistent volume claims - type: string tolerations: description: Pod's tolerations for Kubernetes node's taint items: @@ -1030,10 +1035,20 @@ spec: type: string type: object type: array - varStorage: - description: Storage capacity to request for /opt/splunk/var persistent - volume claims (default=”50Gi”) - type: string + varVolumeStorageConfig: + description: Storage configuration for /opt/splunk/var volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object volumes: description: List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ diff --git a/deploy/crds/enterprise.splunk.com_searchheadclusters_crd.yaml b/deploy/crds/enterprise.splunk.com_searchheadclusters_crd.yaml index b189409b8..f99e2a661 100644 --- a/deploy/crds/enterprise.splunk.com_searchheadclusters_crd.yaml +++ b/deploy/crds/enterprise.splunk.com_searchheadclusters_crd.yaml @@ -682,17 +682,25 @@ spec: by commas type: string defaultsUrlApps: - description: Full path or URL for one or more default.yml files for installing apps, separated - by commas - type: string - ephemeralStorage: - description: If true, ephemeral (emptyDir) storage will be used for - /opt/splunk/etc and /opt/splunk/var volumes - type: boolean - etcStorage: - description: Storage capacity to request for /opt/splunk/etc persistent - volume claims (default=”1Gi”) + description: Full path or URL for one or more defaults.yml files specific + to App install, separated by commas. The defaults listed here will + be installed on the CM, standalone, search head deployer or license + master instance. type: string + etcVolumeStorageConfig: + description: Storage configuration for /opt/splunk/etc volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object image: description: Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables) @@ -1051,9 +1059,6 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - storageClassName: - description: Name of StorageClass to use for persistent volume claims - type: string tolerations: description: Pod's tolerations for Kubernetes node's taint items: @@ -1094,10 +1099,20 @@ spec: type: string type: object type: array - varStorage: - description: Storage capacity to request for /opt/splunk/var persistent - volume claims (default=”50Gi”) - type: string + varVolumeStorageConfig: + description: Storage configuration for /opt/splunk/var volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object volumes: description: List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ diff --git a/deploy/crds/enterprise.splunk.com_standalones_crd.yaml b/deploy/crds/enterprise.splunk.com_standalones_crd.yaml index 77beafa5e..815f960d1 100644 --- a/deploy/crds/enterprise.splunk.com_standalones_crd.yaml +++ b/deploy/crds/enterprise.splunk.com_standalones_crd.yaml @@ -677,17 +677,25 @@ spec: by commas type: string defaultsUrlApps: - description: Full path or URL for one or more default.yml files for installing apps, separated - by commas - type: string - ephemeralStorage: - description: If true, ephemeral (emptyDir) storage will be used for - /opt/splunk/etc and /opt/splunk/var volumes - type: boolean - etcStorage: - description: Storage capacity to request for /opt/splunk/etc persistent - volume claims (default=”1Gi”) + description: Full path or URL for one or more defaults.yml files specific + to App install, separated by commas. The defaults listed here will + be installed on the CM, standalone, search head deployer or license + master instance. type: string + etcVolumeStorageConfig: + description: Storage configuration for /opt/splunk/etc volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object image: description: Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables) @@ -1148,9 +1156,6 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - storageClassName: - description: Name of StorageClass to use for persistent volume claims - type: string tolerations: description: Pod's tolerations for Kubernetes node's taint items: @@ -1191,10 +1196,20 @@ spec: type: string type: object type: array - varStorage: - description: Storage capacity to request for /opt/splunk/var persistent - volume claims (default=”50Gi”) - type: string + varVolumeStorageConfig: + description: Storage configuration for /opt/splunk/var volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object volumes: description: List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ diff --git a/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_clustermasters_crd.yaml b/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_clustermasters_crd.yaml index 5c9b2adc7..939aa73c6 100644 --- a/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_clustermasters_crd.yaml +++ b/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_clustermasters_crd.yaml @@ -659,14 +659,26 @@ spec: description: Full path or URL for one or more default.yml files, separated by commas type: string - ephemeralStorage: - description: If true, ephemeral (emptyDir) storage will be used for - /opt/splunk/etc and /opt/splunk/var volumes - type: boolean - etcStorage: - description: Storage capacity to request for /opt/splunk/etc persistent - volume claims (default=”1Gi”) + defaultsUrlApps: + description: Full path or URL for one or more defaults.yml files specific + to App install, separated by commas. The defaults listed here will + be installed on the CM, standalone, search head deployer or license + master instance. type: string + etcVolumeStorageConfig: + description: Storage configuration for /opt/splunk/etc volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object image: description: Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables) @@ -1087,9 +1099,6 @@ spec: to setup the soft links from ../master-apps/splunk-operator/local/ to /mnt/splunk-operator/local/ type: string - storageClassName: - description: Name of StorageClass to use for persistent volume claims - type: string tolerations: description: Pod's tolerations for Kubernetes node's taint items: @@ -1130,10 +1139,20 @@ spec: type: string type: object type: array - varStorage: - description: Storage capacity to request for /opt/splunk/var persistent - volume claims (default=”50Gi”) - type: string + varVolumeStorageConfig: + description: Storage configuration for /opt/splunk/var volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object volumes: description: List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ diff --git a/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_indexerclusters_crd.yaml b/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_indexerclusters_crd.yaml index 5b0f94156..615b1dc4e 100644 --- a/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_indexerclusters_crd.yaml +++ b/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_indexerclusters_crd.yaml @@ -681,14 +681,26 @@ spec: description: Full path or URL for one or more default.yml files, separated by commas type: string - ephemeralStorage: - description: If true, ephemeral (emptyDir) storage will be used for - /opt/splunk/etc and /opt/splunk/var volumes - type: boolean - etcStorage: - description: Storage capacity to request for /opt/splunk/etc persistent - volume claims (default=”1Gi”) + defaultsUrlApps: + description: Full path or URL for one or more defaults.yml files specific + to App install, separated by commas. The defaults listed here will + be installed on the CM, standalone, search head deployer or license + master instance. type: string + etcVolumeStorageConfig: + description: Storage configuration for /opt/splunk/etc volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object image: description: Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables) @@ -1005,9 +1017,6 @@ spec: type: object type: object type: object - storageClassName: - description: Name of StorageClass to use for persistent volume claims - type: string tolerations: description: Pod's tolerations for Kubernetes node's taint items: @@ -1048,10 +1057,20 @@ spec: type: string type: object type: array - varStorage: - description: Storage capacity to request for /opt/splunk/var persistent - volume claims (default=”50Gi”) - type: string + varVolumeStorageConfig: + description: Storage configuration for /opt/splunk/var volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object volumes: description: List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ diff --git a/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_licensemasters_crd.yaml b/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_licensemasters_crd.yaml index 5b2239343..6e7c0e0f3 100644 --- a/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_licensemasters_crd.yaml +++ b/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_licensemasters_crd.yaml @@ -664,14 +664,26 @@ spec: description: Full path or URL for one or more default.yml files, separated by commas type: string - ephemeralStorage: - description: If true, ephemeral (emptyDir) storage will be used for - /opt/splunk/etc and /opt/splunk/var volumes - type: boolean - etcStorage: - description: Storage capacity to request for /opt/splunk/etc persistent - volume claims (default=”1Gi”) + defaultsUrlApps: + description: Full path or URL for one or more defaults.yml files specific + to App install, separated by commas. The defaults listed here will + be installed on the CM, standalone, search head deployer or license + master instance. type: string + etcVolumeStorageConfig: + description: Storage configuration for /opt/splunk/etc volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object image: description: Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables) @@ -983,9 +995,6 @@ spec: type: object type: object type: object - storageClassName: - description: Name of StorageClass to use for persistent volume claims - type: string tolerations: description: Pod's tolerations for Kubernetes node's taint items: @@ -1026,10 +1035,20 @@ spec: type: string type: object type: array - varStorage: - description: Storage capacity to request for /opt/splunk/var persistent - volume claims (default=”50Gi”) - type: string + varVolumeStorageConfig: + description: Storage configuration for /opt/splunk/var volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object volumes: description: List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ diff --git a/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_searchheadclusters_crd.yaml b/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_searchheadclusters_crd.yaml index 77d75f9aa..f99e2a661 100644 --- a/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_searchheadclusters_crd.yaml +++ b/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_searchheadclusters_crd.yaml @@ -681,14 +681,26 @@ spec: description: Full path or URL for one or more default.yml files, separated by commas type: string - ephemeralStorage: - description: If true, ephemeral (emptyDir) storage will be used for - /opt/splunk/etc and /opt/splunk/var volumes - type: boolean - etcStorage: - description: Storage capacity to request for /opt/splunk/etc persistent - volume claims (default=”1Gi”) + defaultsUrlApps: + description: Full path or URL for one or more defaults.yml files specific + to App install, separated by commas. The defaults listed here will + be installed on the CM, standalone, search head deployer or license + master instance. type: string + etcVolumeStorageConfig: + description: Storage configuration for /opt/splunk/etc volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object image: description: Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables) @@ -1047,9 +1059,6 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - storageClassName: - description: Name of StorageClass to use for persistent volume claims - type: string tolerations: description: Pod's tolerations for Kubernetes node's taint items: @@ -1090,10 +1099,20 @@ spec: type: string type: object type: array - varStorage: - description: Storage capacity to request for /opt/splunk/var persistent - volume claims (default=”50Gi”) - type: string + varVolumeStorageConfig: + description: Storage configuration for /opt/splunk/var volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object volumes: description: List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ diff --git a/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_standalones_crd.yaml b/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_standalones_crd.yaml index 229b0d04a..815f960d1 100644 --- a/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_standalones_crd.yaml +++ b/deploy/olm-catalog/splunk/0.2.1/enterprise.splunk.com_standalones_crd.yaml @@ -676,14 +676,26 @@ spec: description: Full path or URL for one or more default.yml files, separated by commas type: string - ephemeralStorage: - description: If true, ephemeral (emptyDir) storage will be used for - /opt/splunk/etc and /opt/splunk/var volumes - type: boolean - etcStorage: - description: Storage capacity to request for /opt/splunk/etc persistent - volume claims (default=”1Gi”) + defaultsUrlApps: + description: Full path or URL for one or more defaults.yml files specific + to App install, separated by commas. The defaults listed here will + be installed on the CM, standalone, search head deployer or license + master instance. type: string + etcVolumeStorageConfig: + description: Storage configuration for /opt/splunk/etc volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object image: description: Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables) @@ -1144,9 +1156,6 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - storageClassName: - description: Name of StorageClass to use for persistent volume claims - type: string tolerations: description: Pod's tolerations for Kubernetes node's taint items: @@ -1187,10 +1196,20 @@ spec: type: string type: object type: array - varStorage: - description: Storage capacity to request for /opt/splunk/var persistent - volume claims (default=”50Gi”) - type: string + varVolumeStorageConfig: + description: Storage configuration for /opt/splunk/var volume + properties: + ephemeralStorage: + description: If true, ephemeral (emptyDir) storage will be used + type: boolean + storageCapacity: + description: Storage capacity to request persistent volume claims + (default=”10Gi” for etc and "100Gi" for var) + type: string + storageClassName: + description: Name of StorageClass to use for persistent volume claims + type: string + type: object volumes: description: List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ diff --git a/docs/CustomResources.md b/docs/CustomResources.md index 3506e9741..e8eb8bbb6 100644 --- a/docs/CustomResources.md +++ b/docs/CustomResources.md @@ -88,9 +88,12 @@ kind: Standalone metadata: name: example spec: - storageClassName: gp2 - etcStorage: "100Gi" - varStorage: "500Gi" + etcVolumeStorageConfig: + storageClassName: gp2 + storageCapacity: 15Gi + varVolumeStorageConfig: + storageClassName: customStorageClass + storageCapacity: 25Gi volumes: - name: licenses configMap: @@ -107,10 +110,8 @@ Enterprise resources, including: `Standalone`, `LicenseMaster`, | Key | Type | Description | | ------------------ | ------- | ----------------------------------------------------------------------------- | -| storageClassName | string | Name of [StorageClass](StorageClass.md) to use for persistent volume claims | -| etcStorage | string | Storage capacity to request for Splunk etc volume claims (default="10Gi") | -| varStorage | string | Storage capacity to request for Splunk var volume claims (default="100Gi") | -| ephemeralStorage | boolean | If true, ephemeral (emptyDir) storage will be used for etc and var volumes (default=false) | +| etcVolumeStorageConfig | StorageClassSpec | Storage class spec for Splunk etc volume as described in [StorageClass](StorageClass.md) | +| varVolumeStorageConfig | StorageClassSpec | Storage class spec for Splunk var volume as described in [StorageClass](StorageClass.md) | | volumes | [[]Volume](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#volume-v1-core) | List of one or more [Kubernetes volumes](https://kubernetes.io/docs/concepts/storage/volumes/). These will be mounted in all container pods as as `/mnt/` | | defaults | string | Inline map of [default.yml](https://github.com/splunk/splunk-ansible/blob/develop/docs/advanced/default.yml.spec.md) overrides used to initialize the environment | | defaultsUrl | string | Full path or URL for one or more [default.yml](https://github.com/splunk/splunk-ansible/blob/develop/docs/advanced/default.yml.spec.md) files, separated by commas | diff --git a/docs/Examples.md b/docs/Examples.md index 7aed57522..2f173a3d9 100644 --- a/docs/Examples.md +++ b/docs/Examples.md @@ -206,8 +206,12 @@ metadata: finalizers: - enterprise.splunk.com/delete-pvc spec: - storageClassName: standard - varStorage: "4Gi" + etcVolumeStorageConfig: + storageClassName: gp2 + storageCapacity: 15Gi + varVolumeStorageConfig: + storageClassName: customStorageClass + storageCapacity: 25Gi --- apiVersion: enterprise.splunk.com/v1beta1 kind: IndexerCluster diff --git a/docs/StorageClass.md b/docs/StorageClass.md index f337e4b84..3dad417a8 100644 --- a/docs/StorageClass.md +++ b/docs/StorageClass.md @@ -11,10 +11,28 @@ deployments. For each pod, the following two volumes will be mounted: | `/opt/splunk/var` | This is used to store all indexed events, logs, and other data | By default, 10GiB volumes will be created for `/opt/splunk/etc` and 100GiB -volumes will be created for `/opt/splunk/var`. You can customize this for -each resource by using the `etcStorage` and `varStorage` parameters. +volumes will be created for `/opt/splunk/var`. -The `kubectl` command can be used to see which Storage Classes are available in +You can customize the `storage capacity` and `storage class names` for the `/opt/splunk/etc` +and `/opt/splunk/var` volumes by using the `storageCapacity` and `storageClassName` fields +under the `etcVolumeStorageConfig` and `varVolumeStorageConfig` spec as follows: + +```yaml +apiVersion: enterprise.splunk.com/v1beta1 +kind: Standalone +metadata: + name: example + finalizers: + - enterprise.splunk.com/delete-pvc +spec: + etcVolumeStorageConfig: + storageClassName: gp2 + storageCapacity: 15Gi + varVolumeStorageConfig: + storageClassName: customStorageClass + storageCapacity: 25Gi +``` +The following `kubectl` command can be used to see which Storage Classes are available in your Kubernetes cluster: ``` @@ -23,8 +41,15 @@ NAME PROVISIONER AGE gp2 (default) kubernetes.io/aws-ebs 176d ``` -You can use the `storageClassName` parameter to specify the Storage Class you -would like to use: +If no `storageClassName` is provided, the default Storage Class for your +Kubernetes cluster will be used. + + +## Ephemeral Storage + +For testing and demonstration purposes, you may bypass the use of persistent +storage by using the `ephemeralStorage` field under the `etcVolumeStorageConfig` +and `varVolumeStorageConfig` spec as follows: ```yaml apiVersion: enterprise.splunk.com/v1beta1 @@ -34,20 +59,13 @@ metadata: finalizers: - enterprise.splunk.com/delete-pvc spec: - storageClassName: "gp2" - etcStorage: "25Gi" - varStorage: "100Gi" + etcVolumeStorageConfig: + ephemeralStorage: true + varVolumeStorageConfig: + ephemeralStorage: true ``` -If no `storageClassName` is provided, the default Storage Class for your -Kubernetes cluster will be used. - - -## Ephemeral Storage - -For testing and demonstration purposes, you may bypass the use of persistent -storage by setting `ephemeralStorage: true` within any Splunk custom resource -spec. This will mount local, ephemeral volumes for `/opt/splunk/etc` and +This will mount local, ephemeral volumes for `/opt/splunk/etc` and `/opt/splunk/var` using the Kubernetes [emptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) feature. diff --git a/go.mod b/go.mod index 4f9c99e36..d34e93ca0 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( k8s.io/apimachinery v0.0.0 k8s.io/client-go v12.0.0+incompatible k8s.io/kubectl v0.0.0 + k8s.io/kubernetes v1.16.2 sigs.k8s.io/controller-runtime v0.4.0 ) diff --git a/go.sum b/go.sum index 4d15338c5..acdc47633 100644 --- a/go.sum +++ b/go.sum @@ -29,6 +29,7 @@ github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced34534/go.mod h1:iroGtC8B3tQiqtds1l+mgk/BBOrxbqjH+eUfFQYRc14= github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA= github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E= +github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e h1:eb0Pzkt15Bm7f2FFYv7sjY7NPFi3cPkS3tv1CcrFBWA= github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= @@ -93,6 +94,7 @@ github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.0 h1:yTUvW7Vhb89inJ+8irsUqiWjh8iT6sQPZiQzI6ReGkA= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= +github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 h1:7aWHqerlJ41y6FOsEUvknqgXnGmJyJSbjhAWq5pO4F8= github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw= github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b/go.mod h1:TrMrLQfeENAPYPRsJuq3jsqdlRh3lvi6trTZJG8+tho= github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= @@ -185,7 +187,9 @@ github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwCFad8crR9dcMQWvV9Hvulu6hwUh4tWPJnM= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4= +github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8= github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -315,6 +319,7 @@ github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450/go.mod h1:Bk6SMAO github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkYFkPcDKwRXegd+iM6E7matEszMG5HhwytU8= github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/cadvisor v0.34.0/go.mod h1:1nql6U13uTHaLYB8rLS5x9IJc2qT6Xd/Tr1sTX6NE48= github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= @@ -355,6 +360,7 @@ github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoA github.com/gosuri/uitable v0.0.1/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo= github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/gregjones/httpcache v0.0.0-20190203031600-7a902570cb17 h1:prg2TTpTOcJF1jRWL2zSU1FQNgB0STAFNux8GK82y8k= github.com/gregjones/httpcache v0.0.0-20190203031600-7a902570cb17/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v0.0.0-20190222133341-cfaf5686ec79/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -434,6 +440,7 @@ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/libopenstorage/openstorage v1.0.0/go.mod h1:Sp1sIObHjat1BeXhfMqLZ14wnOzEhNx2YQedreMcUyc= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= +github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY= github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= github.com/lpabon/godbc v0.1.1/go.mod h1:Jo9QV0cf3U6jZABgiJ2skINAXb9j8m51r07g4KI92ZA= github.com/lucas-clemente/aes12 v0.0.0-20171027163421-cd47fb39b79f/go.mod h1:JpH9J1c9oX6otFSgdUHwUBUizmKlrMjxWnIAjff4m04= @@ -480,11 +487,13 @@ github.com/mistifyio/go-zfs v2.1.1+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfv github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/moby/moby v0.7.3-0.20190826074503-38ab9da00309 h1:cvy4lBOYN3gKfKj8Lzz5Q9TfviP+L7koMHY7SvkyTKs= github.com/moby/moby v0.7.3-0.20190826074503-38ab9da00309/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= @@ -555,6 +564,7 @@ github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/freeport v0.0.0-20171002181615-b8543db493a5/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -935,6 +945,7 @@ k8s.io/apimachinery v0.0.0-20191004115801-a2eda9f80ab8 h1:Iieh/ZEgT3BWwbLD5qEKcY k8s.io/apimachinery v0.0.0-20191004115801-a2eda9f80ab8/go.mod h1:llRdnznGEAqC3DcNm6yEj472xaFVfLM7hnYofMb12tQ= k8s.io/apiserver v0.0.0-20191016112112-5190913f932d/go.mod h1:7OqfAolfWxUM/jJ/HBLyE+cdaWFBUoo5Q5pHgJVj2ws= k8s.io/autoscaler v0.0.0-20190607113959-1b4f1855cb8e/go.mod h1:QEXezc9uKPT91dwqhSJq3GNI3B1HxFRQHiku9kmrsSA= +k8s.io/cli-runtime v0.0.0-20191016114015-74ad18325ed5 h1:8ZfMjkMBzcXEawLsYHg9lDM7aLEVso3NiVKfUTnN56A= k8s.io/cli-runtime v0.0.0-20191016114015-74ad18325ed5/go.mod h1:sDl6WKSQkDM6zS1u9F49a0VooQ3ycYFBFLqd2jf2Xfo= k8s.io/client-go v0.0.0-20191016111102-bec269661e48 h1:C2XVy2z0dV94q9hSSoCuTPp1KOG7IegvbdXuz9VGxoU= k8s.io/client-go v0.0.0-20191016111102-bec269661e48/go.mod h1:hrwktSwYGI4JK+TJA3dMaFyyvHVi/aLarVHpbs8bgCU= @@ -969,6 +980,7 @@ k8s.io/kubectl v0.0.0-20191016120415-2ed914427d51 h1:RBkTKVMF+xsNsSOVc0+HdC0B5gD k8s.io/kubectl v0.0.0-20191016120415-2ed914427d51/go.mod h1:gL826ZTIfD4vXTGlmzgTbliCAT9NGiqpCqK2aNYv5MQ= k8s.io/kubelet v0.0.0-20191016114556-7841ed97f1b2/go.mod h1:SBvrtLbuePbJygVXGGCMtWKH07+qrN2dE1iMnteSG8E= k8s.io/kubernetes v1.16.0/go.mod h1:nlP2zevWKRGKuaaVbKIwozU0Rjg9leVDXkL4YTtjmVs= +k8s.io/kubernetes v1.16.2 h1:k0f/OVp6Yfv+UMTm6VYKhqjRgcvHh4QhN9coanjrito= k8s.io/kubernetes v1.16.2/go.mod h1:SmhGgKfQ30imqjFVj8AI+iW+zSyFsswNErKYeTfgoH0= k8s.io/legacy-cloud-providers v0.0.0-20191016115753-cf0698c3a16b/go.mod h1:tKW3pKqdRW8pMveUTpF5pJuCjQxg6a25iLo+Z9BXVH0= k8s.io/metrics v0.0.0-20191016113814-3b1a734dba6e/go.mod h1:ve7/vMWeY5lEBkZf6Bt5TTbGS3b8wAxwGbdXAsufjRs= @@ -987,6 +999,7 @@ rsc.io/letsencrypt v0.0.1/go.mod h1:buyQKZ6IXrRnB7TdkHP0RyEybLx18HHyOSoTyoOLqNY= sigs.k8s.io/controller-runtime v0.4.0 h1:wATM6/m+3w8lj8FXNaO6Fs/rq/vqoOjO1Q116Z9NPsg= sigs.k8s.io/controller-runtime v0.4.0/go.mod h1:ApC79lpY3PHW9xj/w9pj+lYkLgwAAUZwfXkME1Lajns= sigs.k8s.io/controller-tools v0.2.4/go.mod h1:m/ztfQNocGYBgTTCmFdnK94uVvgxeZeE3LtJvd/jIzA= +sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0= sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca/go.mod h1:IIgPezJWb76P0hotTxzDbWsMYB8APh18qZnxkomBpxA= diff --git a/pkg/apis/enterprise/v1beta1/common_types.go b/pkg/apis/enterprise/v1beta1/common_types.go index d3f161eff..37ddf74f8 100644 --- a/pkg/apis/enterprise/v1beta1/common_types.go +++ b/pkg/apis/enterprise/v1beta1/common_types.go @@ -37,17 +37,11 @@ const ( type CommonSplunkSpec struct { splcommon.Spec `json:",inline"` - // Name of StorageClass to use for persistent volume claims - StorageClassName string `json:"storageClassName"` - - // Storage capacity to request for /opt/splunk/etc persistent volume claims (default=”1Gi”) - EtcStorage string `json:"etcStorage"` + // Storage configuration for /opt/splunk/etc volume + EtcVolumeStorageConfig StorageClassSpec `json:"etcVolumeStorageConfig"` - // Storage capacity to request for /opt/splunk/var persistent volume claims (default=”50Gi”) - VarStorage string `json:"varStorage"` - - // If true, ephemeral (emptyDir) storage will be used for /opt/splunk/etc and /opt/splunk/var volumes - EphemeralStorage bool `json:"ephemeralStorage"` + // Storage configuration for /opt/splunk/var volume + VarVolumeStorageConfig StorageClassSpec `json:"varVolumeStorageConfig"` // List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/ Volumes []corev1.Volume `json:"volumes"` @@ -58,10 +52,10 @@ type CommonSplunkSpec struct { // Full path or URL for one or more default.yml files, separated by commas DefaultsURL string `json:"defaultsUrl"` - // Full path or URL for one or more default.yml files specific to App install, separated by commas - // This is meant as a temporary fix until the SHC Deployer has its own CRD. The defaults listed here will - // only be installed on a standalone, or a SHC Deployer or IDC CM to be pushed to SH/IDXs in a cluster. - // This parameter is ignored on individual SHs or IDXs within a cluster + // Full path or URL for one or more defaults.yml files specific + // to App install, separated by commas. The defaults listed here + // will be installed on the CM, standalone, search head deployer + // or license master instance. DefaultsURLApps string `json:"defaultsUrlApps"` // Full path or URL for a Splunk Enterprise license file @@ -77,6 +71,18 @@ type CommonSplunkSpec struct { Mock bool `json:"Mock"` } +// StorageClassSpec defines storage class configuration +type StorageClassSpec struct { + // Name of StorageClass to use for persistent volume claims + StorageClassName string `json:"storageClassName"` + + // Storage capacity to request persistent volume claims (default=”10Gi” for etc and "100Gi" for var) + StorageCapacity string `json:"storageCapacity"` + + // If true, ephemeral (emptyDir) storage will be used + EphemeralStorage bool `json:"ephemeralStorage"` +} + // SmartStoreSpec defines Splunk indexes and remote storage volume configuration type SmartStoreSpec struct { // List of remote storage volumes diff --git a/pkg/apis/enterprise/v1beta1/zz_generated.deepcopy.go b/pkg/apis/enterprise/v1beta1/zz_generated.deepcopy.go index 643175b41..c232ad43b 100644 --- a/pkg/apis/enterprise/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/enterprise/v1beta1/zz_generated.deepcopy.go @@ -150,6 +150,8 @@ func (in *ClusterMasterStatus) DeepCopy() *ClusterMasterStatus { func (in *CommonSplunkSpec) DeepCopyInto(out *CommonSplunkSpec) { *out = *in in.Spec.DeepCopyInto(&out.Spec) + out.EtcVolumeStorageConfig = in.EtcVolumeStorageConfig + out.VarVolumeStorageConfig = in.VarVolumeStorageConfig if in.Volumes != nil { in, out := &in.Volumes, &out.Volumes *out = make([]v1.Volume, len(*in)) @@ -819,6 +821,22 @@ func (in *StandaloneStatus) DeepCopy() *StandaloneStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageClassSpec) DeepCopyInto(out *StorageClassSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageClassSpec. +func (in *StorageClassSpec) DeepCopy() *StorageClassSpec { + if in == nil { + return nil + } + out := new(StorageClassSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) { *out = *in diff --git a/pkg/splunk/common/names.go b/pkg/splunk/common/names.go index 3865760bb..b5c789f7c 100644 --- a/pkg/splunk/common/names.go +++ b/pkg/splunk/common/names.go @@ -37,6 +37,27 @@ const ( // IdxcSecret represents indexer cluster pass4Symmkey secret token IdxcSecret = "idxc_secret" + + // PvcNamePrefix is a helper string representing prefix for persistent volume claim names + PvcNamePrefix = "pvc-%s" + + // SplunkMountNamePrefix is a helper string representing Splunk Volume mount names + SplunkMountNamePrefix = "mnt-splunk-%s" + + // SplunkMountDirecPrefix is a helper string representing Splunk Volume mount directory + SplunkMountDirecPrefix = "/opt/splunk/%s" + + // EtcVolumeStorage indicates /opt/splunk/etc volume mounted on Pods + EtcVolumeStorage = "etc" + + // VarVolumeStorage indicates /opt/splunk/etc volume mounted on Pods + VarVolumeStorage = "var" + + // DefaultEtcVolumeStorageCapacity represents default storage capacity for etc volume + DefaultEtcVolumeStorageCapacity = "10Gi" + + // DefaultVarVolumeStorageCapacity represents default storage capacity for var volume + DefaultVarVolumeStorageCapacity = "100Gi" ) // GetVersionedSecretName returns a versioned secret name diff --git a/pkg/splunk/enterprise/clustermaster_test.go b/pkg/splunk/enterprise/clustermaster_test.go index 3e2d10fad..4d9f862b1 100644 --- a/pkg/splunk/enterprise/clustermaster_test.go +++ b/pkg/splunk/enterprise/clustermaster_test.go @@ -265,13 +265,13 @@ func TestApplyClusterMasterWithSmartstore(t *testing.T) { t.Errorf("ApplyClusterMaster() should not have returned error") } - current.Spec.CommonSplunkSpec.EtcStorage = "-abcd" + current.Spec.CommonSplunkSpec.EtcVolumeStorageConfig.StorageCapacity = "-abcd" if _, err := ApplyClusterMaster(client, ¤t); err == nil { t.Errorf("ApplyClusterMaster() should have returned error") } var replicas int32 = 3 - current.Spec.CommonSplunkSpec.EtcStorage = "" + current.Spec.CommonSplunkSpec.EtcVolumeStorageConfig.StorageCapacity = "" ss.Status.ReadyReplicas = 3 ss.Spec.Replicas = &replicas ss.Spec.Template.Spec.Containers[0].Image = "splunk/splunk" diff --git a/pkg/splunk/enterprise/configuration.go b/pkg/splunk/enterprise/configuration.go index 1c2534729..d18956869 100644 --- a/pkg/splunk/enterprise/configuration.go +++ b/pkg/splunk/enterprise/configuration.go @@ -45,60 +45,53 @@ func getSplunkLabels(instanceIdentifier string, instanceType InstanceType, partO } // getSplunkVolumeClaims returns a standard collection of Kubernetes volume claims. -func getSplunkVolumeClaims(cr splcommon.MetaObject, spec *enterprisev1.CommonSplunkSpec, labels map[string]string) ([]corev1.PersistentVolumeClaim, error) { - var etcStorage, varStorage resource.Quantity +func getSplunkVolumeClaims(cr splcommon.MetaObject, spec *enterprisev1.CommonSplunkSpec, labels map[string]string, volumeType string) (corev1.PersistentVolumeClaim, error) { + var storageCapacity resource.Quantity var err error - etcStorage, err = splcommon.ParseResourceQuantity(spec.EtcStorage, "10Gi") - if err != nil { - return []corev1.PersistentVolumeClaim{}, fmt.Errorf("%s: %s", "etcStorage", err) - } + storageClassName := "" - varStorage, err = splcommon.ParseResourceQuantity(spec.VarStorage, "100Gi") - if err != nil { - return []corev1.PersistentVolumeClaim{}, fmt.Errorf("%s: %s", "varStorage", err) + // Depending on the volume type, determine storage capacity and storage class name(if configured) + if volumeType == splcommon.EtcVolumeStorage { + storageCapacity, err = splcommon.ParseResourceQuantity(spec.EtcVolumeStorageConfig.StorageCapacity, splcommon.DefaultEtcVolumeStorageCapacity) + if err != nil { + return corev1.PersistentVolumeClaim{}, fmt.Errorf("%s: %s", "etcStorage", err) + } + if spec.EtcVolumeStorageConfig.StorageClassName != "" { + storageClassName = spec.EtcVolumeStorageConfig.StorageClassName + } + } else if volumeType == splcommon.VarVolumeStorage { + storageCapacity, err = splcommon.ParseResourceQuantity(spec.VarVolumeStorageConfig.StorageCapacity, splcommon.DefaultVarVolumeStorageCapacity) + if err != nil { + return corev1.PersistentVolumeClaim{}, fmt.Errorf("%s: %s", "varStorage", err) + } + if spec.VarVolumeStorageConfig.StorageClassName != "" { + storageClassName = spec.VarVolumeStorageConfig.StorageClassName + } } - volumeClaims := []corev1.PersistentVolumeClaim{ - { - ObjectMeta: metav1.ObjectMeta{ - Name: "pvc-etc", - Namespace: cr.GetNamespace(), - Labels: labels, - }, - Spec: corev1.PersistentVolumeClaimSpec{ - AccessModes: []corev1.PersistentVolumeAccessMode{"ReadWriteOnce"}, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceStorage: etcStorage, - }, - }, - }, + // Create a persistent volume claim + volumeClaim := corev1.PersistentVolumeClaim{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf(splcommon.PvcNamePrefix, volumeType), + Namespace: cr.GetNamespace(), + Labels: labels, }, - { - ObjectMeta: metav1.ObjectMeta{ - Name: "pvc-var", - Namespace: cr.GetNamespace(), - Labels: labels, - }, - Spec: corev1.PersistentVolumeClaimSpec{ - AccessModes: []corev1.PersistentVolumeAccessMode{"ReadWriteOnce"}, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceStorage: varStorage, - }, + Spec: corev1.PersistentVolumeClaimSpec{ + AccessModes: []corev1.PersistentVolumeAccessMode{"ReadWriteOnce"}, + Resources: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceStorage: storageCapacity, }, }, }, } - if spec.StorageClassName != "" { - for idx := range volumeClaims { - volumeClaims[idx].Spec.StorageClassName = &spec.StorageClassName - } + // Assign storage class name if specified + if storageClassName != "" { + volumeClaim.Spec.StorageClassName = &storageClassName } - - return volumeClaims, nil + return volumeClaim, nil } // getSplunkService returns a Kubernetes Service object for Splunk instances configured for a Splunk Enterprise resource. @@ -315,6 +308,76 @@ func addSplunkVolumeToTemplate(podTemplateSpec *corev1.PodTemplateSpec, name str } } +// addPVCVolumes adds pvc volumes to statefulSet +func addPVCVolumes(cr splcommon.MetaObject, spec *enterprisev1.CommonSplunkSpec, statefulSet *appsv1.StatefulSet, labels map[string]string, volumeType string) error { + // prepare and append persistent volume claims if storage is not ephemeral + var err error + volumeClaimTemplate, err := getSplunkVolumeClaims(cr, spec, labels, volumeType) + if err != nil { + return err + } + statefulSet.Spec.VolumeClaimTemplates = append(statefulSet.Spec.VolumeClaimTemplates, volumeClaimTemplate) + + // add volume mounts to splunk container for the PVCs + statefulSet.Spec.Template.Spec.Containers[0].VolumeMounts = append(statefulSet.Spec.Template.Spec.Containers[0].VolumeMounts, + corev1.VolumeMount{ + Name: volumeClaimTemplate.GetName(), + MountPath: fmt.Sprintf(splcommon.SplunkMountDirecPrefix, volumeType), + }) + + return nil +} + +// addEphermalVolumes adds ephermal volumes to statefulSet +func addEphermalVolumes(statefulSet *appsv1.StatefulSet, volumeType string) error { + // add ephemeral volumes to the splunk pod + emptyVolumeSource := corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + } + statefulSet.Spec.Template.Spec.Volumes = append(statefulSet.Spec.Template.Spec.Volumes, + corev1.Volume{ + Name: fmt.Sprintf(splcommon.SplunkMountNamePrefix, volumeType), VolumeSource: emptyVolumeSource, + }) + + // add volume mounts to splunk container for the ephemeral volumes + statefulSet.Spec.Template.Spec.Containers[0].VolumeMounts = append(statefulSet.Spec.Template.Spec.Containers[0].VolumeMounts, + corev1.VolumeMount{ + Name: fmt.Sprintf(splcommon.SplunkMountNamePrefix, volumeType), + MountPath: fmt.Sprintf(splcommon.SplunkMountDirecPrefix, volumeType), + }) + + return nil +} + +// addStorageVolumes adds storage volumes to the StatefulSet +func addStorageVolumes(cr splcommon.MetaObject, spec *enterprisev1.CommonSplunkSpec, statefulSet *appsv1.StatefulSet, labels map[string]string) error { + // configure storage for mount path /opt/splunk/etc + if spec.EtcVolumeStorageConfig.EphemeralStorage { + // add Ephermal volumes + _ = addEphermalVolumes(statefulSet, splcommon.EtcVolumeStorage) + } else { + // add PVC volumes + err := addPVCVolumes(cr, spec, statefulSet, labels, splcommon.EtcVolumeStorage) + if err != nil { + return err + } + } + + // configure storage for mount path /opt/splunk/var + if spec.VarVolumeStorageConfig.EphemeralStorage { + // add Ephermal volumes + _ = addEphermalVolumes(statefulSet, splcommon.VarVolumeStorage) + } else { + // add PVC volumes + err := addPVCVolumes(cr, spec, statefulSet, labels, splcommon.VarVolumeStorage) + if err != nil { + return err + } + } + + return nil +} + // getSplunkStatefulSet returns a Kubernetes StatefulSet object for Splunk instances configured for a Splunk Enterprise resource. func getSplunkStatefulSet(client splcommon.ControllerClient, cr splcommon.MetaObject, spec *enterprisev1.CommonSplunkSpec, instanceType InstanceType, replicas int32, extraEnv []corev1.EnvVar) (*appsv1.StatefulSet, error) { @@ -372,48 +435,10 @@ func getSplunkStatefulSet(client splcommon.ControllerClient, cr splcommon.MetaOb }, } - // update template to include storage for etc and var volumes - if spec.EphemeralStorage { - // add ephemeral volumes to the splunk pod for etc and opt - emptyVolumeSource := corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{}, - } - statefulSet.Spec.Template.Spec.Volumes = []corev1.Volume{ - {Name: "mnt-splunk-etc", VolumeSource: emptyVolumeSource}, - {Name: "mnt-splunk-var", VolumeSource: emptyVolumeSource}, - } - - // add volume mounts to splunk container for the ephemeral volumes - statefulSet.Spec.Template.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{ - { - Name: "mnt-splunk-etc", - MountPath: "/opt/splunk/etc", - }, - { - Name: "mnt-splunk-var", - MountPath: "/opt/splunk/var", - }, - } - - } else { - // prepare and append persistent volume claims if storage is not ephemeral - var err error - statefulSet.Spec.VolumeClaimTemplates, err = getSplunkVolumeClaims(cr, spec, labels) - if err != nil { - return nil, err - } - - // add volume mounts to splunk container for the PVCs - statefulSet.Spec.Template.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{ - { - Name: "pvc-etc", - MountPath: "/opt/splunk/etc", - }, - { - Name: "pvc-var", - MountPath: "/opt/splunk/var", - }, - } + // Add storage volumes + err := addStorageVolumes(cr, spec, statefulSet, labels) + if err != nil { + return statefulSet, err } // append labels and annotations from parent diff --git a/pkg/splunk/enterprise/configuration_test.go b/pkg/splunk/enterprise/configuration_test.go index d469ac333..9b7f59da9 100644 --- a/pkg/splunk/enterprise/configuration_test.go +++ b/pkg/splunk/enterprise/configuration_test.go @@ -24,6 +24,7 @@ import ( splctrl "github.com/splunk/splunk-operator/pkg/splunk/controller" spltest "github.com/splunk/splunk-operator/pkg/splunk/test" splutil "github.com/splunk/splunk-operator/pkg/splunk/util" + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -34,12 +35,18 @@ func configTester(t *testing.T, method string, f func() (interface{}, error), wa if err != nil { t.Errorf("%s returned error: %v", method, err) } - got, err := json.Marshal(result) + + // Marshall the result and compare + marshalAndCompare(t, result, method, want) +} + +func marshalAndCompare(t *testing.T, compare interface{}, method string, want string) { + got, err := json.Marshal(compare) if err != nil { - t.Errorf("%s failed to marshall: %v", method, err) + t.Errorf("%s failed to marshall", err) } if string(got) != want { - t.Errorf("%s = %s;\nwant %s", method, got, want) + t.Errorf("Method %s, got = %s;\nwant %s", method, got, want) } } @@ -845,3 +852,129 @@ func TestAreRemoteVolumeKeysChanged(t *testing.T) { t.Errorf("Empty volume should not report a key change") } } + +func TestAddStorageVolumes(t *testing.T) { + labels := make(map[string]string) + var replicas int32 = 1 + + // Create CR + cr := enterprisev1.ClusterMaster{ + ObjectMeta: metav1.ObjectMeta{ + Name: "CM", + Namespace: "test", + }, + } + + // create statefulset configuration + statefulSet := &appsv1.StatefulSet{ + TypeMeta: metav1.TypeMeta{ + Kind: "StatefulSet", + APIVersion: "apps/v1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "test-statefulset", + Namespace: cr.GetNamespace(), + }, + Spec: appsv1.StatefulSetSpec{ + Replicas: &replicas, + Template: corev1.PodTemplateSpec{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ + { + Image: "test", + Name: "splunk", + }, + }, + }, + }, + }, + } + + // Default spec + spec := &enterprisev1.CommonSplunkSpec{} + + test := func(want string) { + ss := statefulSet.DeepCopy() + err := addStorageVolumes(&cr, spec, ss, labels) + if err != nil { + t.Errorf("Unable to add storage volumes, error: %s", err.Error()) + } + marshalAndCompare(t, ss, "TestAddStorageVolumes", want) + } + + // Test defaults - PVCs for etc & var with 10Gi and 100Gi storage capacity + test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"test-statefulset","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"containers":[{"name":"splunk","image":"test","resources":{},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"}]}]}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"","updateStrategy":{}},"status":{"replicas":0}}`) + + // Define PVCs for etc & var with storage capacity and storage class name defined + spec = &enterprisev1.CommonSplunkSpec{ + EtcVolumeStorageConfig: enterprisev1.StorageClassSpec{ + StorageCapacity: "25Gi", + StorageClassName: "gp2", + }, + VarVolumeStorageConfig: enterprisev1.StorageClassSpec{ + StorageCapacity: "35Gi", + StorageClassName: "gp3", + }, + } + test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"test-statefulset","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"containers":[{"name":"splunk","image":"test","resources":{},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"}]}]}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"25Gi"}},"storageClassName":"gp2"},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"35Gi"}},"storageClassName":"gp3"},"status":{}}],"serviceName":"","updateStrategy":{}},"status":{"replicas":0}}`) + + // Define PVCs for etc & ephemeral for var + spec = &enterprisev1.CommonSplunkSpec{ + EtcVolumeStorageConfig: enterprisev1.StorageClassSpec{ + StorageCapacity: "25Gi", + StorageClassName: "gp2", + }, + VarVolumeStorageConfig: enterprisev1.StorageClassSpec{ + EphemeralStorage: true, + }, + } + test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"test-statefulset","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"volumes":[{"name":"mnt-splunk-var","emptyDir":{}}],"containers":[{"name":"splunk","image":"test","resources":{},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"mnt-splunk-var","mountPath":"/opt/splunk/var"}]}]}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"25Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"","updateStrategy":{}},"status":{"replicas":0}}`) + + // Define ephemeral for etc & PVCs for var + spec = &enterprisev1.CommonSplunkSpec{ + EtcVolumeStorageConfig: enterprisev1.StorageClassSpec{ + EphemeralStorage: true, + }, + VarVolumeStorageConfig: enterprisev1.StorageClassSpec{ + StorageCapacity: "25Gi", + StorageClassName: "gp2", + }, + } + test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"test-statefulset","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"volumes":[{"name":"mnt-splunk-etc","emptyDir":{}}],"containers":[{"name":"splunk","image":"test","resources":{},"volumeMounts":[{"name":"mnt-splunk-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"}]}]}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"25Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"","updateStrategy":{}},"status":{"replicas":0}}`) + + // Define ephemeral for etc & var(should ignore storage capacity & storage class name) + spec = &enterprisev1.CommonSplunkSpec{ + EtcVolumeStorageConfig: enterprisev1.StorageClassSpec{ + EphemeralStorage: true, + }, + VarVolumeStorageConfig: enterprisev1.StorageClassSpec{ + EphemeralStorage: true, + StorageCapacity: "25Gi", + StorageClassName: "gp2", + }, + } + test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"test-statefulset","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"volumes":[{"name":"mnt-splunk-etc","emptyDir":{}},{"name":"mnt-splunk-var","emptyDir":{}}],"containers":[{"name":"splunk","image":"test","resources":{},"volumeMounts":[{"name":"mnt-splunk-etc","mountPath":"/opt/splunk/etc"},{"name":"mnt-splunk-var","mountPath":"/opt/splunk/var"}]}]}},"serviceName":"","updateStrategy":{}},"status":{"replicas":0}}`) + + // Define invalid EtcVolumeStorageConfig + spec = &enterprisev1.CommonSplunkSpec{ + EtcVolumeStorageConfig: enterprisev1.StorageClassSpec{ + StorageCapacity: "----", + }, + } + err := addStorageVolumes(&cr, spec, statefulSet, labels) + if err == nil { + t.Errorf("Unable to idenitfy incorrect EtcVolumeStorageConfig resource quantity") + } + + // Define invalid VarVolumeStorageConfig + spec = &enterprisev1.CommonSplunkSpec{ + VarVolumeStorageConfig: enterprisev1.StorageClassSpec{ + StorageCapacity: "----", + }, + } + err = addStorageVolumes(&cr, spec, statefulSet, labels) + if err == nil { + t.Errorf("Unable to idenitfy incorrect VarVolumeStorageConfig resource quantity") + } + +} diff --git a/pkg/splunk/enterprise/indexercluster_test.go b/pkg/splunk/enterprise/indexercluster_test.go index 103769b0f..83c5c4302 100644 --- a/pkg/splunk/enterprise/indexercluster_test.go +++ b/pkg/splunk/enterprise/indexercluster_test.go @@ -990,7 +990,7 @@ func TestInvalidIndexerClusterSpec(t *testing.T) { } cm.Status.Phase = splcommon.PhaseError - cr.Spec.CommonSplunkSpec.EtcStorage = "-abcd" + cr.Spec.CommonSplunkSpec.EtcVolumeStorageConfig.StorageCapacity = "-abcd" if _, err := ApplyIndexerCluster(c, &cr); err == nil { t.Errorf("ApplyIndxerCluster() should have returned error") } diff --git a/pkg/splunk/enterprise/standalone_test.go b/pkg/splunk/enterprise/standalone_test.go index 1bb70d5d8..41318223d 100644 --- a/pkg/splunk/enterprise/standalone_test.go +++ b/pkg/splunk/enterprise/standalone_test.go @@ -200,15 +200,18 @@ func TestGetStandaloneStatefulSet(t *testing.T) { test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-standalone","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997,7777,9000,17000,17500,19000","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-standalone-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-dfsmaster","containerPort":9000,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"},{"name":"tcp-dfccontrol","containerPort":17000,"protocol":"TCP"},{"name":"tcp-datareceive","containerPort":19000,"protocol":"TCP"}],"env":[{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_standalone"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/sbin/checkstate.sh"]},"initialDelaySeconds":300,"timeoutSeconds":30,"periodSeconds":30},"readinessProbe":{"exec":{"command":["/bin/grep","started","/opt/container_artifact/splunk-container.state"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"fsGroup":41812},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-standalone"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-standalone-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0}}`) - cr.Spec.EphemeralStorage = true + cr.Spec.EtcVolumeStorageConfig.EphemeralStorage = true + cr.Spec.VarVolumeStorageConfig.EphemeralStorage = true test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-standalone","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997,7777,9000,17000,17500,19000","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"mnt-splunk-etc","emptyDir":{}},{"name":"mnt-splunk-var","emptyDir":{}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-standalone-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-dfsmaster","containerPort":9000,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"},{"name":"tcp-dfccontrol","containerPort":17000,"protocol":"TCP"},{"name":"tcp-datareceive","containerPort":19000,"protocol":"TCP"}],"env":[{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_standalone"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"mnt-splunk-etc","mountPath":"/opt/splunk/etc"},{"name":"mnt-splunk-var","mountPath":"/opt/splunk/var"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/sbin/checkstate.sh"]},"initialDelaySeconds":300,"timeoutSeconds":30,"periodSeconds":30},"readinessProbe":{"exec":{"command":["/bin/grep","started","/opt/container_artifact/splunk-container.state"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"fsGroup":41812},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-standalone"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"serviceName":"splunk-stack1-standalone-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0}}`) - cr.Spec.EphemeralStorage = false + cr.Spec.EtcVolumeStorageConfig.EphemeralStorage = false + cr.Spec.VarVolumeStorageConfig.EphemeralStorage = false cr.Spec.SparkRef.Name = cr.GetName() test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-standalone","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997,7777,9000,17000,17500,19000","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-standalone-secret-v1","defaultMode":420}},{"name":"mnt-splunk-jdk","emptyDir":{}},{"name":"mnt-splunk-spark","emptyDir":{}}],"initContainers":[{"name":"init","image":"splunk/spark","command":["bash","-c","cp -r /opt/jdk /mnt \u0026\u0026 cp -r /opt/spark /mnt"],"resources":{"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"250m","memory":"128Mi"}},"volumeMounts":[{"name":"mnt-splunk-jdk","mountPath":"/mnt/jdk"},{"name":"mnt-splunk-spark","mountPath":"/mnt/spark"}],"imagePullPolicy":"IfNotPresent"}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-dfsmaster","containerPort":9000,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"},{"name":"tcp-dfccontrol","containerPort":17000,"protocol":"TCP"},{"name":"tcp-datareceive","containerPort":19000,"protocol":"TCP"}],"env":[{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_standalone"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_ENABLE_DFS","value":"true"},{"name":"SPARK_MASTER_HOST","value":"splunk-stack1-spark-master-service"},{"name":"SPARK_MASTER_WEBUI_PORT","value":"8009"},{"name":"SPARK_HOME","value":"/mnt/splunk-spark"},{"name":"JAVA_HOME","value":"/mnt/splunk-jdk"},{"name":"SPLUNK_DFW_NUM_SLOTS_ENABLED","value":"false"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"},{"name":"mnt-splunk-jdk","mountPath":"/mnt/splunk-jdk"},{"name":"mnt-splunk-spark","mountPath":"/mnt/splunk-spark"}],"livenessProbe":{"exec":{"command":["/sbin/checkstate.sh"]},"initialDelaySeconds":300,"timeoutSeconds":30,"periodSeconds":30},"readinessProbe":{"exec":{"command":["/bin/grep","started","/opt/container_artifact/splunk-container.state"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"fsGroup":41812},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-standalone"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-standalone-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0}}`) cr.Spec.ClusterMasterRef.Name = "stack2" - cr.Spec.StorageClassName = "gp2" + cr.Spec.EtcVolumeStorageConfig.StorageClassName = "gp2" + cr.Spec.VarVolumeStorageConfig.StorageClassName = "gp2" cr.Spec.SchedulerName = "custom-scheduler" cr.Spec.Defaults = "defaults-string" cr.Spec.DefaultsURL = "/mnt/defaults/defaults.yml"