Skip to content

Commit

Permalink
Add example for statefulSetOverride
Browse files Browse the repository at this point in the history
- related to issue #143
  • Loading branch information
ChunyiLyu committed Jul 10, 2020
1 parent a8465dd commit 8060f3a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The RabbitMQ for Kubernetes Operator is a way of managing [RabbitMQ](https://www

## Supported Versions

The operator deploys RabbitMQ `3.8.5`, and requires a Kubernetes cluster of `1.16` or above.
The operator deploys RabbitMQ `3.8.5`, and requires a Kubernetes cluster of `1.16` or `1.17`.

## Quickstart

Expand Down
10 changes: 10 additions & 0 deletions docs/examples/additionalVolumes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Additional PersistentVolumeClaim Example

You can leverage StatefulSet override (`spec.Override.StatefulSet`) to modify any property of the statefulSet deployed as part of a RabbitmqCluster instance. `spec.Override.StatefulSet` is in the format of appsv1.StatefulSetSpec. When provided, it will be applied as a patch to the RabbitmqCluster instance StatefulSet definition, using kubernetes [Strategic Merge Patch](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-api-machinery/strategic-merge-patch.md).

The example creates two PersistentVolumeClaim and mounts the additional PersistentVolumeClaim to the `rabbitmq` container.


```shell
kubectl apply -f rabbitmq.yaml
```
45 changes: 45 additions & 0 deletions docs/examples/additionalVolumes/rabbitmq.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
name: sample
spec:
replicas: 1
override:
statefulSet:
spec:
template:
spec:
containers:
- name: rabbitmq
volumeMounts:
- name: additional-disk
mountPath: /var/lib/log
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: persistence
namespace: rabbitmq-system
labels:
"app.kubernetes.io/name": "sample"
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: persistence-foo
namespace: rabbitmq-system
labels:
"app.kubernetes.io/name": "sample"
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

0 comments on commit 8060f3a

Please sign in to comment.