Skip to content

Commit

Permalink
fix(interactive): Add PVC support for Insight logs (#4308)
Browse files Browse the repository at this point in the history
This pull request introduces PVCs for the coordinator, frontend, and
stores components within Insight.

For instance, we can get log PVCs as follows:

![image](https://github.com/user-attachments/assets/fcb63fcf-47ce-424a-a955-c168fa0d2c37)

Fixes #4307
  • Loading branch information
BingqingLyu authored Nov 4, 2024
1 parent d22802b commit 25fa9e9
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 17 deletions.
1 change: 1 addition & 0 deletions charts/graphscope-store/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ data:
sudo chown -R graphscope:graphscope {{ .Values.storeDataPath }} || true
sudo chown -R graphscope:graphscope /etc/groot || true
sudo chown -R graphscope:graphscope /var/log/graphscope || true
[[ `hostname` =~ -([0-9]+)$ ]] || exit 1
ordinal=${BASH_REMATCH[1]}
Expand Down
43 changes: 38 additions & 5 deletions charts/graphscope-store/templates/coordinator/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,31 @@ spec:
- name: config
mountPath: /etc/groot/setup.sh
subPath: setup.sh
- name: log
mountPath: {{ .Values.logPersistence.mountPath }}
volumes:
- name: config
configMap:
name: {{ include "graphscope-store.configmapName" . }}
defaultMode: 0755
{{- if and .Values.coordinator.persistence.enabled .Values.coordinator.persistence.existingClaim }}
{{- if and .Values.coordinator.persistence.enabled .Values.coordinator.persistence.existingClaim }}
- name: meta
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.coordinator.persistence.existingClaim .) }}
{{- else if not .Values.coordinator.persistence.enabled }}
{{- else if not .Values.coordinator.persistence.enabled }}
- name: meta
emptyDir: {}
{{- else if and .Values.coordinator.persistence.enabled (not .Values.coordinator.persistence.existingClaim) }}
{{- end }}
{{- if not .Values.logPersistence.enabled }}
- name: log
emptyDir: {}
{{- else if .Values.logPersistence.existingClaim }}
- name: log
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.logPersistence.existingClaim .) }}
{{- end }}
volumeClaimTemplates:
{{- if and .Values.coordinator.persistence.enabled (not .Values.coordinator.persistence.existingClaim) }}
- metadata:
name: meta
{{- if .Values.persistence.annotations }}
Expand All @@ -169,5 +180,27 @@ spec:
{{- if .Values.coordinator.persistence.selector }}
selector: {{- include "graphscope-store.tplvalues.render" (dict "value" .Values.coordinator.persistence.selector "context" $) | nindent 10 }}
{{- end -}}
{{- end }}
{{- end -}}
{{- end }}
{{- if and .Values.logPersistence.enabled (not .Values.logPersistence.existingClaim) }}
- metadata:
name: log
{{- if .Values.persistence.annotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.persistence.labels }}
labels: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.labels "context" $) | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.logPersistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.logPersistence.size | quote }}
{{ include "graphscope-store.storageClass" . | nindent 8 }}
{{- if .Values.logPersistence.selector }}
selector: {{- include "graphscope-store.tplvalues.render" (dict "value" .Values.logPersistence.selector "context" $) | nindent 10 }}
{{- end -}}
{{- end }}
{{- end -}}
33 changes: 33 additions & 0 deletions charts/graphscope-store/templates/frontend/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,42 @@ spec:
- name: config
mountPath: /etc/groot/setup.sh
subPath: setup.sh
- name: log
mountPath: {{ .Values.logPersistence.mountPath }}
volumes:
- name: config
configMap:
name: {{ include "graphscope-store.configmapName" . }}
defaultMode: 0755
{{- if not .Values.logPersistence.enabled }}
- name: log
emptyDir: {}
{{- else if .Values.logPersistence.existingClaim }}
- name: log
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.logPersistence.existingClaim .) }}
{{- end }}
volumeClaimTemplates:
{{- if and .Values.logPersistence.enabled (not .Values.logPersistence.existingClaim) }}
- metadata:
name: log
{{- if .Values.persistence.annotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.persistence.labels }}
labels: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.labels "context" $) | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.logPersistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.logPersistence.size | quote }}
{{ include "graphscope-store.storageClass" . | nindent 8 }}
{{- if .Values.logPersistence.selector }}
selector: {{- include "graphscope-store.tplvalues.render" (dict "value" .Values.logPersistence.selector "context" $) | nindent 10 }}
{{- end -}}
{{- end }}
{{- end }}
41 changes: 37 additions & 4 deletions charts/graphscope-store/templates/onepod/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ spec:
- name: config
mountPath: /etc/groot/setup.sh
subPath: setup.sh
- name: log
mountPath: {{ .Values.logPersistence.mountPath }}
{{- if .Values.store.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.store.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
Expand All @@ -148,15 +150,24 @@ spec:
{{- if .Values.store.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.store.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if and .Values.store.persistence.enabled .Values.store.persistence.existingClaim }}
{{- if and .Values.store.persistence.enabled .Values.store.persistence.existingClaim }}
- name: data
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.store.persistence.existingClaim .) }}
{{- else if not .Values.store.persistence.enabled }}
{{- else if not .Values.store.persistence.enabled }}
- name: data
emptyDir: {}
{{- else if and .Values.store.persistence.enabled (not .Values.store.persistence.existingClaim) }}
{{- end }}
{{- if not .Values.logPersistence.enabled }}
- name: log
emptyDir: {}
{{- else if .Values.logPersistence.existingClaim }}
- name: log
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.logPersistence.existingClaim .) }}
{{- end }}
volumeClaimTemplates:
{{- if and .Values.store.persistence.enabled (not .Values.store.persistence.existingClaim) }}
- metadata:
name: data
{{- if .Values.persistence.annotations }}
Expand All @@ -177,5 +188,27 @@ spec:
{{- if .Values.store.persistence.selector }}
selector: {{- include "graphscope-store.tplvalues.render" (dict "value" .Values.store.persistence.selector "context" $) | nindent 10 }}
{{- end -}}
{{- end }}
{{- end }}
{{- if and .Values.logPersistence.enabled (not .Values.logPersistence.existingClaim) }}
- metadata:
name: log
{{- if .Values.persistence.annotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.persistence.labels }}
labels: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.labels "context" $) | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.logPersistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.logPersistence.size | quote }}
{{ include "graphscope-store.storageClass" . | nindent 8 }}
{{- if .Values.logPersistence.selector }}
selector: {{- include "graphscope-store.tplvalues.render" (dict "value" .Values.logPersistence.selector "context" $) | nindent 10 }}
{{- end -}}
{{- end }}
{{- end }}
41 changes: 37 additions & 4 deletions charts/graphscope-store/templates/store/statefulset-backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ spec:
- name: config
mountPath: /etc/groot/setup.sh
subPath: setup.sh
- name: log
mountPath: {{ .Values.logPersistence.mountPath }}
{{- if .Values.store.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.store.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
Expand All @@ -154,15 +156,24 @@ spec:
{{- if .Values.store.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.store.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if and .Values.store.persistence.enabled .Values.store.persistence.existingClaim }}
{{- if and .Values.store.persistence.enabled .Values.store.persistence.existingClaim }}
- name: data
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.store.persistence.existingClaim .) }}
{{- else if not .Values.store.persistence.enabled }}
{{- else if not .Values.store.persistence.enabled }}
- name: data
emptyDir: {}
{{- else if and .Values.store.persistence.enabled (not .Values.store.persistence.existingClaim) }}
{{- end }}
{{- if not .Values.logPersistence.enabled }}
- name: log
emptyDir: {}
{{- else if .Values.logPersistence.existingClaim }}
- name: log
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.logPersistence.existingClaim .) }}
{{- end }}
volumeClaimTemplates:
{{- if and .Values.store.persistence.enabled (not .Values.store.persistence.existingClaim) }}
- metadata:
name: data
{{- if .Values.persistence.annotations }}
Expand All @@ -183,6 +194,28 @@ spec:
{{- if .Values.store.persistence.selector }}
selector: {{- include "graphscope-store.tplvalues.render" (dict "value" .Values.store.persistence.selector "context" $) | nindent 10 }}
{{- end -}}
{{- end }}
{{- end }}
{{- if and .Values.logPersistence.enabled (not .Values.logPersistence.existingClaim) }}
- metadata:
name: log
{{- if .Values.persistence.annotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.persistence.labels }}
labels: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.labels "context" $) | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.logPersistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.logPersistence.size | quote }}
{{ include "graphscope-store.storageClass" . | nindent 8 }}
{{- if .Values.logPersistence.selector }}
selector: {{- include "graphscope-store.tplvalues.render" (dict "value" .Values.logPersistence.selector "context" $) | nindent 10 }}
{{- end -}}
{{- end }}
{{- end -}}
{{- end -}}
41 changes: 37 additions & 4 deletions charts/graphscope-store/templates/store/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ spec:
- name: config
mountPath: /etc/groot/setup.sh
subPath: setup.sh
- name: log
mountPath: {{ .Values.logPersistence.mountPath }}
{{- if .Values.store.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.store.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
Expand All @@ -150,15 +152,24 @@ spec:
{{- if .Values.store.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.store.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if and .Values.store.persistence.enabled .Values.store.persistence.existingClaim }}
{{- if and .Values.store.persistence.enabled .Values.store.persistence.existingClaim }}
- name: data
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.store.persistence.existingClaim .) }}
{{- else if not .Values.store.persistence.enabled }}
{{- else if not .Values.store.persistence.enabled }}
- name: data
emptyDir: {}
{{- else if and .Values.store.persistence.enabled (not .Values.store.persistence.existingClaim) }}
{{- end }}
{{- if not .Values.logPersistence.enabled }}
- name: log
emptyDir: {}
{{- else if .Values.logPersistence.existingClaim }}
- name: log
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.logPersistence.existingClaim .) }}
{{- end }}
volumeClaimTemplates:
{{- if and .Values.store.persistence.enabled (not .Values.store.persistence.existingClaim) }}
- metadata:
name: data
{{- if .Values.persistence.annotations }}
Expand All @@ -179,5 +190,27 @@ spec:
{{- if .Values.store.persistence.selector }}
selector: {{- include "graphscope-store.tplvalues.render" (dict "value" .Values.store.persistence.selector "context" $) | nindent 10 }}
{{- end -}}
{{- end }}
{{- end }}
{{- if and .Values.logPersistence.enabled (not .Values.logPersistence.existingClaim) }}
- metadata:
name: log
{{- if .Values.persistence.annotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.persistence.labels }}
labels: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.labels "context" $) | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.logPersistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.logPersistence.size | quote }}
{{ include "graphscope-store.storageClass" . | nindent 8 }}
{{- if .Values.logPersistence.selector }}
selector: {{- include "graphscope-store.tplvalues.render" (dict "value" .Values.logPersistence.selector "context" $) | nindent 10 }}
{{- end -}}
{{- end }}
{{- end -}}
21 changes: 21 additions & 0 deletions charts/graphscope-store/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,27 @@ queryExecutionTimeoutMs: 600000
graphPlannerJoinMinPatternSize: 5
graphPlannerCboGlogueSize: 3

## Log Persistence parameters
##
logPersistence:
## Enable persistence using Persistent Volume Claims. If false, use emptyDir
enabled: false
## Existing PVC to hold the log data. If not provided, a new PVC will be created.
existingClaim: ""
## Persistent Volume storage class
storageClass: ""
## Persistent Volume access modes
accessModes:
- ReadWriteOnce
## Persistent Volume size
size: 1Gi
## Persistent Volume annotations
annotations: {}
## Persistent Volume labels
selector: {}
## mountPath for the Persistent Volume
mountPath: "/var/log/graphscope"

## Key-value pair separated by ;
## For example extraConfig="k1=v1;k2=v2"
extraConfig: ""
Expand Down

0 comments on commit 25fa9e9

Please sign in to comment.