Skip to content

Commit

Permalink
Allow to set service annotations and externalTrafficPolicy (#185)
Browse files Browse the repository at this point in the history
* Allow to set service annotations and externalTrafficPolicy

* Additional service.loadBalancerSourceRanges setting

* Additional settings healthCheckNodePort and clusterIP

* Bump version

* Fix for "error calling eq: incompatible types for comparison"
  • Loading branch information
dex4er authored Feb 8, 2021
1 parent 460fddd commit d40fc0b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 11 deletions.
2 changes: 1 addition & 1 deletion charts/netdata/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: netdata
version: 3.4.3
version: 3.5.0
description: Real-time performance monitoring, done right!
type: application
keywords:
Expand Down
8 changes: 7 additions & 1 deletion charts/netdata/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Netdata Helm chart for Kubernetes deployments

[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/netdata)](https://artifacthub.io/packages/search?repo=netdata) ![Version: 3.4.3](https://img.shields.io/badge/Version-3.4.3-informational) ![AppVersion: v1.29.0](https://img.shields.io/badge/AppVersion-v1.29.0-informational)
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/netdata)](https://artifacthub.io/packages/search?repo=netdata) ![Version: 3.5.0](https://img.shields.io/badge/Version-3.5.0-informational) ![AppVersion: v1.29.0](https://img.shields.io/badge/AppVersion-v1.29.0-informational)

_Based on the work of varyumin (https://github.com/varyumin/netdata)_.

Expand Down Expand Up @@ -89,6 +89,11 @@ The following table lists the configurable parameters of the netdata chart and t
| `service.type` | Parent service type | `ClusterIP` |
| `service.port` | Parent service port | `19999` |
| `service.loadBalancerIP` | Static LoadBalancer IP, only to be used with service type=LoadBalancer | `""` |
| `service.loadBalancerSourceRanges` | List of allowed IPs for LoadBalancer | `[]` |
| `service.externalTrafficPolicy` | Denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints | `Cluster` |
| `service.healthCheckNodePort` | Specifies the health check node port | Allocated a port from your cluster's NodePort range |
| `service.clusterIP` | Specific cluster IP when service type is cluster IP. Use `None` for headless service | Allocated an IP from your cluster's service IP range |
| `service.annotations` | Additional annotations to add to the service | `{}` |
| `ingress.enabled` | Create Ingress to access the netdata web UI | `true` |
| `ingress.annotations` | Associate annotations to the Ingress | `kubernetes.io/ingress.class: nginx` and `kubernetes.io/tls-acme: "true"` |
| `ingress.path` | URL path for the ingress | `/` |
Expand All @@ -99,6 +104,7 @@ The following table lists the configurable parameters of the netdata chart and t
| `serviceAccount.name` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template. | `netdata` |
| `clusterrole.name` | Name of the cluster role linked with the service account | `netdata` |
| `APIKEY` | The key shared between the parent and the child netdata for streaming | `11111111-2222-3333-4444-555555555555` |
| `parent.port` | Parent's listen port | `19999` |
| `parent.resources` | Resources for the parent deployment | `{}` |
| `parent.livenessProbe.failureThreshold` | When a liveness probe fails, Kubernetes will try failureThreshold times before giving up. Giving up the liveness probe means restarting the container | `3` |
| `parent.livenessProbe.periodSeconds` | How often (in seconds) to perform the liveness probe | `30` |
Expand Down
4 changes: 2 additions & 2 deletions charts/netdata/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: NETDATA_LISTENER_PORT
value: '{{ .Values.service.port }}'
value: '{{ .Values.parent.port }}'
{{- range $key, $value := .Values.parent.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
containerPort: {{ .Values.parent.port }}
protocol: TCP
livenessProbe:
httpGet:
Expand Down
21 changes: 20 additions & 1 deletion charts/netdata/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,30 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
role: parent
annotations:
{{- with .Values.service.annotations }}
{{ toYaml . | trim | indent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if .Values.service.loadBalancerIP }}
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- with .Values.service.loadBalancerSourceRanges }}
{{ toYaml . | trim | indent 4 }}
{{- end }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- if and (eq .Values.service.externalTrafficPolicy "Local") .Values.service.healthCheckNodePort }}
healthCheckNodePort: {{ .Values.service.healthCheckNodePort }}
{{- end }}
{{- end }}
{{- if and (eq .Values.service.type "ClusterIP") .Values.service.clusterIP }}
clusterIP: {{ .Values.service.clusterIP }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
Expand Down
20 changes: 14 additions & 6 deletions charts/netdata/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,15 @@ wgetImage:
service:
type: ClusterIP
port: 19999
# Use a static loadBalancerIP. Only to be used with type LoadBalancer
annotations: {}
## Only to be used with type LoadBalancer
# loadBalancerIP: 10.0.1.69
# loadBalancerSourceRanges: []
# externalTrafficPolicy: Local
## Only to be used with type LoadBalancer and external traffic policy Local
# healthCheckNodePort:
## Only to be used with type ClusterIP
# clusterIP: 10.1.2.3

ingress:
enabled: true
Expand All @@ -70,6 +77,7 @@ serviceAccount:


parent:
port: 19999
resources: {}
# limits:
# cpu: 4
Expand Down Expand Up @@ -100,7 +108,7 @@ parent:
priorityClassName: ""

env: {}
# To disable anonymous statistics:
## To disable anonymous statistics:
# DO_NOT_TRACK: 1

podLabels: {}
Expand All @@ -109,13 +117,13 @@ parent:

database:
persistence: true
# Set '-' as the storageclass to get a volume from the default storage class.
## Set '-' as the storageclass to get a volume from the default storage class.
storageclass: "-"
volumesize: 2Gi

alarms:
persistence: true
# Set '-' as the storageclass to get a volume from the default storage class.
## Set '-' as the storageclass to get a volume from the default storage class.
storageclass: "-"
volumesize: 100Mi

Expand Down Expand Up @@ -188,7 +196,7 @@ parent:

child:
enabled: true
port: "{{ .Values.service.port }}"
port: "{{ .Values.parent.port }}"

updateStrategy: {}
# type: RollingUpdate
Expand Down Expand Up @@ -287,7 +295,7 @@ child:
- url: http://127.0.0.1:10249/metrics
env: {}
# To disable anonymous statistics:
## To disable anonymous statistics:
# DO_NOT_TRACK: 1

claiming:
Expand Down

0 comments on commit d40fc0b

Please sign in to comment.