Skip to content

Commit

Permalink
[stable/net-exporter] Flexible resource name, labels and selector to …
Browse files Browse the repository at this point in the history
…fit our use case (deliveryhero#285)

* Minor: flexible resource name, labels and selector

* Minor: bump net-exporter's chart version
  • Loading branch information
pciang authored Feb 18, 2022
1 parent 8ee456d commit e20a1ae
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion stable/net-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: "v1"
name: net-exporter
description: "Helm chart for net-exporter."
home: "https://github.com/giantswarm/net-exporter"
version: "1.10.3"
version: "1.10.4"
appVersion: "1.10.3"
annotations:
config.giantswarm.io/version: 1.x.x
Expand Down
4 changes: 3 additions & 1 deletion stable/net-exporter/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# net-exporter

![Version: 1.10.3](https://img.shields.io/badge/Version-1.10.3-informational?style=flat-square) ![AppVersion: 1.10.3](https://img.shields.io/badge/AppVersion-1.10.3-informational?style=flat-square)
![Version: 1.10.4](https://img.shields.io/badge/Version-1.10.4-informational?style=flat-square) ![AppVersion: 1.10.3](https://img.shields.io/badge/AppVersion-1.10.3-informational?style=flat-square)

Helm chart for net-exporter.

Expand Down Expand Up @@ -45,6 +45,7 @@ helm install my-release deliveryhero/net-exporter -f values.yaml
| NetExporter.DNSCheck.TCP.Disabled | bool | `false` | |
| NetExporter.Hosts | string | `""` | |
| NetExporter.NTPServers | string | `""` | |
| additionalLabels | object | `{}` | |
| controlPlaneSubnets | list | `[]` | |
| daemonset.priorityClassName | string | `"system-node-critical"` | |
| dns.label | string | `"coredns"` | |
Expand All @@ -60,6 +61,7 @@ helm install my-release deliveryhero/net-exporter -f values.yaml
| kubectl.image.tag | string | `"1.18.8"` | |
| name | string | `"net-exporter"` | |
| port | int | `8000` | |
| selector.app | string | `"net-exporter"` | |
| serviceType | string | `"managed"` | |
| timeout | string | `"5s"` | |
| userID | int | `1000` | |
Expand Down
10 changes: 8 additions & 2 deletions stable/net-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ Create chart name and version as used by the chart label.
Common labels
*/}}
{{- define "labels.common" -}}
{{ include "labels.selector" . }}
{{- include "labels.selector" . -}}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/name: {{ .Values.name | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
giantswarm.io/service-type: "{{ .Values.serviceType }}"
helm.sh/chart: {{ include "chart" . | quote }}
{{- if hasKey .Values "additionalLabels" }}
{{- range $key, $value := .Values.additionalLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "labels.selector" -}}
app: {{ .Values.name | quote }}
{{- range $key, $value := .Values.selector }}{{ $key }}: {{ $value | quote }}
{{ end }}
{{- end -}}
6 changes: 3 additions & 3 deletions stable/net-exporter/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: net-exporter
name: {{ .Values.name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "labels.common" . | nindent 4 }}
Expand Down Expand Up @@ -38,7 +38,7 @@ spec:
## In the TC, net-exporter runs on kube-system and so this is fine
priorityClassName: {{ .Values.daemonset.priorityClassName }}
containers:
- name: net-exporter
- name: {{ .Values.name }}
image: "{{ .Values.image.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag }}"
args:
- "-namespace={{ .Release.Namespace }}"
Expand Down Expand Up @@ -73,7 +73,7 @@ spec:
memory: 75Mi
limits:
memory: 150Mi
serviceAccountName: net-exporter
serviceAccountName: {{ .Values.name }}
securityContext:
runAsUser: {{ .Values.userID }}
runAsGroup: {{ .Values.groupID }}
Expand Down
10 changes: 5 additions & 5 deletions stable/net-exporter/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: net-exporter
name: {{ .Values.name }}
labels:
{{- include "labels.common" . | nindent 4 }}
rules:
Expand All @@ -11,7 +11,7 @@ rules:
- services
- endpoints
resourceNames:
- net-exporter
- {{ .Values.name }}
- {{ .Values.dns.service }}
verbs:
- get
Expand Down Expand Up @@ -44,14 +44,14 @@ rules:
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: net-exporter
name: {{ .Values.name }}
labels:
{{- include "labels.common" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: net-exporter
name: {{ .Values.name }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: net-exporter
name: {{ .Values.name }}
apiGroup: rbac.authorization.k8s.io
2 changes: 1 addition & 1 deletion stable/net-exporter/templates/service-account.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: net-exporter
name: {{ .Values.name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "labels.common" . | nindent 4 }}
2 changes: 1 addition & 1 deletion stable/net-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: net-exporter
name: {{ .Values.name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "labels.common" . | nindent 4 }}
Expand Down
5 changes: 5 additions & 0 deletions stable/net-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ NetExporter:
DNSCheck:
TCP:
Disabled: false

selector:
app: net-exporter

additionalLabels: {}

0 comments on commit e20a1ae

Please sign in to comment.