Skip to content

add support for existingClaim in secondary #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions helm/templates/secondary/statefulset-secondary-rs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ spec:
dnsPolicy: ClusterFirstWithHostNet
{{- end }}
volumes:
{{- if .Values.persistence.existingClaimSecondary }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if there are multiple secondaries in the replica set?

- name: mongo-persistent-storage
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaimSecondary | quote }}
{{- end }}
- name: config
configMap:
name: {{ template "mongodb.fullname" . }}
Expand All @@ -185,6 +190,7 @@ spec:
- key: mongodb-replica-set-key
path: mongodb-replica-set-key
{{- end }}
{{- if not .Values.persistence.existingClaimSecondary }}
volumeClaimTemplates:
- metadata:
name: mongo-persistent-storage
Expand All @@ -197,4 +203,5 @@ spec:
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion helm/templates/standalone/statefulset-standalone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
volumeMounts:
- name: mongo-persistent-storage
mountPath: {{ .Values.persistence.mountPath }}
subPath: {{ .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath | quote }}
- name: config
mountPath: /etc/mongodb
resources:
Expand Down
3 changes: 3 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ persistence:
storageClassName: "standard"
accessModes: ["ReadWriteOnce"]
size: 2Gi
## Use existing PVC
# existingClaim: "primary-pvc-name"
# existingClaimSecondary: "secondary-pvc-name"

## Configure extra options for liveness and readiness probes
livenessProbe:
Expand Down
Loading