Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #18 from duboisph/svc_type
Browse files Browse the repository at this point in the history
Allow setting SVC type & use ClusterIP default
  • Loading branch information
moxious authored Jun 5, 2020
2 parents 2e40858 + c15b8a4 commit 5a11b57
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: neo4j
home: https://www.neo4j.com
version: 4.0.4-1
version: 4.0.4-2
appVersion: 4.0.4
description: Neo4j is the world's leading graph database
keywords:
Expand Down
20 changes: 19 additions & 1 deletion templates/core-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,27 @@ metadata:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app.kubernetes.io/name: {{ template "neo4j.name" . }}
app.kubernetes.io/component: core
{{- with .Values.core.service.labels }}
{{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.core.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if (or (eq .Values.core.service.type "ClusterIP") (empty .Values.core.service.type)) }}
type: ClusterIP
clusterIP: None
publishNotReadyAddresses: true
{{- else if eq .Values.core.service.type "LoadBalancer" }}
type: LoadBalancer
{{- with .Values.core.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml . | nindent 4 }}
{{- end -}}
{{- else }}
type: {{ .Values.core.service.type }}
{{- end }}
publishNotReadyAddresses: true
ports:
- name: http
port: 7474
Expand Down
24 changes: 21 additions & 3 deletions templates/discovery-lb.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This creates a discovery LB for each member in the core set, and ties to
# This creates a discovery Service for each member in the core set, and ties to
# the use of the Neo4j discovery type "K8S" with the configured selectors.
{{- $dot := . }}
{{- $times := int .Values.core.numberOfServers }}
Expand All @@ -16,9 +16,27 @@ metadata:
helm.sh/chart: "{{ $dot.Chart.Name }}-{{ $dot.Chart.Version }}"
app.kubernetes.io/name: {{ template "neo4j.name" $dot }}
app.kubernetes.io/component: core
{{- with $dot.Values.core.discoveryService.labels }}
{{ toYaml . | nindent 4 }}
{{- end }}
{{- with $dot.Values.core.discoveryService.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
publishNotReadyAddresses: true
{{- if (or (eq $dot.Values.core.discoveryService.type "ClusterIP") (empty $dot.Values.core.discoveryService.type)) }}
type: ClusterIP
clusterIP: None
{{- else if eq $dot.Values.core.discoveryService.type "LoadBalancer" }}
type: LoadBalancer
{{- with $dot.Values.core.discoveryService.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml . | nindent 4 }}
{{- end -}}
{{- else }}
type: {{ $dot.Values.core.discoveryService.type }}
{{- end }}
publishNotReadyAddresses: true
ports:
- name: discovery
port: 5000
Expand Down Expand Up @@ -52,4 +70,4 @@ spec:
{{- end }}
selector:
statefulset.kubernetes.io/pod-name: "{{ template "neo4j.fullname" $dot }}-core-{{ . }}"
{{- end }}
{{- end }}
20 changes: 19 additions & 1 deletion templates/readreplicas-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,27 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name | quote }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app.kubernetes.io/name: {{ template "neo4j.replica.fullname" . }}
app.kubernetes.io/component: core
app.kubernetes.io/component: replica
{{- with .Values.readReplica.service.labels }}
{{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.readReplica.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if (or (eq .Values.readReplica.service.type "ClusterIP") (empty .Values.readReplica.service.type)) }}
type: ClusterIP
clusterIP: None
{{- else if eq .Values.readReplica.service.type "LoadBalancer" }}
type: LoadBalancer
{{- with .Values.readReplica.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml . | nindent 4 }}
{{- end -}}
{{- else }}
type: {{ .Values.readReplica.service.type }}
{{- end }}
publishNotReadyAddresses: true
ports:
- name: http
Expand Down
12 changes: 12 additions & 0 deletions user-guide/USER-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,25 @@ their default values.
| `core.persistentVolume.mountPath` | Persistent Volume mount root path | `/data` |
| `core.persistentVolume.subPath` | Subdirectory of the volume to mount | `nil` |
| `core.persistentVolume.annotations` | Persistent Volume Claim annotations | `{}` |
| `core.service.type` | Service type | `ClusterIP` |
| `core.service.annotations` | Service annotations | `{}` |
| `core.service.labels` | Custom Service labels | `{}` |
| `core.service.loadBalancerSourceRanges` | List of IP CIDRs allowed access to LB (if `core.service.type: LoadBalancer`) | `[]` |
| `core.discoveryService.type` | Service type | `ClusterIP` |
| `core.discoveryService.annotations` | Service annotations | `{}` |
| `core.discoveryService.labels` | Custom Service labels | `{}` |
| `core.discoveryService.loadBalancerSourceRanges` | List of IP CIDRs allowed access to LB (if `core.discoveryService.type: LoadBalancer`) | `[]` |
| `readReplica.configMap` | Configmap providing configuration for RR cluster members. If not specified, defaults that come with the chart will be used. | `$NAME-neo4j-replica-config` |
| `readReplica.numberOfServers` | Number of machines in READ_REPLICA mode | `0` |
| `readReplica.autoscaling.enabled` | Enable horizontal pod autoscaler | `false` |
| `readReplica.autoscaling.targetAverageUtilization` | Target CPU utilization | `70` |
| `readReplica.autoscaling.minReplicas` | Min replicas for autoscaling | `1` |
| `readReplica.autoscaling.maxReplicas` | Max replicas for autoscaling | `3` |
| `readReplica.initContainers` | Init containers to add to the replica pods. Example use case is a script that installs custom plugins/extensions | `{}` |
| `readReplica.service.type` | Service type | `ClusterIP` |
| `readReplica.service.annotations` | Service annotations | `{}` |
| `readReplica.service.labels` | Custom Service labels | `{}` |
| `readReplica.service.loadBalancerSourceRanges` | List of IP CIDRs allowed accessto LB (if `readReplica.service.type: LoadBalancer`) | `[]` |
| `resources` | Resources required (e.g. CPU, memory) | `{}` |
| `clusterDomain` | Cluster domain | `cluster.local` |

Expand Down
33 changes: 31 additions & 2 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,36 @@ core:
# curl -L https://somesite.com/path/to/plugin.jar -O
# cp plugin.jar /plugins/

## This service is intended for clients running in kubernetes to connect to
## the cluster.
## Default: ClusterIP (headless)
service:
type: ClusterIP
annotations: {}
labels: {}
loadBalancerSourceRanges: []

## This creates a discovery Service for each member in the core set, and ties
## to the use of the Neo4j discovery type "K8S" with the configured selectors.
## Default: ClusterIP (headless)
discoveryService:
type: ClusterIP
annotations: {}
labels: {}
loadBalancerSourceRanges: []

# Read Replicas
readReplica:
# configMap: "my-custom-configmap"

resources: {}
# limits:
# cpu: 100m
# memory: 512Mi
# requests:
# cpu: 100m
# memory: 512Mi

autoscaling:
enabled: false
targetAverageUtilization: 70
Expand Down Expand Up @@ -144,6 +164,15 @@ readReplica:
# curl -L https://somesite.com/path/to/plugin.jar -O
# cp plugin.jar /plugins/

## This service is intended for clients running in kubernetes to connect to
## the cluster replica set.
## Default: ClusterIP (headless)
service:
type: ClusterIP
annotations: {}
labels: {}
loadBalancerSourceRanges: []

resources: {}
# limits:
# cpu: 1000m
Expand Down Expand Up @@ -183,7 +212,7 @@ metrics:
server: localhost:2003
interval: 3s
# This will be set to the app name later.
# metrics.prefix=Neo4j_1
# metrics.prefix=Neo4j_1
prometheus:
## Publish metrics for polling as Prometheus endpoint
enabled: false
Expand All @@ -201,4 +230,4 @@ dbms:
initial_size: ""
max_size: ""
pagecache:
size: ""
size: ""

0 comments on commit 5a11b57

Please sign in to comment.