add helm charts

This commit is contained in:
Ybehrooz
2025-11-09 13:22:40 +03:30
parent 282c3e52d0
commit 38e4d749ad
1352 changed files with 190457 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.server.rbac.create }}
kind: ClusterRole
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "prometheus.server.fullname.namespace" . }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
# These rules come from <https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus/templates/clusterrole.yaml>
- apiGroups:
- ""
resources:
- nodes
- nodes/proxy
- nodes/metrics
- services
- endpoints
- pods
- ingresses
- configmaps
verbs:
- get
- list
- watch
- apiGroups:
- "extensions"
- "networking.k8s.io"
resources:
- ingresses/status
- ingresses
verbs:
- get
- list
- watch
- nonResourceURLs:
- "/metrics"
verbs:
- get
{{- if .Values.server.rbac.rules }}
{{- include "common.tplvalues.render" ( dict "value" .Values.server.rbac.rules "context" $ ) | nindent 2 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,25 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.server.rbac.create }}
kind: ClusterRoleBinding
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ template "prometheus.server.fullname.namespace" . }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "prometheus.server.fullname.namespace" . }}
subjects:
- kind: ServiceAccount
name: {{ template "prometheus.server.serviceAccountName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- end }}

View File

@@ -0,0 +1,23 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if not .Values.existingConfigmap }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "prometheus.server.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
{{ include "prometheus.server.configmapKey" . }}:
{{- include "common.tplvalues.render" (dict "value" .Values.server.configuration "context" $) | toYaml | nindent 4 }}
rules.yaml:
{{- include "common.tplvalues.render" (dict "value" .Values.server.alertingRules "context" $) | toYaml | nindent 4 }}
{{- end }}

View File

@@ -0,0 +1,274 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "prometheus.server.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.server.replicaCount }}
{{- if .Values.server.updateStrategy }}
strategy: {{- toYaml .Values.server.updateStrategy | nindent 4 }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.server.podLabels .Values.commonLabels ) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
template:
metadata:
annotations:
checksum/configmap: {{ include (print $.Template.BasePath "/server/configmap.yaml") . | sha256sum }}
{{- if .Values.server.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
spec:
serviceAccountName: {{ template "prometheus.server.serviceAccountName" . }}
{{- include "prometheus.imagePullSecrets" . | nindent 6 }}
{{- if .Values.server.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.server.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.server.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.server.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.server.podAffinityPreset "component" "server" "customLabels" $podLabels "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.server.podAntiAffinityPreset "component" "server" "customLabels" $podLabels "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.server.nodeAffinityPreset.type "key" .Values.server.nodeAffinityPreset.key "values" .Values.server.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.server.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.server.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.server.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.server.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.server.priorityClassName }}
priorityClassName: {{ .Values.server.priorityClassName | quote }}
{{- end }}
{{- if .Values.server.schedulerName }}
schedulerName: {{ .Values.server.schedulerName | quote }}
{{- end }}
{{- if .Values.server.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.server.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.server.podSecurityContext.enabled }}
securityContext: {{- omit .Values.server.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
{{- if .Values.server.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.server.terminationGracePeriodSeconds }}
{{- end }}
initContainers:
{{- if and .Values.volumePermissions.enabled .Values.server.persistence.enabled }}
- name: volume-permissions
image: {{ include "prometheus.volumePermissions.image" . }}
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
command:
- sh
- -ec
- |
mkdir -p {{ .Values.server.persistence.mountPath }}
find {{ .Values.server.persistence.mountPath }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R {{ .Values.server.containerSecurityContext.runAsUser }}:{{ .Values.server.podSecurityContext.fsGroup }}
securityContext: {{- include "common.tplvalues.render" (dict "value" .Values.volumePermissions.containerSecurityContext "context" $) | nindent 12 }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: data
mountPath: {{ .Values.server.persistence.mountPath }}
{{- if .Values.server.persistence.subPath }}
subPath: {{ .Values.server.persistence.subPath }}
{{- end }}
{{- end }}
{{- if .Values.server.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: prometheus
image: {{ template "prometheus.server.image" . }}
imagePullPolicy: {{ .Values.server.image.pullPolicy }}
{{- if .Values.server.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.server.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.server.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.server.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.server.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.server.args "context" $) | nindent 12 }}
{{- else }}
args:
- "--config.file=/opt/bitnami/prometheus/conf/{{ include "prometheus.server.configmapKey" . }}"
- "--storage.tsdb.path={{ .Values.server.persistence.mountPath }}"
- "--storage.tsdb.retention.time={{ .Values.server.retention }}"
- "--storage.tsdb.retention.size={{ .Values.server.retentionSize }}"
- "--log.level={{ .Values.server.logLevel }}"
- "--log.format={{ .Values.server.logFormat }}"
- "--web.listen-address=:{{ .Values.server.containerPorts.http }}"
- "--web.console.libraries=/opt/bitnami/prometheus/conf/console_libraries"
- "--web.console.templates=/opt/bitnami/prometheus/conf/consoles"
{{- if .Values.server.enableAdminAPI}}
- "--web.enable-admin-api"
{{- end }}
{{- if .Values.server.enableRemoteWriteReceiver }}
- "--web.enable-remote-write-receiver"
{{- end }}
{{- if .Values.server.routePrefix }}
- "--web.route-prefix={{ .Values.server.routePrefix }}"
{{- end }}
{{- if .Values.server.enableFeatures }}
- "--enable-feature={{ join "," .Values.server.enableFeatures }}"
{{- end }}
{{- if .Values.server.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
env:
{{- if .Values.server.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.server.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.server.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.server.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.server.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.server.resources }}
resources: {{- toYaml .Values.server.resources | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.server.containerPorts.http }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.server.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.server.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.server.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.server.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /-/healthy
port: http
{{- end }}
{{- if .Values.server.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.server.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.server.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.server.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /-/ready
port: http
{{- end }}
{{- if .Values.server.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.server.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.server.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.server.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- end }}
{{- end }}
{{- if .Values.server.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.server.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /opt/bitnami/prometheus/conf
readOnly: true
- name: data
mountPath: {{ .Values.server.persistence.mountPath }}
{{- if .Values.server.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.server.thanos.create }}
- name: thanos-sidecar
image: {{ template "prometheus.server.thanosImage" . }}
imagePullPolicy: {{ .Values.server.thanos.image.pullPolicy }}
args:
- sidecar
- --prometheus.url={{ default "http://localhost:9090" .Values.server.thanos.prometheusUrl }}
- --grpc-address=0.0.0.0:10901
- --http-address=0.0.0.0:10902
- --tsdb.path=/prometheus/
{{- if .Values.server.thanos.objectStorageConfig.secretName }}
- --objstore.config=$(OBJSTORE_CONFIG)
{{- end }}
{{- if .Values.server.thanos.extraArgs }}
{{ toYaml .Values.server.thanos.extraArgs | indent 12 | trim }}
{{- end }}
{{- if .Values.server.thanos.objectStorageConfig.secretName }}
env:
- name: OBJSTORE_CONFIG
valueFrom:
secretKeyRef:
name: {{ .Values.server.thanos.objectStorageConfig.secretName }}
key: {{ .Values.server.thanos.objectStorageConfig.secretKey | default "thanos.yaml" }}
{{- end }}
{{- if .Values.server.thanos.resources }}
resources: {{- toYaml .Values.server.thanos.resources | nindent 12 }}
{{- end }}
ports:
- name: grpc
containerPort: 10901
protocol: TCP
- name: http
containerPort: 10902
protocol: TCP
volumeMounts:
- mountPath: /prometheus
name: data
{{- if .Values.server.thanos.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.thanos.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.server.thanos.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.server.thanos.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.server.thanos.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.server.thanos.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.server.thanos.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.server.thanos.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /-/healthy
port: http
scheme: HTTP
{{- end }}
{{- if .Values.server.thanos.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.server.thanos.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.server.thanos.livenessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.server.thanos.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /-/ready
port: http
scheme: HTTP
{{- end }}
{{- end }}
{{- if .Values.server.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.server.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "prometheus.server.configmapName" . }}
- name: data
{{- if .Values.server.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ default (include "prometheus.server.fullname" .) .Values.server.persistence.existingClaim }}
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.server.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.extraVolumes "context" $) | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,61 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.server.ingress.enabled }}
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ template "prometheus.server.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: alertmanager
{{- if or .Values.server.ingress.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.server.ingress.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.server.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
ingressClassName: {{ .Values.server.ingress.ingressClassName | quote }}
{{- end }}
rules:
{{- if .Values.server.ingress.hostname }}
- host: {{ .Values.server.ingress.hostname }}
http:
paths:
{{- if .Values.server.ingress.extraPaths }}
{{- toYaml .Values.server.ingress.extraPaths | nindent 10 }}
{{- end }}
- path: {{ .Values.server.ingress.path }}
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.server.ingress.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "prometheus.server.fullname" .) "servicePort" "http" "context" $) | nindent 14 }}
{{- end }}
{{- range .Values.server.ingress.extraHosts }}
- host: {{ .name | quote }}
http:
paths:
- path: {{ default "/" .path }}
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ default "ImplementationSpecific" .pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "prometheus.server.fullname" $) "servicePort" "http" "context" $) | nindent 14 }}
{{- end }}
{{- if .Values.server.ingress.extraRules }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.ingress.extraRules "context" $) | nindent 4 }}
{{- end }}
{{- if or (and .Values.server.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.server.ingress.annotations )) .Values.server.ingress.selfSigned)) .Values.server.ingress.extraTls }}
tls:
{{- if and .Values.server.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.server.ingress.annotations )) .Values.server.ingress.selfSigned) }}
- hosts:
- {{ .Values.server.ingress.hostname | quote }}
secretName: {{ printf "%s-tls" .Values.server.ingress.hostname }}
{{- end }}
{{- if .Values.server.ingress.extraTls }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.ingress.extraTls "context" $) | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,31 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- $replicaCount := int .Values.replicaCount }}
{{- if and .Values.server.pdb.create (gt $replicaCount 1) }}
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ include "prometheus.server.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.server.pdb.minAvailable }}
minAvailable: {{ .Values.server.pdb.minAvailable }}
{{- end }}
{{- if .Values.server.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.server.pdb.maxUnavailable }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.server.podLabels .Values.commonLabels ) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
{{- end }}

View File

@@ -0,0 +1,34 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.server.persistence.enabled (not .Values.server.persistence.existingClaim) -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "prometheus.server.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
{{- if or .Values.server.persistence.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.server.persistence.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
accessModes:
{{- range .Values.server.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.server.persistence.size | quote }}
{{- if .Values.server.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.server.persistence.selector "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.server.persistence.dataSource }}
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.server.persistence.dataSource "context" $) | nindent 4 }}
{{- end }}
{{- include "common.storage.class" (dict "persistence" .Values.server.persistence "global" .Values.global) | nindent 2 }}
{{- end -}}

View File

@@ -0,0 +1,20 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.server.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "prometheus.server.serviceAccountName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
{{- if or .Values.server.serviceAccount.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.server.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.server.serviceAccount.automountServiceAccountToken }}
{{- end }}

View File

@@ -0,0 +1,57 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "prometheus.server.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
{{- if or .Values.server.service.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.server.service.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.server.service.type }}
{{- if and .Values.server.service.clusterIP (eq .Values.server.service.type "ClusterIP") }}
clusterIP: {{ .Values.server.service.clusterIP }}
{{- end }}
{{- if .Values.server.service.sessionAffinity }}
sessionAffinity: {{ .Values.server.service.sessionAffinity }}
{{- end }}
{{- if .Values.server.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.server.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if or (eq .Values.server.service.type "LoadBalancer") (eq .Values.server.service.type "NodePort") }}
externalTrafficPolicy: {{ .Values.server.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if and (eq .Values.server.service.type "LoadBalancer") (not (empty .Values.server.service.loadBalancerSourceRanges)) }}
loadBalancerSourceRanges: {{ .Values.server.service.loadBalancerSourceRanges }}
{{- end }}
{{- if and (eq .Values.server.service.type "LoadBalancer") (not (empty .Values.server.service.loadBalancerIP)) }}
loadBalancerIP: {{ .Values.server.service.loadBalancerIP }}
{{- end }}
{{- if and (eq .Values.server.service.type "LoadBalancer") (not (empty .Values.server.service.loadBalancerClass)) }}
loadBalancerClass: {{ .Values.server.service.loadBalancerClass }}
{{- end }}
ports:
- name: http
port: {{ .Values.server.service.ports.http }}
targetPort: http
protocol: TCP
{{- if and (or (eq .Values.server.service.type "NodePort") (eq .Values.server.service.type "LoadBalancer")) (not (empty .Values.server.service.nodePorts.http)) }}
nodePort: {{ .Values.server.service.nodePorts.http }}
{{- else if eq .Values.server.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.server.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.server.podLabels .Values.commonLabels ) "context" . ) }}
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server

View File

@@ -0,0 +1,62 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.server.thanos.create .Values.server.thanos.ingress.enabled }}
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ template "prometheus.thanos-sidecar.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
app.kubernetes.io/subcomponent: thanos
{{- if or .Values.server.thanos.ingress.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.server.thanos.ingress.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.server.thanos.ingress.ingressClassName (include "common.ingress.supportsIngressClassname" .) }}
ingressClassName: {{ .Values.server.thanos.ingress.ingressClassName | quote }}
{{- end }}
rules:
{{- if .Values.server.thanos.ingress.hostname }}
- host: {{ .Values.server.thanos.ingress.hostname }}
http:
paths:
{{- if .Values.server.thanos.ingress.extraPaths }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.thanos.ingress.extraPaths "context" $) | nindent 10 }}
{{- end }}
- path: {{ .Values.server.thanos.ingress.path }}
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.server.thanos.ingress.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "prometheus.thanos-sidecar.fullname" $) "servicePort" "grpc" "context" $) | nindent 14 }}
{{- end }}
{{- range .Values.server.thanos.ingress.extraHosts }}
- host: {{ .name | quote }}
http:
paths:
- path: {{ default "/" .path }}
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ default "ImplementationSpecific" .pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "prometheus.thanos-sidecar.fullname" $) "servicePort" "grpc" "context" $) | nindent 14 }}
{{- end }}
{{- if .Values.server.thanos.ingress.extraRules }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.thanos.ingress.extraRules "context" $) | nindent 4 }}
{{- end }}
{{- if or (and .Values.server.thanos.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.server.thanos.ingress.annotations )) .Values.server.thanos.ingress.selfSigned)) .Values.server.thanos.ingress.extraTls }}
tls:
{{- if and .Values.server.thanos.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.server.thanos.ingress.annotations )) .Values.server.thanos.ingress.selfSigned) }}
- hosts:
- {{ .Values.server.thanos.ingress.hostname | quote }}
secretName: {{ printf "%s-tls" .Values.server.thanos.ingress.hostname }}
{{- end }}
{{- if .Values.server.thanos.ingress.extraTls }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.thanos.ingress.extraTls "context" $) | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,58 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.server.thanos.create }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "prometheus.thanos-sidecar.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
app.kubernetes.io/subcomponent: thanos
{{- if or .Values.server.thanos.service.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.server.thanos.service.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.server.thanos.service.type }}
{{- if and (eq .Values.server.thanos.service.type "LoadBalancer") (not (empty .Values.server.thanos.service.loadBalancerIP)) }}
loadBalancerIP: {{ .Values.server.thanos.service.loadBalancerIP }}
{{- end }}
{{- if and (eq .Values.server.thanos.service.type "LoadBalancer") (not (empty .Values.server.thanos.service.loadBalancerClass)) }}
loadBalancerClass: {{ .Values.server.thanos.service.loadBalancerClass }}
{{- end }}
{{- if and (eq .Values.server.thanos.service.type "LoadBalancer") (not (empty .Values.server.thanos.service.loadBalancerSourceRanges)) }}
loadBalancerSourceRanges: {{ .Values.server.thanos.service.loadBalancerSourceRanges }}
{{- end }}
{{- if and .Values.server.thanos.service.clusterIP (eq .Values.server.thanos.service.type "ClusterIP") }}
clusterIP: {{ .Values.server.thanos.service.clusterIP }}
{{- end }}
{{- if .Values.server.thanos.service.sessionAffinity }}
sessionAffinity: {{ .Values.server.thanos.service.sessionAffinity }}
{{- end }}
{{- if .Values.server.thanos.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.server.thanos.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if or (eq .Values.server.thanos.service.type "LoadBalancer") (eq .Values.server.thanos.service.type "NodePort") }}
externalTrafficPolicy: {{ .Values.server.thanos.service.externalTrafficPolicy | quote }}
{{- end }}
ports:
- name: grpc
port: {{ .Values.server.thanos.service.ports.grpc }}
targetPort: grpc
protocol: TCP
{{- if and .Values.server.thanos.service.nodePorts.grpc (or (eq .Values.server.thanos.service.type "NodePort") (eq .Values.server.thanos.service.type "LoadBalancer")) }}
nodePort: {{ .Values.server.thanos.service.nodePorts.grpc }}
{{- end }}
{{- if .Values.server.thanos.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.thanos.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.server.podLabels .Values.commonLabels ) "context" . ) }}
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: prometheus
app.kubernetes.io/component: server
{{- end }}