adding listener helm charts
This commit is contained in:
parent
1fe9145b65
commit
3aee1420bc
77
charts/selector/charts/listener/templates/_helpers.tpl
Normal file
77
charts/selector/charts/listener/templates/_helpers.tpl
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "listener.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 "listener.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 }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
|
||||||
|
*/}}
|
||||||
|
{{- define "listener.namespace" -}}
|
||||||
|
{{- if .Values.namespaceOverride }}
|
||||||
|
{{- .Values.namespaceOverride }}
|
||||||
|
{{- else }}
|
||||||
|
{{- .Release.Namespace }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account
|
||||||
|
*/}}
|
||||||
|
{{- define "listener.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
{{- default (include "listener.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else }}
|
||||||
|
{{- default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "listener.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Selector labels
|
||||||
|
*/}}
|
||||||
|
{{- define "listener.selectorLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "listener.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Common labels
|
||||||
|
*/}}
|
||||||
|
{{- define "listener.labels" -}}
|
||||||
|
helm.sh/chart: {{ include "listener.chart" . }}
|
||||||
|
{{ include "listener.selectorLabels" . }}
|
||||||
|
{{- if or .Chart.AppVersion .Values.image.tag }}
|
||||||
|
app.kubernetes.io/version: {{ mustRegexReplaceAllLiteral "@sha.*" .Values.image.tag "" | default .Chart.AppVersion | quote }}
|
||||||
|
{{- end }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- with .Values.extraLabels }}
|
||||||
|
{{ toYaml . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,35 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: "{{ include "listener.fullname" . }}-appsettings"
|
||||||
|
namespace: {{ include "listener.namespace" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "listener.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
appsettings.json: |-
|
||||||
|
{
|
||||||
|
"Selector": {
|
||||||
|
"ClientId": "{{ .Values.spotify.clientId }}",
|
||||||
|
"ClientSecret": "{{ .Values.spotify.clientSecret }}",
|
||||||
|
"LastfmClient": "{{ .Values.lastfmClient }}",
|
||||||
|
"Equality": "{{ .Values.equalityMode }}",
|
||||||
|
"Database": {
|
||||||
|
"enabled": {{ .Values.databaseEnabled }},
|
||||||
|
"ConnectionString": "{{ .Values.databaseConnectionString }}",
|
||||||
|
"Migrate": {{ .Values.databaseMigrate }}
|
||||||
|
},
|
||||||
|
"Redis": {
|
||||||
|
"enabled": {{ .Values.redis.enabled }},
|
||||||
|
"connectionstring": "{{ .Values.redis.connectionString }}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Trace"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "listener.fullname" . }}-nlog
|
||||||
|
namespace: {{ include "listener.namespace" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "listener.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
nlog.config: |-
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!-- XSD manual extracted from package NLog.Schema: https://www.nuget.org/packages/NLog.Schema-->
|
||||||
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
autoReload="true"
|
||||||
|
throwConfigExceptions="true"
|
||||||
|
internalLogFile="./log/selector.nlog.log"
|
||||||
|
internalLogLevel="Info" >
|
||||||
|
|
||||||
|
<variable name="scopeFormat"
|
||||||
|
value="${all-event-properties:format=[[key]\:[value]]:includeScopeProperties=true:separator= }"/>
|
||||||
|
|
||||||
|
<variable name="format"
|
||||||
|
value="${longdate}|${level:uppercase=true}|${callsite}:${callsite-linenumber}|${message}${onexception:inner=${newline}}${exception:format=tostring,data:exceptionDataSeparator=\r\n}${newline} ${scopeFormat}"/>
|
||||||
|
|
||||||
|
<!-- the targets to write to -->
|
||||||
|
<targets>
|
||||||
|
<!-- write logs to file -->
|
||||||
|
<target xsi:type="File"
|
||||||
|
name="logfile"
|
||||||
|
fileName="./log/selector-${shortdate}.log"
|
||||||
|
layout="${format}" />
|
||||||
|
<target xsi:type="File"
|
||||||
|
name="tracefile"
|
||||||
|
fileName="./log/selector.trace-${shortdate}.log"
|
||||||
|
layout="${format}" />
|
||||||
|
<target xsi:type="ColoredConsole"
|
||||||
|
name="logconsole"
|
||||||
|
layout="${format}" />
|
||||||
|
</targets>
|
||||||
|
|
||||||
|
<!-- rules to map from logger name to target -->
|
||||||
|
<rules>
|
||||||
|
<logger name="Selector.*" minlevel="Debug" writeTo="logconsole" />
|
||||||
|
<logger name="Microsoft.*" minlevel="Warning" writeTo="logconsole" />
|
||||||
|
|
||||||
|
<!--<logger name="*" minlevel="Debug" writeTo="logfile" />-->
|
||||||
|
<logger name="Selector.*" minlevel="Debug" writeTo="logfile" />
|
||||||
|
<logger name="Microsoft.*" minlevel="Warning" writeTo="logfile" />
|
||||||
|
|
||||||
|
<!--<logger name="*" minlevel="Trace" writeTo="tracefile" />-->
|
||||||
|
<logger name="Selector.*" minlevel="Debug" writeTo="tracefile" />
|
||||||
|
<logger name="Microsoft.*" minlevel="Warning" writeTo="tracefile" />
|
||||||
|
</rules>
|
||||||
|
</nlog>
|
98
charts/selector/charts/listener/templates/deployment.yaml
Normal file
98
charts/selector/charts/listener/templates/deployment.yaml
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
{{- if (not .Values.useStatefulSet) }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "listener.fullname" . }}
|
||||||
|
namespace: {{ include "listener.namespace" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "listener.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if and (not .Values.autoscaling.enabled) (.Values.replicas) }}
|
||||||
|
replicas: {{ .Values.replicas }}
|
||||||
|
{{- end }}
|
||||||
|
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "listener.selectorLabels" . | nindent 6 }}
|
||||||
|
{{- with .Values.deploymentStrategy }}
|
||||||
|
strategy:
|
||||||
|
{{- toYaml . | trim | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "listener.selectorLabels" . | nindent 8 }}
|
||||||
|
{{- with .Values.podLabels }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
checksumNlog: {{ include (print $.Template.BasePath "/configmap.nlog.yaml") . | sha256sum }}
|
||||||
|
checksumAppsettings: {{ include (print $.Template.BasePath "/configmap.appsettings.yaml") . | sha256sum }}
|
||||||
|
|
||||||
|
spec:
|
||||||
|
serviceAccountName: {{ include "listener.serviceAccountName" . }}
|
||||||
|
{{- with .Values.securityContext }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: appsettings-volume
|
||||||
|
configMap:
|
||||||
|
name: {{ include "listener.fullname" . }}-appsettings
|
||||||
|
- name: nlog-volume
|
||||||
|
configMap:
|
||||||
|
name: {{ include "listener.fullname" . }}-nlog
|
||||||
|
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}
|
||||||
|
{{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}}
|
||||||
|
{{- if .Values.image.sha }}
|
||||||
|
image: "{{ $registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}@sha256:{{ .Values.image.sha }}"
|
||||||
|
{{- else }}
|
||||||
|
image: "{{ $registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
|
{{- end }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
{{- with .Values.containerSecurityContext }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
volumeMounts:
|
||||||
|
- name: appsettings-volume
|
||||||
|
mountPath: /app/appsettings.json
|
||||||
|
subPath: appsettings.json
|
||||||
|
- name: nlog-volume
|
||||||
|
mountPath: /app/nlog.config
|
||||||
|
subPath: nlog.config
|
||||||
|
|
||||||
|
# livenessProbe:
|
||||||
|
# exec:
|
||||||
|
# command:
|
||||||
|
# - touch
|
||||||
|
# - alive
|
||||||
|
# periodSeconds: 30
|
||||||
|
{{- with .Values.resources }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,15 @@
|
|||||||
|
{{- if .Values.serviceAccount.create -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ include "listener.serviceAccountName" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "listener.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.serviceAccount.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.serviceAccount.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- tpl (toYaml . | nindent 4) $ }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
100
charts/selector/charts/listener/values.yaml
Normal file
100
charts/selector/charts/listener/values.yaml
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
replicaCount: 1
|
||||||
|
|
||||||
|
global:
|
||||||
|
# -- Overrides the Docker registry globally for all images
|
||||||
|
imageRegistry: null
|
||||||
|
|
||||||
|
image:
|
||||||
|
# -- The Docker registry
|
||||||
|
registry: docker.io
|
||||||
|
# -- Docker image repository
|
||||||
|
repository: sarsoo/selector-cli
|
||||||
|
# Overrides the Grafana image tag whose default is the chart appVersion
|
||||||
|
tag: ""
|
||||||
|
sha: ""
|
||||||
|
pullPolicy: Always
|
||||||
|
|
||||||
|
nameOverride: ""
|
||||||
|
fullnameOverride: ""
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
create: true
|
||||||
|
name:
|
||||||
|
nameTest:
|
||||||
|
## ServiceAccount labels.
|
||||||
|
labels: {}
|
||||||
|
## Service account annotations. Can be templated.
|
||||||
|
annotations: {}
|
||||||
|
|
||||||
|
## Create HorizontalPodAutoscaler object for deployment type
|
||||||
|
#
|
||||||
|
autoscaling:
|
||||||
|
enabled: false
|
||||||
|
minReplicas: 1
|
||||||
|
maxReplicas: 5
|
||||||
|
targetCPU: "60"
|
||||||
|
targetMemory: ""
|
||||||
|
behavior: {}
|
||||||
|
|
||||||
|
containerSecurityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
|
||||||
|
## Number of old ReplicaSets to retain
|
||||||
|
##
|
||||||
|
revisionHistoryLimit: 10
|
||||||
|
|
||||||
|
## Override the deployment namespace
|
||||||
|
##
|
||||||
|
namespaceOverride: ""
|
||||||
|
|
||||||
|
# Apply extra labels to common labels.
|
||||||
|
extraLabels: {}
|
||||||
|
|
||||||
|
env: {}
|
||||||
|
|
||||||
|
resources: {}
|
||||||
|
# limits:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
# requests:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
|
||||||
|
## Node labels for pod assignment
|
||||||
|
## ref: https://kubernetes.io/docs/user-guide/node-selection/
|
||||||
|
#
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
## Tolerations for pod assignment
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
|
||||||
|
##
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
## Affinity for pod assignment (evaluated as template)
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||||
|
##
|
||||||
|
affinity: {}
|
||||||
|
|
||||||
|
# securityContext:
|
||||||
|
# runAsNonRoot: true
|
||||||
|
# runAsUser: 472
|
||||||
|
# runAsGroup: 472
|
||||||
|
# fsGroup: 472
|
||||||
|
|
||||||
|
equalityMode: "uri"
|
||||||
|
databaseConnectionString: ""
|
||||||
|
databaseMigrate: false
|
||||||
|
databaseEnabled: false
|
||||||
|
spotify:
|
||||||
|
clientId: ""
|
||||||
|
clientSecret: ""
|
||||||
|
lastfmClient: ""
|
||||||
|
|
||||||
|
redis:
|
||||||
|
enabled: false
|
||||||
|
connectionString: ""
|
@ -16,7 +16,8 @@ data:
|
|||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Trace",
|
"Default": "Trace",
|
||||||
"Microsoft": "Warning",
|
"Microsoft": "Warning",
|
||||||
"Microsoft.Hosting.Lifetime": "Information"
|
"Microsoft.Hosting.Lifetime": "Information",
|
||||||
|
"Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Selector": {
|
"Selector": {
|
||||||
|
@ -53,6 +53,7 @@ data:
|
|||||||
|
|
||||||
<!--Output hosting lifetime messages to console target for faster startup detection -->
|
<!--Output hosting lifetime messages to console target for faster startup detection -->
|
||||||
<logger name="Microsoft.Hosting.Lifetime" minlevel="Info" writeTo="logconsole" final="true" />
|
<logger name="Microsoft.Hosting.Lifetime" minlevel="Info" writeTo="logconsole" final="true" />
|
||||||
|
<logger name="Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware" minlevel="Info" writeTo="logconsole" final="true" />
|
||||||
|
|
||||||
<!--Skip non-critical Microsoft logs and so log only own logs (BlackHole) -->
|
<!--Skip non-critical Microsoft logs and so log only own logs (BlackHole) -->
|
||||||
<logger name="Microsoft.*" maxlevel="Info" final="true" />
|
<logger name="Microsoft.*" maxlevel="Info" final="true" />
|
||||||
|
@ -81,12 +81,12 @@ spec:
|
|||||||
mountPath: /app/nlog.config
|
mountPath: /app/nlog.config
|
||||||
subPath: nlog.config
|
subPath: nlog.config
|
||||||
|
|
||||||
livenessProbe:
|
# livenessProbe:
|
||||||
exec:
|
# exec:
|
||||||
command:
|
# command:
|
||||||
- touch
|
# - touch
|
||||||
- alive
|
# - alive
|
||||||
periodSeconds: 30
|
# periodSeconds: 30
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
|
Loading…
Reference in New Issue
Block a user