Skip to content

Commit

Permalink
move additional volume doc to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarroll1 committed Jan 6, 2025
1 parent 3cb870b commit 9d4cfcb
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 56 deletions.
56 changes: 0 additions & 56 deletions docs/solr-cloud/solr-cloud-crd.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,62 +71,6 @@ These options can be found in `SolrCloud.spec.dataStorage`
- **`emptyDir`** - An [`emptyDir` volume source](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) that describes the desired emptyDir volume to use in each SolrCloud pod to store data.
- **`hostPath`** - A [`hostPath` volume source](https://kubernetes.io/docs/concepts/storage/volumes/#hostpath) that describes the desired hostPath volume to use in each SolrCloud pod to store data.


### Mounting Additional Volumes

It is also possible to mount additional volumes to the SolrCloud (or its initContainers). Some example scenarios where you might use this would be:
- Custom solr plugins that rely on certain data to be present on disk
- Bootstrapping additional configuration for Solr via a ConfigMap
- A dedicated volume to support backups

Below is an example of the last scenario:

```yaml
apiVersion: solr.apache.org/v1beta1
kind: SolrCloud
metadata:
name: test
namespace: test
spec:
replicas: 1
customSolrKubeOptions:
podOptions:
volumes:
- source:
persistentVolumeClaim:
claimName: backup-data-pvc
name: backup-data
defaultContainerMount:
mountPath: /var/solr/data/backup
name: backup-data
initContainers:
- name: chmod-backup
image: busybox:1.28.0-glibc
command:
- "chmod"
- "-R"
- "766"
- "/var/solr/data/backup"
volumeMounts:
- name: backup-data
mountPath: /var/solr/data/backup

---
# Volume itself provisioned elsewhere
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: backup-data-pvc
namespace: test
spec:
storageClassName: "" # Implementation specific
volumeName: backup-data
accessModes:
- ReadWriteMany
```
Note the `source` spec may change based on the implementation. In this case, the `persisentVolumeClaim` spec requires field `claimName`.

## Update Strategy
_Since v0.2.7_

Expand Down
52 changes: 52 additions & 0 deletions example/test_solrcloud_additional_volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Mounting Additional Volumes
#
# It is also possible to mount additional volumes to the SolrCloud (or its initContainers). Some example scenarios where you might use this would be:
# - Custom solr plugins that rely on certain data to be present on disk
# - Bootstrapping additional configuration for Solr via a ConfigMap
#
# Below is an example of the last scenario:

apiVersion: solr.apache.org/v1beta1
kind: SolrCloud
metadata:
name: test
namespace: test
spec:
replicas: 1
customSolrKubeOptions:
podOptions:
volumes:
- source:
configMap:
name: configset
defaultMode: 0777
name: configset
defaultContainerMount:
mountPath: /configset
name: configset
sidecarContainers:
- name: config-loader
image: alpine/curl:latest
command:
- "sh"
- "-c"
- "ls -la /configset"
volumeMounts:
- name: configset
mountPath: /configset

# Note the `source` spec may change based on the implementation. In this case, the `configMap` spec requires field `name`.
# See volume spec in CRD: https://github.com/apache/solr-operator/blob/main/config/crd/bases/solr.apache.org_solrclouds.yaml#L6800

---
kind: ConfigMap
apiVersion: v1
metadata:
name: configset
namespace: test
data:
config.xml: |
<?xml version="1.0" encoding="UTF-8" ?>
<config>
...
</config>

0 comments on commit 9d4cfcb

Please sign in to comment.