Skip to content

Commit

Permalink
feat: add persistent logs for drill
Browse files Browse the repository at this point in the history
  • Loading branch information
philipsens committed Sep 21, 2023
1 parent 084822e commit 1cd640f
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 38 deletions.
2 changes: 1 addition & 1 deletion charts/drill/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: drill
version: 1.2.3
version: 1.2.4
appVersion: 1.21.1
description: Helm Charts for deploying Apache Drill Clusters on Kubernetes
icon: https://raw.githubusercontent.com/wearefrank/charts/master/charts/drill/icon.svg
Expand Down
48 changes: 48 additions & 0 deletions charts/drill/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,51 @@ For more options refer to the [Apache Drill documentation](https://drill.apache.
| `drill.authentication.users.name` | Username for the user | `""` |
| `drill.authentication.users.password` | Password for the user | `""` |
| `drill.authentication.users.admin` | Configures if the user should be admin | `""` |

### Persistence

Persistence is currently only for login. Configuration for Drill will be saved in ZooKeeper. Make sure that ZooKeeper is persistent if you want to keep changes in the Web UI.


### End

@sectionEnd

@param persistence.enabled Enable persistence using Persistent Volume Claims

@param persistence.storageClass Persistent Volume storage class
If defined, storageClassName: <storageClass>
If set to "-", storageClassName: "", which disables dynamic provisioning
If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner

@param persistence.accessModes [array] Persistent Volume access modes

@param persistence.size Persistent Volume size

@param persistence.dataSource Custom PVC data source

@param persistence.existingClaim The name of an existing PVC to use for persistence

@param persistence.selector Selector to match an existing Persistent Volume for WordPress data PVC
If set, the PVC can't have a PV dynamically provisioned for it
E.g.
selector:
matchLabels:
app: my-app

@param persistence.annotations Persistent Volume Claim annotations
You might need to add an annotation for selected node:
E.g: volume.kubernetes.io/selected-node: nodeName
Ref: https://kubernetes.io/docs/reference/labels-annotations-taints/#volume-kubernetes-io-selected-node


| Name | Description | Value |
| --------------------------- | ---------------------------------------------------------------------- | ------- |
| `persistence.enabled` | Enable persistence using Persistent Volume Claims | `false` |
| `persistence.storageClass` | Persistent Volume storage class | `""` |
| `persistence.accessModes` | Persistent Volume access modes | `[]` |
| `persistence.size` | Persistent Volume size | `2Gi` |
| `persistence.dataSource` | Custom PVC data source | `{}` |
| `persistence.existingClaim` | The name of an existing PVC to use for persistence | `""` |
| `persistence.selector` | Selector to match an existing Persistent Volume for WordPress data PVC | `{}` |
| `persistence.annotations` | Persistent Volume Claim annotations | `{}` |
1 change: 1 addition & 0 deletions charts/drill/templates/_labels.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ Selector labels
*/}}
{{- define "drill.selectorLabels" -}}
app.kubernetes.io/name: {{ include "drill.name" . }}
app.kubernetes.io/component: {{ include "drill.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
33 changes: 33 additions & 0 deletions charts/drill/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ spec:
- mountPath: /etc/passwd
name: {{ template "drill.fullname" . }}-users
subPath: passwd
- name: {{ template "drill.fullname" . }}-logs
mountPath: /opt/drill/logs
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
volumes:
- name: {{ template "drill.fullname" . }}-override
Expand All @@ -101,7 +103,38 @@ spec:
{{- else }}
secretName: {{ template "drill.fullname" . }}-users
{{- end }}
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
- name: {{ template "drill.fullname" . }}-logs
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim }}
{{- else if (not .Values.persistence.enabled) }}
- name: {{ template "drill.fullname" . }}-logs
emptyDir: {}
{{- end}}
initContainers:
- name: zookeeper-available
image: busybox
command: [ 'sh', '-c', 'until nc -z {{ include "zookeeper.fullname" . }} 2181; do echo Waiting for ZooKeeper to come up; sleep 5; done; ' ]
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
volumeClaimTemplates:
- metadata:
name: {{ template "drill.fullname" . }}-logs
labels:
{{- include "drill.labels" . | nindent 10 }}
{{- if .Values.persistence.annotations }}
annotations:
{{- toYaml .Values.persistence.annotations | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
selector:
{{- toYaml .Values.persistence.selector | nindent 10 }}
storageClassName: {{ .Values.persistence.storageClass | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}

50 changes: 50 additions & 0 deletions charts/drill/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,56 @@
}
}
}
},
"persistence": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"description": "Enable persistence using Persistent Volume Claims",
"default": false
},
"storageClass": {
"type": "string",
"description": "Persistent Volume storage class",
"default": ""
},
"accessModes": {
"type": "array",
"description": "Persistent Volume access modes",
"default": [
"ReadWriteOnce"
],
"items": {
"type": "string"
}
},
"size": {
"type": "string",
"description": "Persistent Volume size",
"default": "2Gi"
},
"dataSource": {
"type": "object",
"description": "Custom PVC data source",
"default": {}
},
"existingClaim": {
"type": "string",
"description": "The name of an existing PVC to use for persistence",
"default": ""
},
"selector": {
"type": "object",
"description": "Selector to match an existing Persistent Volume for WordPress data PVC",
"default": {}
},
"annotations": {
"type": "object",
"description": "Persistent Volume Claim annotations",
"default": {}
}
}
}
}
}
79 changes: 42 additions & 37 deletions charts/drill/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -295,40 +295,45 @@ drill:
##
users: []

#persistence:
# ## @param persistence.enabled Enable persistence using Persistent Volume Claims
# ##
# enabled: true
# ## @param persistence.storageClass Persistent Volume storage class
# ## If defined, storageClassName: <storageClass>
# ## If set to "-", storageClassName: "", which disables dynamic provisioning
# ## If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner
# ##
# storageClass: ""
# ## @param persistence.accessModes [array] Persistent Volume access modes
# ##
# accessModes:
# - ReadWriteOnce
# ## @param persistence.accessMode Persistent Volume access mode (DEPRECATED: use `persistence.accessModes` instead)
# ##
# accessMode: ReadWriteOnce
# ## @param persistence.size Persistent Volume size
# ##
# size: 10Gi
# ## @param persistence.dataSource Custom PVC data source
# ##
# dataSource: {}
# ## @param persistence.existingClaim The name of an existing PVC to use for persistence
# ##
# existingClaim: ""
# ## @param persistence.selector Selector to match an existing Persistent Volume for WordPress data PVC
# ## If set, the PVC can't have a PV dynamically provisioned for it
# ## E.g.
# ## selector:
# ## matchLabels:
# ## app: my-app
# ##
# selector: {}
# ## @param persistence.annotations Persistent Volume Claim annotations
# ##
# annotations: {}
## @section Persistence
## @descriptionStart
## Persistence is currently only for login. Configuration for Drill will be saved in ZooKeeper. Make sure that ZooKeeper is persistent if you want to keep changes in the Web UI.
## @sectionEnd
##
persistence:
## @param persistence.enabled Enable persistence using Persistent Volume Claims
##
enabled: false
## @param persistence.storageClass Persistent Volume storage class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner
##
storageClass: ""
## @param persistence.accessModes [array] Persistent Volume access modes
##
accessModes:
- ReadWriteOnce
## @param persistence.size Persistent Volume size
##
size: 2Gi
## @param persistence.dataSource Custom PVC data source
##
dataSource: {}
## @param persistence.existingClaim The name of an existing PVC to use for persistence
##
existingClaim: ""
## @param persistence.selector Selector to match an existing Persistent Volume for WordPress data PVC
## If set, the PVC can't have a PV dynamically provisioned for it
## E.g.
## selector:
## matchLabels:
## app: my-app
##
selector: {}
## @param persistence.annotations Persistent Volume Claim annotations
## You might need to add an annotation for selected node:
## E.g: volume.kubernetes.io/selected-node: nodeName
## Ref: https://kubernetes.io/docs/reference/labels-annotations-taints/#volume-kubernetes-io-selected-node
##
annotations: {}

0 comments on commit 1cd640f

Please sign in to comment.