Skip to content

Commit

Permalink
release v0.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kikkomep committed Sep 7, 2023
2 parents 0ac012b + 2e79917 commit b632dd9
Show file tree
Hide file tree
Showing 11 changed files with 303 additions and 300 deletions.
4 changes: 2 additions & 2 deletions k8s/lifemonitor-web/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
appVersion: "0.1.0"
appVersion: '0.5.4'
description: A Helm chart for Kubernetes
name: lifemonitor-web
version: 0.1.0
version: 0.3.0
9 changes: 9 additions & 0 deletions k8s/lifemonitor-web/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ Create chart name and version as used by the chart label.
{{- define "lifemonitor-web.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}


{{/*
Define the service name
*/}}
{{- define "lifemonitor-web.serviceName" -}}
{{- printf "%s-frontend" (include "lifemonitor-web.fullname" .) -}}
{{- end -}}

23 changes: 19 additions & 4 deletions k8s/lifemonitor-web/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,42 @@ metadata:
name: {{ include "lifemonitor-web.fullname" . }}-frontend
labels:
app.kubernetes.io/name: {{ include "lifemonitor-web.name" . }}
helm.sh/chart: {{ include "lifemonitor-web.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "lifemonitor-web.chart" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "lifemonitor-web.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "lifemonitor-web.chart" . }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "lifemonitor-web.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "lifemonitor-web.chart" . }}
spec:
containers:
- name: {{ .Chart.Name }}
- name: frontend
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 4200
protocol: TCP
{{ if .Values.monitoring.enabled }}
- name: metrics
containerPort: 9090
protocol: TCP
{{- end }}
volumeMounts:
- name: frontend-config
mountPath: /app/assets/config.json
subPath: config.json
subPath: config.json
- name: nginx-config
mountPath: /usr/local/openresty/nginx/conf/nginx.conf
subPath: nginx.conf
Expand All @@ -39,6 +48,9 @@ spec:
subPath: app.conf
- name: logs-storage
mountPath: /var/log/nginx
{{ if .Values.extraVolumeMounts }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}

# livenessProbe:
# httpGet:
Expand All @@ -58,9 +70,12 @@ spec:
- name: nginx-config
configMap:
name: {{ include "lifemonitor-web.fullname" . }}-nginx-config
defaultMode: 0644
defaultMode: 0644
- name: logs-storage
emptyDir: {}
{{ if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
54 changes: 37 additions & 17 deletions k8s/lifemonitor-web/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "lifemonitor-web.fullname" . -}}
{{- $fullname := include "lifemonitor-web.fullname" . -}}
{{- $newStyle := semverCompare ">=1.18.0" .Capabilities.KubeVersion.GitVersion -}}
{{- if semverCompare ">=1.17-0" .Capabilities.KubeVersion.GitVersion }}
apiVersion: networking.k8s.io/v1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
name: {{ $fullname }}
labels:
app.kubernetes.io/name: {{ include "lifemonitor-web.name" . }}
helm.sh/chart: {{ include "lifemonitor-web.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
# old way of setting the ingress class
{{- if semverCompare "<1.18.0" .Capabilities.KubeVersion.GitVersion }}
kubernetes.io/ingress.class: {{ .Values.ingress.className }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
{{- if semverCompare ">=1.18.0" .Capabilities.KubeVersion.GitVersion }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
Expand All @@ -23,17 +34,26 @@ spec:
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
backend:
serviceName: {{ $fullName }}-frontend
servicePort: http
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . | quote }}
{{- if $newStyle }}
pathType: Prefix
{{- end }}
backend:
{{- if $newStyle }}
service:
name: {{$fullname}}-frontend
port:
name: http
{{- else }}
serviceName: {{$fullname}}-frontend
servicePort: http
{{- end }}
{{- end }}
{{- end }}
{{- end }}
50 changes: 50 additions & 0 deletions k8s/lifemonitor-web/templates/monitoring.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- if .Values.monitoring.enabled -}}
apiVersion: v1
kind: Service
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: '9090'
labels:
app.kubernetes.io/name: {{ include "lifemonitor-web.name" . }}
name: {{ .Release.Name }}-frontend-proxy-metrics-headless
namespace: {{ .Release.Namespace }}
spec:
clusterIP: None
selector:
app.kubernetes.io/name: {{ include "lifemonitor-web.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "lifemonitor-web.chart" . }}
ports:
- name: metrics
protocol: TCP
port: 9090
targetPort: 9090

---

{{- if .Values.monitoring.servicemonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "lifemonitor-web.name" . }}-metrics-servicemonitor
# same namespace that Prometheus is running in
namespace: {{ .Values.monitoring.prometheus.namespace }}
labels:
app: {{ include "lifemonitor-web.name" . }}
release: prometheus-stack
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ include "lifemonitor-web.name" . }}
endpoints:
- path: /metrics
port: metrics
interval: 15s
namespaceSelector:
matchNames:
- {{ .Release.Namespace }} # namespace where the app is running
{{- end -}} # end if .Values.monitoring.servicemonitor.enabled
{{- end -}} # end if .Values.monitoring.enabled

Loading

0 comments on commit b632dd9

Please sign in to comment.