generated from giantswarm/template-app
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c4cb20
commit a33c4fc
Showing
8 changed files
with
304 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{{/* | ||
canary fullname | ||
*/}} | ||
{{- define "loki-canary.fullname" -}} | ||
{{ include "loki.name" . }}-canary | ||
{{- end }} | ||
|
||
{{/* | ||
canary common labels | ||
*/}} | ||
{{- define "loki-canary.labels" -}} | ||
{{ include "loki.labels" . }} | ||
app.kubernetes.io/component: canary | ||
{{- end }} | ||
|
||
// Canary config is a bit hacky, we expect the replicaset canary to be supported upstream for a proper solution | ||
// See PR: https://github.com/grafana/loki/pull/13362 | ||
|
||
{{/* | ||
canary selector labels | ||
*/}} | ||
{{- define "loki-canary.selectorLabels" -}} | ||
app.kubernetes.io/component: canary | ||
app.kubernetes.io/instance: loki | ||
app.kubernetes.io/name: loki | ||
{{- end }} | ||
|
||
{{/* | ||
Docker image name for loki-canary | ||
*/}} | ||
{{- define "loki-canary.image" -}} | ||
{{ $.Values.global.image.registry }}/giantswarm/loki-canary:{{ .Chart.AppVersion }} | ||
{{- end -}} | ||
|
||
{{/* | ||
gateway fullname | ||
*/}} | ||
{{- define "loki.gatewayFullname" -}} | ||
{{ include "loki.fullname" . }}-gateway | ||
{{- end }} | ||
|
||
{{/* Determine the public host for the Loki cluster */}} | ||
{{- define "loki.host" -}} | ||
{{- $url := printf "%s.%s.svc.%s.:%s" (include "loki.gatewayFullname" .) .Release.Namespace .Values.global.clusterDomain "80" }} | ||
{{- printf "%s" $url -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{{/* | ||
Pod template used in Daemonset and Deployment | ||
*/}} | ||
{{- define "canary.podTemplate" -}} | ||
metadata: | ||
{{- with $.Values.lokiCanary.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "loki-canary.selectorLabels" $ | nindent 4 }} | ||
{{- with $.Values.lokiCanary.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ include "loki-canary.fullname" $ }} | ||
{{- with $.Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
securityContext: | ||
{{- toYaml $.Values.lokiCanary.podSecurityContext | nindent 4 }} | ||
containers: | ||
- name: loki-canary | ||
image: {{ include "loki-canary.image" $ }} | ||
imagePullPolicy: {{ $.Values.lokiCanary.image.pullPolicy }} | ||
args: | ||
- -addr={{- include "loki.host" $ }} | ||
- -labelname={{ $.Values.lokiCanary.labelname }} | ||
- -labelvalue=$(POD_NAME) | ||
{{- if $.Values.loki.auth_enabled }} | ||
- -user={{ $.Values.monitoring.selfMonitoring.tenant.name }} | ||
- -tenant-id={{ $.Values.monitoring.selfMonitoring.tenant.name }} | ||
- -pass={{ $.Values.monitoring.selfMonitoring.tenant.password }} | ||
{{- end }} | ||
{{- if $.Values.lokiCanary.push }} | ||
- -push=true | ||
{{- end }} | ||
{{- with $.Values.lokiCanary.extraArgs }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
securityContext: | ||
{{- toYaml $.Values.lokiCanary.containerSecurityContext | nindent 8 }} | ||
volumeMounts: | ||
{{- with $.Values.lokiCanary.extraVolumeMounts }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
ports: | ||
- name: http-metrics | ||
containerPort: 3500 | ||
protocol: TCP | ||
env: | ||
- name: POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
{{- with $.Values.lokiCanary.extraEnv }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with $.Values.lokiCanary.extraEnvFrom }} | ||
envFrom: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
readinessProbe: | ||
httpGet: | ||
path: /metrics | ||
port: http-metrics | ||
initialDelaySeconds: 15 | ||
timeoutSeconds: 1 | ||
{{- with $.Values.lokiCanary.resources}} | ||
resources: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with $.Values.lokiCanary.dnsConfig }} | ||
dnsConfig: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with $.Values.lokiCanary.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with $.Values.lokiCanary.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
volumes: | ||
{{- with $.Values.lokiCanary.extraVolumes }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{{- with .Values.lokiCanary -}} | ||
{{- if and .enabled (eq .mode "daemonset") -}} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: {{ include "loki-canary.fullname" $ }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "loki-canary.labels" $ | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "loki-canary.selectorLabels" $ | nindent 6 }} | ||
{{- with .updateStrategy }} | ||
updateStrategy: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
template: | ||
{{- include "canary.podTemplate" $ | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{{- with .Values.lokiCanary -}} | ||
{{- if and .enabled (eq .mode "deployment") -}} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "loki-canary.fullname" $ }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "loki-canary.labels" $ | nindent 4 }} | ||
spec: | ||
replicas: {{ .deployment.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "loki-canary.selectorLabels" $ | nindent 6 }} | ||
{{- with .deployment.strategy }} | ||
strategy: | ||
{{- toYaml . | trim | nindent 4 }} | ||
{{- end }} | ||
template: | ||
{{- include "canary.podTemplate" $ | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{- with .Values.lokiCanary -}} | ||
{{- if .enabled -}} | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "loki-canary.fullname" $ }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "loki-canary.labels" $ | nindent 4 }} | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- name: http-metrics | ||
port: 3500 | ||
targetPort: http-metrics | ||
protocol: TCP | ||
selector: | ||
{{- include "loki-canary.selectorLabels" $ | nindent 4 }} | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{- with .Values.lokiCanary -}} | ||
{{- if .enabled -}} | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "loki-canary.fullname" $ }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "loki-canary.labels" $ | nindent 4 }} | ||
{{- with .annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
automountServiceAccountToken: {{ $.Values.loki.serviceAccount.automountServiceAccountToken }} | ||
{{- with $.Values.loki.serviceAccount.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters