Skip to content

Commit

Permalink
Add support for pod and deployment labels and ssl-redirects (#20)
Browse files Browse the repository at this point in the history
* Add support for ssl-redirect and labels and standardize labels

* Quote label values

* Add quotes to deployment label values

* Update chart

* Add helmignore

* Ignore index yaml

* Update helmignore and package
  • Loading branch information
Victor Künstler authored Jan 28, 2021
1 parent f8cbcea commit cb1ccf4
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 37 deletions.
3 changes: 3 additions & 0 deletions helm-chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.tgz
index.yaml
.*
7 changes: 3 additions & 4 deletions helm-chart/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ apiVersion: v1
entries:
streams-explorer:
- apiVersion: v1
created: "2021-01-14T15:55:38.126705142+01:00"
created: "2021-01-28T13:50:50.66258+01:00"
description: A Helm chart for the Streams Explorer on Kubernetes
digest: e76bd05ecd88b6bb1482103b5067f30893eea93022fb3788c38c0da1698e9ed4
digest: 188b7c05b012bad4bb1369a900f39601293b5df05708b750da0abb421f897fc4
name: streams-explorer
urls:
- streams-explorer-0.1.0.tgz
version: 0.1.0
generated: "2021-01-14T15:55:57+01:00"
serverInfo: {}
generated: "2021-01-28T13:50:50.661944+01:00"
Binary file modified helm-chart/streams-explorer-0.1.0.tgz
Binary file not shown.
29 changes: 14 additions & 15 deletions helm-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,29 @@ metadata:
name: {{ .Release.Name }}
{{- if .Values.labels }}
labels:
{{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value }}
app.kubernetes.io/name: {{ include "streams-explorer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "streams-explorer.chart" . }}
{{- range $key, $value := .Values.deploymentLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "streams-explorer.name" . }}
chart: {{ include "streams-explorer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value }}
{{- end }}
app.kubernetes.io/name: {{ include "streams-explorer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ include "streams-explorer.name" . }}
chart: {{ include "streams-explorer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value }}
app.kubernetes.io/name: {{ include "streams-explorer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "streams-explorer.chart" . }}
{{- range $key, $value := .Values.podLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- if or .Values.awsRole .Values.annotations }}
annotations:
Expand Down
7 changes: 7 additions & 0 deletions helm-chart/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "streams-explorer.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- $sslRedirect := .Values.ingress.sslRedirect -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
Expand Down Expand Up @@ -34,6 +35,12 @@ spec:
- host: {{ . | quote }}
http:
paths:
{{- if $sslRedirect }}
- path: /*
backend:
serviceName: ssl-redirect
servicePort: use-annotation
{{- end }}
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
Expand Down
8 changes: 4 additions & 4 deletions helm-chart/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app: {{ template "streams-explorer.name" . }}
chart: {{ template "streams-explorer.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "streams-explorer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "streams-explorer.chart" . }}
name: {{ template "streams-explorer.fullname" . }}
rules:
- apiGroups: ["apps", "batch"]
Expand Down
8 changes: 4 additions & 4 deletions helm-chart/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app: {{ template "streams-explorer.name" . }}
chart: {{ template "streams-explorer.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "streams-explorer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "streams-explorer.chart" . }}
name: {{ template "streams-explorer.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
12 changes: 6 additions & 6 deletions helm-chart/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ kind: Service
metadata:
name: {{ template "streams-explorer.fullname" . }}
labels:
app: {{ template "streams-explorer.name" . }}
chart: {{ template "streams-explorer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "streams-explorer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "streams-explorer.chart" . }}
spec:
type: {{ .Values.service.type }}
ports:
- name: http
port: {{ .Values.serviceHttpPort }}
selector:
app: {{ template "streams-explorer.name" . }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "streams-explorer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
9 changes: 5 additions & 4 deletions helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ icons: {}
# <svg></svg>


labels: {}
deploymentLabels: {}

podLabels: {}
service:
type: ClusterIP

Expand All @@ -50,13 +51,13 @@ serviceAccount:

ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
annotations: {}
path: /
hosts:
- sample.dev.daaa.cloud
tls: []
# Redirect http to https: https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.1/guide/tasks/ssl_redirect/
sslRedirect: true

resources:
requests:
Expand Down

0 comments on commit cb1ccf4

Please sign in to comment.