Skip to content

Commit

Permalink
Merge pull request #60 from nats-io/ft-mode-fixes
Browse files Browse the repository at this point in the history
[helm] Add access mode and replicas for FT mode
  • Loading branch information
wallyqs authored May 26, 2020
2 parents dad8b83 + 49e0bfc commit 5ae43ab
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 10 deletions.
2 changes: 1 addition & 1 deletion helm/charts/stan/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords:
- replay
- statefulset
- cncf
version: 0.3.10
version: 0.4.0
maintainers:
- name: Waldemar Quevedo
github: https://github.com/wallyqs
Expand Down
36 changes: 33 additions & 3 deletions helm/charts/stan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ stan:
natsClusterName: my-nats # Name of NATS cluster created by NATS Operator
```
### Number of replicas
In case of using fault tolerance mode, you can set the number of replicas
to be used in the FT group.
```
stan:
replicas: 2
```
Note: in case of using clustering you will always get exactly 3 replicas.
```
store:
cluster:
enabled: true
```
### Server Image
```yaml
Expand Down Expand Up @@ -98,21 +116,33 @@ In case of using a shared volume that supports a `readwritemany`,
you can enable fault tolerance as follows.

```yaml
stan:
replicas: 2 # One replica will be active, other one in standby.
nats:
url: "nats://my-nats:4222"
store:
type: file
#
# Fault tolerance group
#
ft:
group:
group: my-group
#
# File storage settings.
#
file:
path: /data/stan/store
storageSize: 1Gi
# volume for EFS
volume:
mount: /data/stan
storageSize: 100Gi
storageClass: aws-efs
accessModes: ReadWriteMany
```

#### Clustered File Storage
Expand Down Expand Up @@ -208,4 +238,4 @@ affinity:
- nats
- stan
topologyKey: "kubernetes.io/hostname"
```
```
14 changes: 11 additions & 3 deletions helm/charts/stan/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ spec:
{{- if .Values.store.cluster.enabled }}
replicas: 3
{{- else }}
replicas: 1
{{- with .Values.stan.replicas }}
replicas: {{ . }}
{{- end }}
{{- end }}

# NATS Streaming service name
Expand Down Expand Up @@ -89,10 +91,12 @@ spec:
volumeMounts:
- name: config-volume
mountPath: /etc/stan-config
{{- if eq .Values.store.type "file" }}
{{- if .Values.store.volume.enabled }}
- name: {{ template "stan.name" . }}-pvc
mountPath: {{ .Values.store.volume.mount }}
{{- end }}
{{- end }}
{{ if .Values.exporter.enabled }}
- name: metrics
image: {{ .Values.exporter.image }}
Expand All @@ -108,6 +112,7 @@ spec:
- containerPort: 7777
name: metrics
{{ end }}
{{- if eq .Values.store.type "file" }}
{{- if .Values.store.volume.enabled }}
volumeClaimTemplates:
- metadata:
Expand All @@ -117,8 +122,11 @@ spec:
storageClassName: {{ . }}
{{- end }}
accessModes:
- ReadWriteOnce
{{- with .Values.store.volume.accessModes }}
- {{ . }}
{{- end }}
resources:
requests:
storage: {{ .Values.store.volume.storageSize }}
{{- end }}
{{- end }}
{{- end }}
8 changes: 5 additions & 3 deletions helm/charts/stan/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
stan:
image: nats-streaming:0.17.0
pullPolicy: IfNotPresent
replicas: 1

# Cluster name, generated into a name from the
# release name by default.
Expand Down Expand Up @@ -63,13 +64,14 @@ store:

#
# Volume claim configuration. Required if the store type is `file` or if
# cluster it's enabled.
# cluster is enabled.
#
volume:
enabled: true
mount: /data/stan
storageSize: 100Gi
storageClass:
storageSize: 1Gi
accessModes: ReadWriteOnce
storageClass:

#
# File storage settings.
Expand Down

0 comments on commit 5ae43ab

Please sign in to comment.