Skip to content

Commit

Permalink
switch to slog and add basic helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
CCOLLOT committed Dec 18, 2023
1 parent f466ee5 commit 7621ea0
Show file tree
Hide file tree
Showing 45 changed files with 572 additions and 125 deletions.
18 changes: 18 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
type: application

# version and appVersion values are overrided during build step
version: 0.0.0
appVersion: 0.0.0

name: upgrade-manager-chart
description: Upgrade Manager Helm chart
home: https://github.com/qonto/upgrade-manager
sources:
- https://github.com/qonto/upgrade-manager
annotations:
artifacthub.io/category: integration-delivery
keywords:
- argocd
- upgrade
- auto-discovery
1 change: 1 addition & 0 deletions chart/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade Manager is deployed.
76 changes: 76 additions & 0 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "upgrade-manager.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "upgrade-manager.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "upgrade-manager.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "upgrade-manager.labels" -}}
helm.sh/chart: {{ include "upgrade-manager.chart" . }}
{{ include "upgrade-manager.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- range $key, $value := .Values.additionalLabels }}
{{ $key }}: {{ $value | quote }}
{{- end -}}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "upgrade-manager.selectorLabels" -}}
app.kubernetes.io/name: {{ include "upgrade-manager.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "upgrade-manager.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "upgrade-manager.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name of the pvct to use
*/}}
{{- define "upgrade-manager.persistentVolumeClaimName" -}}
{{- if .Values.persistentVolumeClaim.create }}
{{- default (include "upgrade-manager.fullname" .) .Values.persistentVolumeClaim.name }}
{{- else }}
{{- default "default" .Values.persistentVolumeClaim.name }}
{{- end }}
{{- end }}
13 changes: 13 additions & 0 deletions chart/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.config -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "upgrade-manager.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "upgrade-manager.labels" . | nindent 4 }}
data:
config.yaml: |
{{- toYaml .Values.config | nindent 4 }}
{{- end -}}
102 changes: 102 additions & 0 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "upgrade-manager.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "upgrade-manager.labels" . | nindent 4 }}
spec:
replicas: 1
serviceName: "upgrade-manager"
selector:
matchLabels:
{{- include "upgrade-manager.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
labels:
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "upgrade-manager.labels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "upgrade-manager.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes:
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: upgrade-manager-config
configMap:
name: {{ include "upgrade-manager.fullname" . }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
args:
- "server"
- "--config"
- "{{ .Values.configFilePath }}"
- "--log-format"
- "{{ .Values.logFormat }}"
- "--log-level"
- "{{ .Values.logLevel }}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end -}}
{{- with .Values.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 10
periodSeconds: 10
failureThreshold: 6
readinessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 3
volumeMounts:
- mountPath: /config
name: upgrade-manager-config
readOnly: true
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
17 changes: 17 additions & 0 deletions chart/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "upgrade-manager.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "upgrade-manager.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "upgrade-manager.selectorLabels" . | nindent 4 }}
25 changes: 25 additions & 0 deletions chart/templates/serviceMonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if .Values.serviceMonitor.enabled -}}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "upgrade-manager.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "upgrade-manager.labels" . | nindent 4 }}
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "upgrade-manager.selectorLabels" . | nindent 6 }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: http
path: /metrics
interval: {{ .Values.serviceMonitor.interval }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
{{- end }}
12 changes: 12 additions & 0 deletions chart/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "upgrade-manager.serviceAccountName" . }}
labels:
{{- include "upgrade-manager.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit 7621ea0

Please sign in to comment.