Neo4j init containers (#3047)

* Bump to apiVersion for 1.8 and add selector as required in 1.8

* add mount for plugins so users can add them via an initContainer

* add init containers + fixing some spacing in values.yaml

* init containers for read replicas too

* bump chart version

* back to v1beta1 + don't need to match all labels

* add namespace everywhere
This commit is contained in:
Mark Needham
2018-01-08 02:49:09 -08:00
committed by k8s-ci-robot
parent b05ac8a449
commit 4c2f507494
8 changed files with 77 additions and 17 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
name: neo4j
home: https://www.neo4j.com
version: 0.4.0
version: 0.5.0
appVersion: 3.2.3
description: Neo4j is the world's leading graph database
icon: http://info.neo4j.com/rs/773-GON-065/images/neo4j_logo.png
+2
View File
@@ -60,11 +60,13 @@ their default values.
| `authEnabled` | Is login/password required? | `true` |
| `core.numberOfServers` | Number of machines in CORE mode | `3` |
| `core.sideCarContainers` | Sidecar containers to add to the core pod. Example use case is a sidecar which identifies and labels the leader when using the http API | `{}` |
| `core.initContainers` | Init containers to add to the core pod. Example use case is a script that installs the APOC library | `{}` |
| `core.persistentVolume.storageClass` | Storage class of backing PVC | `standard` (uses beta storage class annotation) |
| `core.persistentVolume.size` | Size of data volume | `10Gi` |
| `core.persistentVolume.mountPath` | Persistent Volume mount root path | `/data` |
| `core.persistentVolume.annotations` | Persistent Volume Claim annotations | `{}` |
| `readReplica.numberOfServers` | Number of machines in READ_REPLICA mode | `0` |
| `readReplica.initContainers` | Init containers to add to the replica pod. Example use case is a script that installs the APOC library | `{}` |
| `resources` | Resources required (e.g. CPU, memory) | `{}` |
The above parameters map to the env variables defined in the
+1 -1
View File
@@ -15,5 +15,5 @@ spec:
targetPort: 7474
selector:
app: {{ template "neo4j.name" . }}
release: {{ .Release.Name }}
release: {{ .Release.Name | quote }}
component: core
+16 -2
View File
@@ -5,6 +5,11 @@ metadata:
spec:
serviceName: {{ template "neo4j.fullname" . }}
replicas: {{ .Values.core.numberOfServers }}
selector:
matchLabels:
release: {{ .Release.Name | quote }}
app: {{ template "neo4j.name" . }}
component: core
template:
metadata:
labels:
@@ -28,7 +33,7 @@ spec:
- name: NEO4J_causal__clustering_discovery__type
value: DNS
- name: NEO4J_causal__clustering_initial__discovery__members
value: "{{ template "neo4j.fullname" . }}.default.svc.cluster.local:5000"
value: "{{ template "neo4j.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:5000"
{{- if .Values.authEnabled }}
- name: NEO4J_SECRETS_PASSWORD
valueFrom:
@@ -72,12 +77,21 @@ spec:
- name: datadir
mountPath: "{{ .Values.core.persistentVolume.mountPath }}"
subPath: "{{ .Values.core.persistentVolume.subPath }}"
volumeMounts:
- name: plugins
mountPath: /plugins
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.core.sidecarContainers }}
{{ toYaml .Values.core.sidecarContainers | indent 6}}
{{- end }}
{{- if .Values.core.initContainers }}
initContainers:
{{ toYaml .Values.core.initContainers | indent 6}}
{{- end }}
volumes:
- name: plugins
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: datadir
@@ -29,7 +29,7 @@ spec:
- name: NEO4J_causal__clustering_discovery__type
value: DNS
- name: NEO4J_causal__clustering_initial__discovery__members
value: "{{ template "neo4j.fullname" . }}.default.svc.cluster.local:5000"
value: "{{ template "neo4j.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:5000"
{{- if .Values.authEnabled }}
- name: NEO4J_SECRETS_PASSWORD
valueFrom:
@@ -61,5 +61,15 @@ spec:
name: bolt
- containerPort: 6000
name: tx
volumeMounts:
- name: plugins
mountPath: /plugins
securityContext:
privileged: true
{{- if .Values.readReplica.initContainers }}
initContainers:
{{ toYaml .Values.readReplica.initContainers | indent 6}}
{{- end }}
volumes:
- name: plugins
emptyDir: {}
@@ -28,7 +28,7 @@ data:
}
for id in {0..2}; do
name="${STATEFULSET_NAME}-core-$id.${STATEFULSET_NAME}.default.svc.cluster.local"
name="${STATEFULSET_NAME}-core-$id.${STATEFULSET_NAME}.${NAMESPACE}.svc.cluster.local"
echo "checking $name"
run check_machine $name
echo $status
@@ -16,6 +16,8 @@ spec:
env:
- name: "STATEFULSET_NAME"
value: "{{ template "neo4j.fullname" . }}"
- name: "NAMESPACE"
value: {{ .Release.Namespace }}
- name: NEO4J_SECRETS_PASSWORD
valueFrom:
secretKeyRef:
+43 -11
View File
@@ -47,18 +47,34 @@ core:
##
subPath: ""
## Pass extra environment variables to the Neo4j container.
##
# extraVars:
# - name: EXTRA_VAR_1
# value: extra-var-value-1
# - name: EXTRA_VAR_2
# value: extra-var-value-2
## Pass extra environment variables to the Neo4j container.
##
# extraVars:
# - name: EXTRA_VAR_1
# value: extra-var-value-1
# - name: EXTRA_VAR_2
# value: extra-var-value-2
sidecarContainers: {}
## Additional containers to be added to the Neo4j core pod.
# - name: my-sidecar
# image: nginx:latest
sidecarContainers: {}
## Additional containers to be added to the Neo4j core pod.
# - name: my-sidecar
# image: nginx:latest
initContainers: {}
## init containers to run before the Neo4j core pod e.g. to install plugins
# - name: init-plugins
# image: "octoberstorm/ubuntu-with-curl:latest"
# imagePullPolicy: "IfNotPresent"
# volumeMounts:
# - name: plugins
# mountPath: /plugins
# command:
# - "/bin/bash"
# - "-c"
# - |
# curl -L https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.2.0.3/apoc-3.2.0.3-all.jar -O
# sudo cp apoc-3.2.0.3-all.jar /plugins/
# Read Replicas
readReplica:
@@ -71,6 +87,22 @@ readReplica:
# - name: EXTRA_VAR_2
# value: extra-var-value-2
initContainers: {}
## init containers to run before the Neo4j replica pod e.g. to install plugins
# - name: init-plugins
# image: "octoberstorm/ubuntu-with-curl:latest"
# imagePullPolicy: "IfNotPresent"
# volumeMounts:
# - name: plugins
# mountPath: /plugins
# command:
# - "/bin/bash"
# - "-c"
# - |
# curl -L https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.2.0.3/apoc-3.2.0.3-all.jar -O
# sudo cp apoc-3.2.0.3-all.jar /plugins/
resources: {}
# limits:
# cpu: 100m