added repo
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Welcome to Grafana Alloy!
|
||||
@@ -0,0 +1,25 @@
|
||||
{{/*
|
||||
Retrieve configMap name from the name of the chart or the ConfigMap the user
|
||||
specified.
|
||||
*/}}
|
||||
{{- define "alloy.config-map.name" -}}
|
||||
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
|
||||
{{- if $values.configMap.name -}}
|
||||
{{- $values.configMap.name }}
|
||||
{{- else -}}
|
||||
{{- include "alloy.fullname" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
The name of the config file is the default or the key the user specified in the
|
||||
ConfigMap.
|
||||
*/}}
|
||||
{{- define "alloy.config-map.key" -}}
|
||||
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
|
||||
{{- if $values.configMap.key -}}
|
||||
{{- $values.configMap.key }}
|
||||
{{- else -}}
|
||||
config.alloy
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,151 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "alloy.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 "alloy.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 "alloy.chart" -}}
|
||||
{{- if index .Values "$chart_tests" }}
|
||||
{{- printf "%s" .Chart.Name | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
|
||||
*/}}
|
||||
{{- define "alloy.namespace" -}}
|
||||
{{- if .Values.namespaceOverride }}
|
||||
{{- .Values.namespaceOverride }}
|
||||
{{- else }}
|
||||
{{- .Release.Namespace }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "alloy.labels" -}}
|
||||
helm.sh/chart: {{ include "alloy.chart" . }}
|
||||
{{ include "alloy.selectorLabels" . }}
|
||||
{{- if index .Values "$chart_tests" }}
|
||||
app.kubernetes.io/version: "vX.Y.Z"
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- else }}
|
||||
{{/* substr trims delimeter prefix char from alloy.imageId output
|
||||
e.g. ':' for tags and '@' for digests.
|
||||
For digests, we crop the string to a 7-char (short) sha. */}}
|
||||
app.kubernetes.io/version: {{ (include "alloy.imageId" .) | trunc 15 | trimPrefix "@sha256" | trimPrefix ":" | quote }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/part-of: alloy
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "alloy.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "alloy.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "alloy.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "alloy.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Calculate name of image ID to use for "alloy.
|
||||
*/}}
|
||||
{{- define "alloy.imageId" -}}
|
||||
{{- if .Values.image.digest }}
|
||||
{{- $digest := .Values.image.digest }}
|
||||
{{- if not (hasPrefix "sha256:" $digest) }}
|
||||
{{- $digest = printf "sha256:%s" $digest }}
|
||||
{{- end }}
|
||||
{{- printf "@%s" $digest }}
|
||||
{{- else if .Values.image.tag }}
|
||||
{{- printf ":%s" .Values.image.tag }}
|
||||
{{- else }}
|
||||
{{- printf ":%s" .Chart.AppVersion }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Calculate name of image ID to use for "config-reloader".
|
||||
*/}}
|
||||
{{- define "config-reloader.imageId" -}}
|
||||
{{- if .Values.configReloader.image.digest }}
|
||||
{{- $digest := .Values.configReloader.image.digest }}
|
||||
{{- if not (hasPrefix "sha256:" $digest) }}
|
||||
{{- $digest = printf "sha256:%s" $digest }}
|
||||
{{- end }}
|
||||
{{- printf "@%s" $digest }}
|
||||
{{- else if .Values.configReloader.image.tag }}
|
||||
{{- printf ":%s" .Values.configReloader.image.tag }}
|
||||
{{- else }}
|
||||
{{- printf ":%s" "v0.8.0" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for ingress.
|
||||
*/}}
|
||||
{{- define "alloy.ingress.apiVersion" -}}
|
||||
{{- if and ($.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) }}
|
||||
{{- print "networking.k8s.io/v1" }}
|
||||
{{- else if $.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
|
||||
{{- print "networking.k8s.io/v1beta1" }}
|
||||
{{- else }}
|
||||
{{- print "extensions/v1beta1" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Return if ingress is stable.
|
||||
*/}}
|
||||
{{- define "alloy.ingress.isStable" -}}
|
||||
{{- eq (include "alloy.ingress.apiVersion" .) "networking.k8s.io/v1" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Return if ingress supports ingressClassName.
|
||||
*/}}
|
||||
{{- define "alloy.ingress.supportsIngressClassName" -}}
|
||||
{{- or (eq (include "alloy.ingress.isStable" .) "true") (and (eq (include "alloy.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) }}
|
||||
{{- end }}
|
||||
{{/*
|
||||
Return if ingress supports pathType.
|
||||
*/}}
|
||||
{{- define "alloy.ingress.supportsPathType" -}}
|
||||
{{- or (eq (include "alloy.ingress.isStable" .) "true") (and (eq (include "alloy.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
|
||||
{{- if $values.clustering.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "alloy.fullname" . }}-cluster
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: networking
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: 'None'
|
||||
selector:
|
||||
{{- include "alloy.selectorLabels" . | nindent 4 }}
|
||||
ports:
|
||||
# Do not include the -metrics suffix in the port name, otherwise metrics
|
||||
# can be double-collected with the non-headless Service if it's also
|
||||
# enabled.
|
||||
#
|
||||
# This service should only be used for clustering, and not metric
|
||||
# collection.
|
||||
- name: {{ $values.clustering.portName }}
|
||||
port: {{ $values.listenPort }}
|
||||
targetPort: {{ $values.listenPort }}
|
||||
protocol: "TCP"
|
||||
{{- range $portMap := $values.extraPorts }}
|
||||
- name: {{ $portMap.name }}
|
||||
port: {{ $portMap.port }}
|
||||
targetPort: {{ $portMap.targetPort }}
|
||||
protocol: {{ coalesce $portMap.protocol "TCP" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
|
||||
{{- if $values.configMap.create }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: config
|
||||
data:
|
||||
{{- if $values.configMap.content }}
|
||||
config.alloy: |- {{- (tpl $values.configMap.content .) | nindent 4 }}
|
||||
{{- else }}
|
||||
config.alloy: |- {{- .Files.Get (printf "config/%s" $values.configMap.configFile) | trim | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,85 @@
|
||||
{{- define "alloy.container" -}}
|
||||
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
|
||||
- name: alloy
|
||||
image: {{ .Values.global.image.registry | default .Values.image.registry }}/{{ .Values.image.repository }}{{ include "alloy.imageId" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
args:
|
||||
- run
|
||||
- /etc/alloy/{{ include "alloy.config-map.key" . }}
|
||||
- --storage.path={{ $values.storagePath }}
|
||||
- --server.http.listen-addr={{ $values.listenAddr }}:{{ $values.listenPort }}
|
||||
- --server.http.ui-path-prefix={{ $values.uiPathPrefix }}
|
||||
{{- if not $values.enableReporting }}
|
||||
- --disable-reporting
|
||||
{{- end}}
|
||||
{{- if $values.clustering.enabled }}
|
||||
- --cluster.enabled=true
|
||||
- --cluster.join-addresses={{ include "alloy.fullname" . }}-cluster
|
||||
{{- end}}
|
||||
{{- if $values.stabilityLevel }}
|
||||
- --stability.level={{ $values.stabilityLevel }}
|
||||
{{- end }}
|
||||
{{- range $values.extraArgs }}
|
||||
- {{ . }}
|
||||
{{- end}}
|
||||
env:
|
||||
- name: ALLOY_DEPLOY_MODE
|
||||
value: "helm"
|
||||
- name: HOSTNAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: NODE_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.hostIP
|
||||
{{- range $values.extraEnv }}
|
||||
- {{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if $values.envFrom }}
|
||||
envFrom:
|
||||
{{- toYaml $values.envFrom | nindent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: {{ $values.listenPort }}
|
||||
name: http-metrics
|
||||
{{- range $portMap := $values.extraPorts }}
|
||||
- containerPort: {{ $portMap.targetPort }}
|
||||
{{- if $portMap.hostPort }}
|
||||
hostPort: {{ $portMap.hostPort }}
|
||||
{{- end}}
|
||||
name: {{ $portMap.name }}
|
||||
protocol: {{ coalesce $portMap.protocol "TCP" }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /-/ready
|
||||
port: {{ $values.listenPort }}
|
||||
scheme: {{ $values.listenScheme }}
|
||||
initialDelaySeconds: 10
|
||||
timeoutSeconds: 1
|
||||
{{- with $values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with $values.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/alloy
|
||||
{{- if $values.mounts.varlog }}
|
||||
- name: varlog
|
||||
mountPath: /var/log
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if $values.mounts.dockercontainers }}
|
||||
- name: dockercontainers
|
||||
mountPath: /var/lib/docker/containers
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- range $values.mounts.extra }}
|
||||
- {{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,26 @@
|
||||
{{- define "alloy.watch-container" -}}
|
||||
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
|
||||
{{- if .Values.configReloader.enabled -}}
|
||||
- name: config-reloader
|
||||
image: {{ .Values.global.image.registry | default .Values.configReloader.image.registry }}/{{ .Values.configReloader.image.repository }}{{ include "config-reloader.imageId" . }}
|
||||
{{- if .Values.configReloader.customArgs }}
|
||||
args:
|
||||
{{- toYaml .Values.configReloader.customArgs | nindent 4 }}
|
||||
{{- else }}
|
||||
args:
|
||||
- --volume-dir=/etc/alloy
|
||||
- --webhook-url=http://localhost:{{ $values.listenPort }}/-/reload
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/alloy
|
||||
{{- with .Values.configReloader.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.configReloader.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,83 @@
|
||||
{{- define "alloy.pod-template" -}}
|
||||
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
|
||||
metadata:
|
||||
annotations:
|
||||
kubectl.kubernetes.io/default-container: alloy
|
||||
{{- with .Values.controller.podAnnotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "alloy.selectorLabels" . | nindent 4 }}
|
||||
{{- with .Values.controller.podLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.global.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "alloy.serviceAccountName" . }}
|
||||
{{- if or .Values.global.image.pullSecrets .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- if .Values.global.image.pullSecrets }}
|
||||
{{- toYaml .Values.global.image.pullSecrets | nindent 4 }}
|
||||
{{- else }}
|
||||
{{- toYaml .Values.image.pullSecrets | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.controller.initContainers }}
|
||||
initContainers:
|
||||
{{- with .Values.controller.initContainers }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
{{- include "alloy.container" . | nindent 4 }}
|
||||
{{- include "alloy.watch-container" . | nindent 4 }}
|
||||
{{- with .Values.controller.extraContainers }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end}}
|
||||
{{- if .Values.controller.priorityClassName }}
|
||||
priorityClassName: {{ .Values.controller.priorityClassName }}
|
||||
{{- end }}
|
||||
{{- if .Values.controller.hostNetwork }}
|
||||
hostNetwork: {{ .Values.controller.hostNetwork }}
|
||||
{{- end }}
|
||||
{{- if .Values.controller.hostPID }}
|
||||
hostPID: {{ .Values.controller.hostPID }}
|
||||
{{- end }}
|
||||
dnsPolicy: {{ .Values.controller.dnsPolicy }}
|
||||
{{- with .Values.controller.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.controller.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.controller.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.controller.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "alloy.config-map.name" . }}
|
||||
{{- if $values.mounts.varlog }}
|
||||
- name: varlog
|
||||
hostPath:
|
||||
path: /var/log
|
||||
{{- end }}
|
||||
{{- if $values.mounts.dockercontainers }}
|
||||
- name: dockercontainers
|
||||
hostPath:
|
||||
path: /var/lib/docker/containers
|
||||
{{- end }}
|
||||
{{- if .Values.controller.volumes.extra }}
|
||||
{{- toYaml .Values.controller.volumes.extra | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,25 @@
|
||||
{{- if eq .Values.controller.type "daemonset" }}
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
{{- with .Values.controller.extraAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if ge (int .Capabilities.KubeVersion.Minor) 22 }}
|
||||
minReadySeconds: 10
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "alloy.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
{{- include "alloy.pod-template" . | nindent 4 }}
|
||||
{{- with .Values.controller.updateStrategy }}
|
||||
updateStrategy:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,28 @@
|
||||
{{- if eq .Values.controller.type "deployment" }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
{{- with .Values.controller.extraAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if not .Values.controller.autoscaling.enabled }}
|
||||
replicas: {{ .Values.controller.replicas }}
|
||||
{{- end }}
|
||||
{{- if ge (int .Capabilities.KubeVersion.Minor) 22 }}
|
||||
minReadySeconds: 10
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "alloy.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
{{- include "alloy.pod-template" . | nindent 4 }}
|
||||
{{- with .Values.controller.updateStrategy }}
|
||||
strategy:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,50 @@
|
||||
{{- if eq .Values.controller.type "statefulset" }}
|
||||
{{- if .Values.enableStatefulSetAutoDeletePVC }}
|
||||
{{- fail "Value 'enableStatefulSetAutoDeletePVC' should be nested inside 'controller' options." }}
|
||||
{{- end }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
{{- with .Values.controller.extraAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if not .Values.controller.autoscaling.enabled }}
|
||||
replicas: {{ .Values.controller.replicas }}
|
||||
{{- end }}
|
||||
{{- if .Values.controller.parallelRollout }}
|
||||
podManagementPolicy: Parallel
|
||||
{{- end }}
|
||||
{{- if ge (int .Capabilities.KubeVersion.Minor) 22 }}
|
||||
minReadySeconds: 10
|
||||
{{- end }}
|
||||
serviceName: {{ include "alloy.fullname" . }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "alloy.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
{{- include "alloy.pod-template" . | nindent 4 }}
|
||||
{{- with .Values.controller.updateStrategy }}
|
||||
updateStrategy:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.controller.volumeClaimTemplates }}
|
||||
volumeClaimTemplates:
|
||||
{{- range . }}
|
||||
- {{ toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.controller.enableStatefulSetAutoDeletePVC) }}
|
||||
{{- /*
|
||||
Data on the read nodes is easy to replace, so we want to always delete PVCs to make
|
||||
operation easier, and will rely on re-fetching data when needed.
|
||||
*/}}
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
whenDeleted: Delete
|
||||
whenScaled: Delete
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if and .Values.contour .Values.contour.enabled }}
|
||||
{{- $instances := .Values.contour.instances -}}
|
||||
{{- $fullname := include "alloy.fullname" . -}}
|
||||
{{- range $instance := $instances }}
|
||||
apiVersion: projectcontour.io/v1alpha1
|
||||
kind: ExtensionService
|
||||
metadata:
|
||||
name: {{ $instance }}-extension-service
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
spec:
|
||||
protocol: h2c
|
||||
services:
|
||||
- name: {{ $fullname }}
|
||||
port: 4317
|
||||
---
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,78 @@
|
||||
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
|
||||
{{- if and (or (eq .Values.controller.type "deployment") (eq .Values.controller.type "statefulset" )) .Values.controller.autoscaling.enabled }}
|
||||
{{- if not (empty .Values.controller.autoscaling.targetMemoryUtilizationPercentage)}}
|
||||
{{- $_ := $values.resources.requests | required ".Values.alloy.resources.requests is required when using autoscaling." -}}
|
||||
{{- $_ := $values.resources.requests.memory | required ".Values.alloy.resources.requests.memory is required when using autoscaling based on memory utilization." -}}
|
||||
{{- $_ := .Values.configReloader.resources.requests | required ".Values.configReloader.resources.requests is required when using autoscaling." -}}
|
||||
{{- $_ := .Values.configReloader.resources.requests.memory | required ".Values.configReloader.resources.requests.memory is required when using autoscaling based on memory utilization." -}}
|
||||
{{- end}}
|
||||
{{- if not (empty .Values.controller.autoscaling.targetCPUUtilizationPercentage)}}
|
||||
{{- $_ := $values.resources.requests | required ".Values.alloy.resources.requests is required when using autoscaling." -}}
|
||||
{{- $_ := $values.resources.requests.cpu | required ".Values.alloy.resources.requests.cpu is required when using autoscaling based on cpu utilization." -}}
|
||||
{{- $_ := .Values.configReloader.resources.requests | required ".Values.configReloader.resources.requests is required when using autoscaling." -}}
|
||||
{{- $_ := .Values.configReloader.resources.requests.cpu | required ".Values.configReloader.resources.requests.cpu is required when using autoscaling based on cpu utilization." -}}
|
||||
{{- end}}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: availability
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: {{ .Values.controller.type }}
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
{{- with .Values.controller.autoscaling }}
|
||||
minReplicas: {{ .minReplicas }}
|
||||
maxReplicas: {{ .maxReplicas }}
|
||||
behavior:
|
||||
{{- with .scaleDown }}
|
||||
scaleDown:
|
||||
{{- if .policies }}
|
||||
policies:
|
||||
{{- range .policies }}
|
||||
- type: {{ .type }}
|
||||
value: {{ .value }}
|
||||
periodSeconds: {{ .periodSeconds }}
|
||||
{{- end }}
|
||||
selectPolicy: {{ .selectPolicy }}
|
||||
{{- end }}
|
||||
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
|
||||
{{- end }}
|
||||
{{- with .scaleUp }}
|
||||
scaleUp:
|
||||
{{- if .policies }}
|
||||
policies:
|
||||
{{- range .policies }}
|
||||
- type: {{ .type }}
|
||||
value: {{ .value }}
|
||||
periodSeconds: {{ .periodSeconds }}
|
||||
{{- end }}
|
||||
selectPolicy: {{ .selectPolicy }}
|
||||
{{- end }}
|
||||
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
|
||||
{{- end }}
|
||||
metrics:
|
||||
# Changing the order of the metrics will cause ArgoCD to go into a sync loop
|
||||
# memory needs to be first.
|
||||
# More info in: https://github.com/argoproj/argo-cd/issues/1079
|
||||
{{- with .targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,79 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $ingressApiIsStable := eq (include "alloy.ingress.isStable" .) "true" -}}
|
||||
{{- $ingressSupportsIngressClassName := eq (include "alloy.ingress.supportsIngressClassName" .) "true" -}}
|
||||
{{- $ingressSupportsPathType := eq (include "alloy.ingress.supportsPathType" .) "true" -}}
|
||||
{{- $fullName := include "alloy.fullname" . -}}
|
||||
{{- $servicePort := .Values.ingress.faroPort -}}
|
||||
{{- $ingressPath := .Values.ingress.path -}}
|
||||
{{- $ingressPathType := .Values.ingress.pathType -}}
|
||||
{{- $extraPaths := .Values.ingress.extraPaths -}}
|
||||
apiVersion: {{ include "alloy.ingress.apiVersion" . }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
namespace: {{ include "alloy.namespace" . }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: networking
|
||||
{{- with .Values.ingress.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {{ tpl $value $ | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and $ingressSupportsIngressClassName .Values.ingress.ingressClassName }}
|
||||
ingressClassName: {{ .Values.ingress.ingressClassName }}
|
||||
{{- end -}}
|
||||
{{- with .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- tpl (toYaml .) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- if .Values.ingress.hosts }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ tpl . $ }}
|
||||
http:
|
||||
paths:
|
||||
{{- with $extraPaths }}
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
- path: {{ $ingressPath }}
|
||||
{{- if $ingressSupportsPathType }}
|
||||
pathType: {{ $ingressPathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if $ingressApiIsStable }}
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $servicePort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- http:
|
||||
paths:
|
||||
- backend:
|
||||
{{- if $ingressApiIsStable }}
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $servicePort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
{{- end }}
|
||||
{{- with $ingressPath }}
|
||||
path: {{ . }}
|
||||
{{- end }}
|
||||
{{- if $ingressSupportsPathType }}
|
||||
pathType: {{ $ingressPathType }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,111 @@
|
||||
{{- if .Values.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: rbac
|
||||
rules:
|
||||
# Rules which allow discovery.kubernetes to function.
|
||||
- apiGroups:
|
||||
- ""
|
||||
- "discovery.k8s.io"
|
||||
- "networking.k8s.io"
|
||||
resources:
|
||||
- endpoints
|
||||
- endpointslices
|
||||
- ingresses
|
||||
- nodes
|
||||
- nodes/proxy
|
||||
- nodes/metrics
|
||||
- pods
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
# Rules which allow loki.source.kubernetes and loki.source.podlogs to work.
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
- pods/log
|
||||
- namespaces
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- "monitoring.grafana.com"
|
||||
resources:
|
||||
- podlogs
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
# Rules which allow mimir.rules.kubernetes to work.
|
||||
- apiGroups: ["monitoring.coreos.com"]
|
||||
resources:
|
||||
- prometheusrules
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- nonResourceURLs:
|
||||
- /metrics
|
||||
verbs:
|
||||
- get
|
||||
# Rules for prometheus.kubernetes.*
|
||||
- apiGroups: ["monitoring.coreos.com"]
|
||||
resources:
|
||||
- podmonitors
|
||||
- servicemonitors
|
||||
- probes
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
# Rules which allow eventhandler to work.
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
# needed for remote.kubernetes.*
|
||||
- apiGroups: [""]
|
||||
resources:
|
||||
- "configmaps"
|
||||
- "secrets"
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
# needed for otelcol.processor.k8sattributes
|
||||
- apiGroups: ["apps"]
|
||||
resources: ["replicasets"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["extensions"]
|
||||
resources: ["replicasets"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: rbac
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "alloy.serviceAccountName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,38 @@
|
||||
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
|
||||
{{- if .Values.service.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: networking
|
||||
{{- with .Values.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
{{- if .Values.service.clusterIP }}
|
||||
clusterIP: {{ .Values.service.clusterIP }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "alloy.selectorLabels" . | nindent 4 }}
|
||||
{{- if semverCompare ">=1.26-0" .Capabilities.KubeVersion.Version }}
|
||||
internalTrafficPolicy: {{.Values.service.internalTrafficPolicy}}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http-metrics
|
||||
{{- if eq .Values.service.type "NodePort" }}
|
||||
nodePort: {{ .Values.service.nodePort }}
|
||||
{{- end }}
|
||||
port: {{ $values.listenPort }}
|
||||
targetPort: {{ $values.listenPort }}
|
||||
protocol: "TCP"
|
||||
{{- range $portMap := $values.extraPorts }}
|
||||
- name: {{ $portMap.name }}
|
||||
port: {{ $portMap.port }}
|
||||
targetPort: {{ $portMap.targetPort }}
|
||||
protocol: {{ coalesce $portMap.protocol "TCP" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "alloy.serviceAccountName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: rbac
|
||||
{{- with .Values.serviceAccount.additionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,36 @@
|
||||
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
|
||||
{{- if and .Values.service.enabled .Values.serviceMonitor.enabled -}}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "alloy.fullname" . }}
|
||||
labels:
|
||||
{{- include "alloy.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: metrics
|
||||
{{- with .Values.serviceMonitor.additionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
endpoints:
|
||||
- port: http-metrics
|
||||
scheme: {{ $values.listenScheme | lower }}
|
||||
honorLabels: true
|
||||
{{- if .Values.serviceMonitor.interval }}
|
||||
interval: {{ .Values.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{ tpl (toYaml .Values.serviceMonitor.metricRelabelings | nindent 6) . }}
|
||||
{{- end }}
|
||||
{{- if .Values.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{ tpl (toYaml .Values.serviceMonitor.relabelings | nindent 6) . }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceMonitor.tlsConfig }}
|
||||
tlsConfig:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "alloy.selectorLabels" . | nindent 6 }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user