mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
[stable/neo4j] Update Neo4j to 3.3.4 (#5172)
* update neo4j chart * updates neo4j to 3.3.4 * Adds pod disruption budget * Removes privileged security context * Adds delete hook annotation to test pod * Reorganizes tests so they pass on clusters with rbac enabled, example: gke-1.9.6 * require explicit agreement to neo4j license * switch to using default instead of required See: https://github.com/kubernetes/helm/issues/2347 * print error when license is not accepted
This commit is contained in:
committed by
k8s-ci-robot
parent
afacb43ec1
commit
0011b17cff
@@ -1,7 +1,7 @@
|
||||
name: neo4j
|
||||
home: https://www.neo4j.com
|
||||
version: 0.7.1
|
||||
appVersion: 3.2.3
|
||||
version: 0.7.2
|
||||
appVersion: 3.3.4
|
||||
description: Neo4j is the world's leading graph database
|
||||
icon: http://info.neo4j.com/rs/773-GON-065/images/neo4j_logo.png
|
||||
sources:
|
||||
|
||||
@@ -20,15 +20,19 @@ deployment on a [Kubernetes](http://kubernetes.io) cluster using the
|
||||
|
||||
* Kubernetes 1.6+ with Beta APIs enabled
|
||||
* PV provisioner support in the underlying infrastructure
|
||||
* Requires the following variables
|
||||
You must add `acceptLicenseAgreement` in the values.yaml file and set it to `yes` or include `--set acceptLicenseAgreement=yes` in the command line of helm install to accept the license.
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `neo4j-helm`:
|
||||
|
||||
```bash
|
||||
$ helm install --name neo4j-helm stable/neo4j --set neo4jPassword=mySecretPassword
|
||||
$ helm install --name neo4j-helm stable/neo4j --set acceptLicenseAgreement=yes --set neo4jPassword=mySecretPassword
|
||||
```
|
||||
|
||||
You must explicitly accept the neo4j license agreement for the installation to be successful.
|
||||
|
||||
The command deploys Neo4j on the Kubernetes cluster in the default configuration
|
||||
but with the password set to `mySecretPassword`. The
|
||||
[configuration](#configuration) section lists the parameters that can be
|
||||
@@ -57,6 +61,7 @@ their default values.
|
||||
| `image` | Neo4j image | `neo4j` |
|
||||
| `imageTag` | Neo4j version | `{VERSION}` |
|
||||
| `imagePullPolicy` | Image pull policy | `IfNotPresent` |
|
||||
| `podDisruptionBudget` | Pod disruption budget | `{}` |
|
||||
| `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 | `{}` |
|
||||
@@ -91,3 +96,5 @@ $ helm install --name neo4j-helm -f values.yaml stable/neo4j
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
Once you have all 3 pods in running, you can run the "test.sh" script in this directory, which will verify the role attached to each pod and also test recovery of a failed/deleted pod. This script requires that the $RELEASE_NAME environment variable be set, in order to access the pods, if you have specified a custom `namespace` or `replicas` value when installing you can set those via `RELEASE_NAMESPACE` and `CORE_REPLICAS` environment variables for this script.
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
acceptLicenseAgreement: "yes"
|
||||
@@ -1,3 +1,8 @@
|
||||
{{- if and (ne "yes" .Values.acceptLicenseAgreement) (contains "enterprise" .Values.imageTag)}}
|
||||
#### ERROR: You did not accept the Neo4j Enterprise License. ####
|
||||
#### ERROR: Please set acceptLicenseAgreement to yes. ####
|
||||
###################################################################
|
||||
{{- else }}
|
||||
We'll need to wait a few seconds for the Neo4j cluster to form.
|
||||
We need to see this line in all of our pods' logs:
|
||||
|
||||
@@ -13,7 +18,7 @@ kubectl run -it --rm cypher-shell \
|
||||
--image=neo4j:3.2.3-enterprise \
|
||||
--restart=Never \
|
||||
--namespace {{ .Release.Namespace }} \
|
||||
--command -- ./bin/cypher-shell -u neo4j -p <password> --a {{ printf "%s-%s" .Release.Name .Values.name | trunc 56 }}.default.svc.cluster.local "call dbms.cluster.overview()"
|
||||
--command -- ./bin/cypher-shell -u neo4j -p <password> --a {{ printf "%s-%s" .Release.Name .Values.name | trunc 56 }}.{{ printf "%s" .Release.Namespace }}.svc.cluster.local "call dbms.cluster.overview()"
|
||||
|
||||
This will print out the addresses of the members of the cluster.
|
||||
|
||||
@@ -22,4 +27,5 @@ You'll need to substitute <password> with the password you set when installing t
|
||||
If you didn't set a password, one will be auto generated.
|
||||
You can find the base64 encoded version of the password by running the following command:
|
||||
|
||||
kubectl get secrets {{ template "neo4j.secrets.fullname" . }} -o yaml
|
||||
kubectl get secrets {{ template "neo4j.secrets.fullname" . }} -o yaml
|
||||
{{- end}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: "apps/v1beta1"
|
||||
apiVersion: "apps/v1beta2"
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: "{{ template "neo4j.core.fullname" . }}"
|
||||
@@ -24,6 +24,8 @@ spec:
|
||||
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
|
||||
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
|
||||
env:
|
||||
- name: NEO4J_ACCEPT_LICENSE_AGREEMENT
|
||||
value: "{{ .Values.acceptLicenseAgreement }}"
|
||||
- name: NEO4J_dbms_mode
|
||||
value: CORE
|
||||
- name: NUMBER_OF_CORES
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.podDisruptionBudget -}}
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "neo4j.name" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "neo4j.fullname" . }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "neo4j.name" . }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
{{ toYaml .Values.podDisruptionBudget | indent 2 }}
|
||||
{{- end -}}
|
||||
@@ -11,61 +11,41 @@ data:
|
||||
run.sh: |-
|
||||
@test "Testing Neo4j cluster has quorum" {
|
||||
echo "checking if the cluster is up"
|
||||
check_machine() {
|
||||
name=$1
|
||||
end="$((SECONDS+90))"
|
||||
path="data"
|
||||
for id in $(seq 0 $((CORE_REPLICAS - 1))); do
|
||||
host="${STATEFULSET_NAME}-core-$id.${STATEFULSET_NAME}.${NAMESPACE}.svc.cluster.local"
|
||||
auth="neo4j:${NEO4J_SECRETS_PASSWORD}"
|
||||
url="http://${auth}@${host}:7474/db/${path}"
|
||||
attempts=10
|
||||
attempt=0
|
||||
while true; do
|
||||
echo "testing http://neo4j:${NEO4J_SECRETS_PASSWORD}@$name:7474/db/data"
|
||||
out=`wget http://neo4j:${NEO4J_SECRETS_PASSWORD}@$name:7474/db/data -O - 2>&1`
|
||||
echo "out: $out"
|
||||
wget http://neo4j:${NEO4J_SECRETS_PASSWORD}@$name:7474/db/data -O - 2>&1
|
||||
response_code=$?
|
||||
echo "response: $response_code"
|
||||
[[ "0" = "$response_code" ]] && break
|
||||
[[ "${SECONDS}" -ge "${end}" ]] && exit 1
|
||||
sleep 1
|
||||
attempt=$[$attempt + 1]
|
||||
echo "Try $attempt: Connecting to $host:7474/db/${path}"
|
||||
run wget ${url} -qO- 2>&1
|
||||
echo "Exit code: $status"
|
||||
[ $status -eq 0 ] && break
|
||||
[ "${attempt}" -ge "${attempts}" ] && exit 1
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
||||
for id in {0..2}; do
|
||||
name="${STATEFULSET_NAME}-core-$id.${STATEFULSET_NAME}.${NAMESPACE}.svc.cluster.local"
|
||||
echo "checking $name"
|
||||
run check_machine $name
|
||||
echo $status
|
||||
echo $output
|
||||
[ "$status" -eq 0 ]
|
||||
done
|
||||
}
|
||||
|
||||
@test "Testing we can get the cluster role of each server" {
|
||||
check_role() {
|
||||
name=$1
|
||||
end="$((SECONDS+90))"
|
||||
@test "Testing Neo4j core servers are available" {
|
||||
echo "checking if nodes are available"
|
||||
path="manage/server/core/available"
|
||||
for id in $(seq 0 $((CORE_REPLICAS - 1))); do
|
||||
host="${STATEFULSET_NAME}-core-$id.${STATEFULSET_NAME}.${NAMESPACE}.svc.cluster.local"
|
||||
auth="neo4j:${NEO4J_SECRETS_PASSWORD}"
|
||||
url="http://${auth}@${host}:7474/db/${path}"
|
||||
attempts=10
|
||||
attempt=0
|
||||
while true; do
|
||||
echo "checking cluster role: $name"
|
||||
kubectl exec $name -- bin/cypher-shell -u neo4j -p ${NEO4J_SECRETS_PASSWORD} "call dbms.cluster.role()"
|
||||
response_code=$?
|
||||
echo "response: $response_code"
|
||||
[[ "0" = "$response_code" ]] && break
|
||||
[[ "${SECONDS}" -ge "${end}" ]] && exit 1
|
||||
sleep 1
|
||||
attempt=$[$attempt + 1]
|
||||
echo "Try $attempt: Connecting to $host:7474/db/${path}"
|
||||
response=$(wget ${url} -qO- 2>&1)
|
||||
[ "$response" = "true" ] && break
|
||||
[ "${attempt}" -ge "${attempts}" ] && exit 1
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
||||
for id in {0..2}; do
|
||||
name="${STATEFULSET_NAME}-core-$id"
|
||||
echo "checking role of $name"
|
||||
run check_role $name
|
||||
echo $status
|
||||
echo $output
|
||||
[ "$status" -eq 0 ]
|
||||
done
|
||||
|
||||
# kill a machine and make sure it comes back again
|
||||
machine_to_kill="${STATEFULSET_NAME}-core-0"
|
||||
kubectl delete pod ${machine_to_kill}
|
||||
run check_role ${machine_to_kill}
|
||||
echo $status
|
||||
echo $output
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ metadata:
|
||||
app: {{ template "neo4j.name" . }}
|
||||
annotations:
|
||||
"helm.sh/hook": test-success
|
||||
"helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Release.Name }}-ui-test
|
||||
@@ -16,6 +17,8 @@ spec:
|
||||
env:
|
||||
- name: "STATEFULSET_NAME"
|
||||
value: "{{ template "neo4j.fullname" . }}"
|
||||
- name: "CORE_REPLICAS"
|
||||
value: "{{ .Values.core.numberOfServers }}"
|
||||
- name: "NAMESPACE"
|
||||
value: {{ .Release.Namespace }}
|
||||
- name: NEO4J_SECRETS_PASSWORD
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
NS="${RELEASE_NAMESPACE:-default}"
|
||||
STATEFULSET_NAME="${RELEASE_NAME:-neo4j}-neo4j"
|
||||
NEO4J_SECRETS_PASSWORD=$(kubectl get secret -n ${NS} ${RELEASE_NAME}-neo4j-secrets -o jsonpath='{.data.neo4j-password}' | base64 --decode)
|
||||
CORE_REPLICAS=${REPLICAS:-3}
|
||||
|
||||
echo "Testing we can get the cluster role of each server in statefulset ${STATEFULSET_NAME} in namespace: ${NS}"
|
||||
|
||||
check_role() {
|
||||
name=$1
|
||||
end="$((SECONDS+120))"
|
||||
while true; do
|
||||
echo "checking cluster role: ${name}"
|
||||
kubectl exec ${name} -n ${NS} -- bin/cypher-shell -u neo4j -p ${NEO4J_SECRETS_PASSWORD} "call dbms.cluster.role()" 2>/dev/null
|
||||
response_code=$?
|
||||
[[ "0" = "$response_code" ]] && break
|
||||
[[ "${SECONDS}" -ge "${end}" ]] && exit 1
|
||||
echo "waiting for connection to pod: ${name}"
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
||||
for num in $(seq $CORE_REPLICAS); do
|
||||
id=$(expr $num - 1)
|
||||
name="${STATEFULSET_NAME}-core-$id"
|
||||
echo "checking role of $name"
|
||||
check_role $name
|
||||
done
|
||||
|
||||
# kill a machine and make sure it comes back again
|
||||
machine_to_kill="${STATEFULSET_NAME}-core-0"
|
||||
echo "Testing recovery after failed/deleted pod"
|
||||
echo "Deleting pod: ${machine_to_kill}"
|
||||
kubectl delete pod ${machine_to_kill} -n ${NS}
|
||||
check_role ${machine_to_kill}
|
||||
echo "Pod recovered successfully!"
|
||||
@@ -7,9 +7,13 @@ name: "neo4j"
|
||||
|
||||
# Specs for the Neo4j docker image
|
||||
image: "neo4j"
|
||||
imageTag: "3.2.3-enterprise"
|
||||
imageTag: "3.3.4-enterprise"
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
# imagePullSecret: registry-secret
|
||||
acceptLicenseAgreement: "no"
|
||||
podDisruptionBudget: {}
|
||||
# minAvailable: 2
|
||||
# maxUnavailable: 1
|
||||
|
||||
# Use password authentication
|
||||
authEnabled: true
|
||||
|
||||
Reference in New Issue
Block a user