Skip to content

Commit

Permalink
eventrouter: Various chart improvements
Browse files Browse the repository at this point in the history
* Add ingress NetworkPolicy and Prometheus annotations.
* Add config checksum to recreate pods on changes
* Add a emptyDir volume for /tmp to work arround Issue 114 [1]
* Add the option to overwrite kubernetes master/api environment
variables to work arround IP SAN limitation of puppet CA

[1] vmware-archive/eventrouter#114

Bug: T262675
Change-Id: Ia1632157971c6bee5eadb94be3ed81a058e64466
  • Loading branch information
jayme-github authored and jenkins-bot committed Oct 26, 2020
1 parent 30c0961 commit 032b446
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charts/eventrouter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart for eventrouter (https://github.com/heptiolabs/eventrouter)
name: eventrouter
version: 0.3.0
version: 0.3.1
appVersion: 0.3
home: https://github.com/heptiolabs/eventrouter
sources:
Expand Down
22 changes: 21 additions & 1 deletion charts/eventrouter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,24 @@ Create the name of the service account to use
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create kubernetes master/api environment variables
*/}}
{{- define "kubernetesApiEnv" -}}
- name: KUBERNETES_PORT_443_TCP_ADDR
value: "{{ .Values.kubernetesApi.host }}"
- name: KUBERNETES_SERVICE_HOST
value: "{{ .Values.kubernetesApi.host }}"
- name: KUBERNETES_SERVICE_PORT
value: "{{ .Values.kubernetesApi.port }}"
- name: KUBERNETES_SERVICE_PORT_HTTPS
value: "{{ .Values.kubernetesApi.port }}"
- name: KUBERNETES_PORT
value: "{{ printf "tcp://%s:%s" .Values.kubernetesApi.host .Values.kubernetesApi.port}}"
- name: KUBERNETES_PORT_443_TCP
value: "{{ printf "tcp://%s:%s" .Values.kubernetesApi.host .Values.kubernetesApi.port}}"
- name: KUBERNETES_PORT_443_TCP_PORT
value: "{{ .Values.kubernetesApi.port }}"
{{- end -}}
15 changes: 14 additions & 1 deletion charts/eventrouter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,27 @@ spec:
labels:
app: {{ template "eventrouter.name" . }}
release: {{ .Release.Name }}
{{- if .Values.podAnnotations }}
annotations:
checksum/config: {{ printf "%s-%s" .Values.sink .Values.enablePrometheus | sha256sum }}
{{- if .Values.enablePrometheus }}
prometheus.io/port: "8080"
prometheus.io/scrape: "true"
{{- end }}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if and .Values.kubernetesApi.host .Values.kubernetesApi.port }}
env:
{{- include "kubernetesApiEnv" . | nindent 10 }}
{{- end }}
volumeMounts:
- name: tmp
mountPath: /tmp
- name: config-volume
mountPath: /etc/eventrouter
{{- if .Values.containerPorts }}
Expand All @@ -54,3 +65,5 @@ spec:
- name: config-volume
configMap:
name: {{ template "eventrouter.fullname" . }}
- name: tmp
emptyDir: {}
17 changes: 17 additions & 0 deletions charts/eventrouter/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
labels: {{ include "eventrouter.labels" . | indent 4 }}
name: {{ template "eventrouter.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
podSelector:
matchLabels:
app: {{ template "eventrouter.name" . }}
release: {{ .Release.Name }}
policyTypes:
- Ingress
ingress:
- ports:
- port: 8080
protocol: TCP
10 changes: 8 additions & 2 deletions charts/eventrouter/values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Default values for eventrouter.

image:
repository: gcr.io/heptio-images/eventrouter
tag: v0.3
repository: docker-registry.discovery.wmnet/eventrouter
tag: 0.3.0-3
pullPolicy: IfNotPresent

replicaCount: 1
Expand Down Expand Up @@ -40,3 +40,9 @@ securityContext: {}
# runAsUser: 1000

enablePrometheus: true

# Overwrite the default KUBERNETES_ environment variables for the container
# to work around the IP SAN limitation of puppet CA
kubernetesApi:
host: ""
port: ""

0 comments on commit 032b446

Please sign in to comment.