Adding dependencies, binary autostart
This commit is contained in:
		
							
								
								
									
										47
									
								
								opencloud/charts/loki/templates/gateway/_helpers-gateway.tpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								opencloud/charts/loki/templates/gateway/_helpers-gateway.tpl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
{{/*
 | 
			
		||||
gateway fullname
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "loki.gatewayFullname" -}}
 | 
			
		||||
{{ include "loki.fullname" . }}-gateway
 | 
			
		||||
{{- end }}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
gateway common labels
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "loki.gatewayLabels" -}}
 | 
			
		||||
{{ include "loki.labels" . }}
 | 
			
		||||
app.kubernetes.io/component: gateway
 | 
			
		||||
{{- end }}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
gateway selector labels
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "loki.gatewaySelectorLabels" -}}
 | 
			
		||||
{{ include "loki.selectorLabels" . }}
 | 
			
		||||
app.kubernetes.io/component: gateway
 | 
			
		||||
{{- end }}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
gateway auth secret name
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "loki.gatewayAuthSecret" -}}
 | 
			
		||||
{{ .Values.gateway.basicAuth.existingSecret | default (include "loki.gatewayFullname" . ) }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
gateway Docker image
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "loki.gatewayImage" -}}
 | 
			
		||||
{{- $dict := dict "service" .Values.gateway.image "global" .Values.global.image -}}
 | 
			
		||||
{{- include "loki.baseImage" $dict -}}
 | 
			
		||||
{{- end }}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
gateway priority class name
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "loki.gatewayPriorityClassName" -}}
 | 
			
		||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.gateway.priorityClassName -}}
 | 
			
		||||
{{- if $pcn }}
 | 
			
		||||
priorityClassName: {{ $pcn }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
{{- if and .Values.gateway.enabled (not (and .Values.enterprise.enabled .Values.enterprise.gelGateway)) }}
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
kind: ConfigMap
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.gatewayFullname" . }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.gatewayLabels" . | nindent 4 }}
 | 
			
		||||
data:
 | 
			
		||||
  nginx.conf: |
 | 
			
		||||
    {{- tpl .Values.gateway.nginxConfig.file . | indent 2 }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
@@ -0,0 +1,152 @@
 | 
			
		||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
 | 
			
		||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
 | 
			
		||||
{{- if and .Values.gateway.enabled .Values.enterprise.enabled .Values.enterprise.gelGateway }}
 | 
			
		||||
apiVersion: apps/v1
 | 
			
		||||
kind: Deployment
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ template "loki.gatewayFullname" . }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.gatewayLabels" . | nindent 4 }}
 | 
			
		||||
    {{- with .Values.enterpriseGateway.labels }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- with .Values.enterpriseGateway.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
spec:
 | 
			
		||||
  replicas: {{ .Values.enterpriseGateway.replicas }}
 | 
			
		||||
  selector:
 | 
			
		||||
    matchLabels:
 | 
			
		||||
      {{- include "loki.gatewaySelectorLabels" . | nindent 6 }}
 | 
			
		||||
  strategy:
 | 
			
		||||
    {{- toYaml .Values.enterpriseGateway.strategy | nindent 4 }}
 | 
			
		||||
  template:
 | 
			
		||||
    metadata:
 | 
			
		||||
      labels:
 | 
			
		||||
        {{- include "loki.gatewaySelectorLabels" . | nindent 8 }}
 | 
			
		||||
        {{- with .Values.enterpriseGateway.labels }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      annotations:
 | 
			
		||||
        {{- if .Values.useExternalConfig }}
 | 
			
		||||
        checksum/config: {{ .Values.externalConfigVersion }}
 | 
			
		||||
        {{- else }}
 | 
			
		||||
        checksum/config: {{ include "loki.configMapOrSecretContentHash" (dict "ctx" . "name" "/config.yaml") }}
 | 
			
		||||
        {{- end}}
 | 
			
		||||
        {{- with .Values.enterpriseGateway.annotations }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
    spec:
 | 
			
		||||
      {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
 | 
			
		||||
      {{- with .Values.enterpriseGateway.topologySpreadConstraints }}
 | 
			
		||||
      topologySpreadConstraints:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- end }}    
 | 
			
		||||
      serviceAccountName: {{ template "loki.serviceAccountName" . }}
 | 
			
		||||
      {{- if .Values.enterpriseGateway.priorityClassName }}
 | 
			
		||||
      priorityClassName: {{ .Values.enterpriseGateway.priorityClassName }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      securityContext:
 | 
			
		||||
        {{- toYaml .Values.enterpriseGateway.podSecurityContext | nindent 8 }}
 | 
			
		||||
      initContainers:
 | 
			
		||||
        {{- toYaml .Values.enterpriseGateway.initContainers | nindent 8 }}
 | 
			
		||||
      {{- with .Values.imagePullSecrets }}
 | 
			
		||||
      imagePullSecrets:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.enterpriseGateway.hostAliases }}
 | 
			
		||||
      hostAliases:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      containers:
 | 
			
		||||
        - name: gateway
 | 
			
		||||
          image: "{{ template "loki.image" . }}"
 | 
			
		||||
          imagePullPolicy: {{ .Values.enterprise.image.pullPolicy }}
 | 
			
		||||
          args:
 | 
			
		||||
            - -target=gateway
 | 
			
		||||
            - -config.file=/etc/loki/config/config.yaml
 | 
			
		||||
            {{- if .Values.minio.enabled }}
 | 
			
		||||
            - -admin.client.backend-type=s3
 | 
			
		||||
            - -admin.client.s3.endpoint={{ template "loki.minio" . }}
 | 
			
		||||
            - -admin.client.s3.bucket-name=enterprise-logs-admin
 | 
			
		||||
            - -admin.client.s3.access-key-id={{ .Values.minio.accessKey }}
 | 
			
		||||
            - -admin.client.s3.secret-access-key={{ .Values.minio.secretKey }}
 | 
			
		||||
            - -admin.client.s3.insecure=true
 | 
			
		||||
            {{- end }}
 | 
			
		||||
            {{- if and $isDistributed .Values.enterpriseGateway.useDefaultProxyURLs }}
 | 
			
		||||
            - -gateway.proxy.default.url=http://{{ template "loki.fullname" . }}-admin-api.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            - -gateway.proxy.admin-api.url=http://{{ template "loki.fullname" . }}-admin-api.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            - -gateway.proxy.distributor.url=dns:///{{ template "loki.fullname" . }}-distributor-headless.{{ .Release.Namespace }}.svc:9095
 | 
			
		||||
            - -gateway.proxy.ingester.url=http://{{ template "loki.fullname" . }}-ingester.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            - -gateway.proxy.query-frontend.url=http://{{ template "loki.fullname" . }}-query-frontend.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            - -gateway.proxy.ruler.url=http://{{ template "loki.fullname" . }}-ruler.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            {{- end }}
 | 
			
		||||
            {{- if and $isSimpleScalable .Values.enterpriseGateway.useDefaultProxyURLs }}
 | 
			
		||||
            - -gateway.proxy.default.url=http://{{ template "enterprise-logs.adminApiFullname" . }}.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            - -gateway.proxy.admin-api.url=http://{{ template "enterprise-logs.adminApiFullname" . }}.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            - -gateway.proxy.compactor.url=http://{{ template "loki.backendFullname" . }}-headless.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            - -gateway.proxy.distributor.url=dns:///{{ template "loki.writeFullname" . }}-headless.{{ .Release.Namespace }}.svc:9095
 | 
			
		||||
            - -gateway.proxy.ingester.url=http://{{ template "loki.writeFullname" . }}.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            - -gateway.proxy.query-frontend.url=http://{{ template "loki.readFullname" . }}.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            - -gateway.proxy.ruler.url=http://{{ template "loki.backendFullname" . }}-headless.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            - -gateway.proxy.query-scheduler.url=http://{{ template "loki.backendFullname" . }}-headless.{{ .Release.Namespace }}.svc:3100
 | 
			
		||||
            {{- end }}
 | 
			
		||||
            {{- range $key, $value := .Values.enterpriseGateway.extraArgs }}
 | 
			
		||||
            - "-{{ $key }}={{ $value }}"
 | 
			
		||||
            {{- end }}
 | 
			
		||||
          volumeMounts:
 | 
			
		||||
            - name: config
 | 
			
		||||
              mountPath: /etc/loki/config
 | 
			
		||||
            - name: license
 | 
			
		||||
              mountPath: /etc/loki/license
 | 
			
		||||
            - name: storage
 | 
			
		||||
              mountPath: /data
 | 
			
		||||
            {{- if .Values.enterpriseGateway.extraVolumeMounts }}
 | 
			
		||||
            {{ toYaml .Values.enterpriseGateway.extraVolumeMounts | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
          ports:
 | 
			
		||||
            - name: http-metrics
 | 
			
		||||
              containerPort: 3100
 | 
			
		||||
              protocol: TCP
 | 
			
		||||
          readinessProbe:
 | 
			
		||||
            {{- toYaml .Values.enterpriseGateway.readinessProbe | nindent 12 }}
 | 
			
		||||
          resources:
 | 
			
		||||
            {{- toYaml .Values.enterpriseGateway.resources | nindent 12 }}
 | 
			
		||||
          securityContext:
 | 
			
		||||
            {{- toYaml .Values.enterpriseGateway.containerSecurityContext | nindent 12 }}
 | 
			
		||||
          env:
 | 
			
		||||
            {{- if .Values.enterpriseGateway.env }}
 | 
			
		||||
            {{ toYaml .Values.enterpriseGateway.env | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
            {{- with .Values.enterpriseGateway.extraEnvFrom }}
 | 
			
		||||
          envFrom:
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
        {{- with .Values.enterpriseGateway.extraContainers }}
 | 
			
		||||
        {{ toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      nodeSelector:
 | 
			
		||||
        {{- toYaml .Values.enterpriseGateway.nodeSelector | nindent 8 }}
 | 
			
		||||
      affinity:
 | 
			
		||||
        {{- toYaml .Values.enterpriseGateway.affinity | nindent 8 }}
 | 
			
		||||
      tolerations:
 | 
			
		||||
        {{- toYaml .Values.enterpriseGateway.tolerations | nindent 8 }}
 | 
			
		||||
      terminationGracePeriodSeconds: {{ .Values.enterpriseGateway.terminationGracePeriodSeconds }}
 | 
			
		||||
      volumes:
 | 
			
		||||
        - name: config
 | 
			
		||||
          {{- include "loki.configVolume" . | nindent 10 }}
 | 
			
		||||
        - name: license
 | 
			
		||||
          secret:
 | 
			
		||||
          {{- if .Values.enterprise.useExternalLicense }}
 | 
			
		||||
            secretName: {{ .Values.enterprise.externalLicenseName }}
 | 
			
		||||
          {{- else }}
 | 
			
		||||
            secretName: enterprise-logs-license
 | 
			
		||||
          {{- end }}
 | 
			
		||||
        - name: storage
 | 
			
		||||
          emptyDir: {}
 | 
			
		||||
        {{- if .Values.enterpriseGateway.extraVolumes }}
 | 
			
		||||
        {{ toYaml .Values.enterpriseGateway.extraVolumes | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
@@ -0,0 +1,138 @@
 | 
			
		||||
{{- if and .Values.gateway.enabled (not (and .Values.enterprise.enabled .Values.enterprise.gelGateway)) }}
 | 
			
		||||
apiVersion: apps/v1
 | 
			
		||||
kind: Deployment
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.gatewayFullname" . }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.gatewayLabels" . | nindent 4 }}
 | 
			
		||||
  {{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- with .Values.loki.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- with .Values.gateway.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
spec:
 | 
			
		||||
{{- if not .Values.gateway.autoscaling.enabled }}
 | 
			
		||||
  replicas: {{ .Values.gateway.replicas }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
{{- with .Values.gateway.deploymentStrategy }}
 | 
			
		||||
  strategy:
 | 
			
		||||
{{ toYaml . | trim | indent 4 }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
  revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
 | 
			
		||||
  selector:
 | 
			
		||||
    matchLabels:
 | 
			
		||||
      {{- include "loki.gatewaySelectorLabels" . | nindent 6 }}
 | 
			
		||||
  template:
 | 
			
		||||
    metadata:
 | 
			
		||||
      annotations:
 | 
			
		||||
        checksum/config: {{ include "loki.configMapOrSecretContentHash" (dict "ctx" . "name" "/gateway/configmap-gateway.yaml") }}
 | 
			
		||||
        {{- with .Values.loki.podAnnotations }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        {{- with .Values.gateway.podAnnotations }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      labels:
 | 
			
		||||
        {{- with .Values.loki.podLabels }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        {{- with .Values.gateway.podLabels }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        {{- include "loki.gatewaySelectorLabels" . | nindent 8 }}
 | 
			
		||||
    spec:
 | 
			
		||||
      serviceAccountName: {{ include "loki.serviceAccountName" . }}
 | 
			
		||||
      {{ include "loki.enableServiceLinks" . }}
 | 
			
		||||
      {{- with .Values.imagePullSecrets }}
 | 
			
		||||
      imagePullSecrets:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end -}}
 | 
			
		||||
      {{- include "loki.gatewayPriorityClassName" . | nindent 6 }}
 | 
			
		||||
      securityContext:
 | 
			
		||||
        {{- toYaml .Values.gateway.podSecurityContext | nindent 8 }}
 | 
			
		||||
      terminationGracePeriodSeconds: {{ .Values.gateway.terminationGracePeriodSeconds }}
 | 
			
		||||
      containers:
 | 
			
		||||
        - name: nginx
 | 
			
		||||
          image: {{ include "loki.gatewayImage" . }}
 | 
			
		||||
          imagePullPolicy: {{ .Values.gateway.image.pullPolicy }}
 | 
			
		||||
          ports:
 | 
			
		||||
            - name: http-metrics
 | 
			
		||||
              containerPort: {{ .Values.gateway.containerPort }}
 | 
			
		||||
              protocol: TCP
 | 
			
		||||
          {{- with .Values.gateway.extraEnv }}
 | 
			
		||||
          env:
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
          {{- end }}
 | 
			
		||||
          {{- with .Values.gateway.extraEnvFrom }}
 | 
			
		||||
          envFrom:
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
          {{- end }}
 | 
			
		||||
          readinessProbe:
 | 
			
		||||
            {{- toYaml .Values.gateway.readinessProbe | nindent 12 }}
 | 
			
		||||
          securityContext:
 | 
			
		||||
            {{- toYaml .Values.gateway.containerSecurityContext | nindent 12 }}
 | 
			
		||||
          {{- with .Values.gateway.lifecycle }}
 | 
			
		||||
          lifecycle:
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
          {{- end }}
 | 
			
		||||
          volumeMounts:
 | 
			
		||||
            - name: config
 | 
			
		||||
              mountPath: /etc/nginx
 | 
			
		||||
            {{- if .Values.gateway.basicAuth.enabled }}
 | 
			
		||||
            - name: auth
 | 
			
		||||
              mountPath: /etc/nginx/secrets
 | 
			
		||||
            {{- end }}
 | 
			
		||||
            - name: tmp
 | 
			
		||||
              mountPath: /tmp
 | 
			
		||||
            - name: docker-entrypoint-d-override
 | 
			
		||||
              mountPath: /docker-entrypoint.d
 | 
			
		||||
            {{- if .Values.gateway.extraVolumeMounts }}
 | 
			
		||||
            {{- toYaml .Values.gateway.extraVolumeMounts | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
          resources:
 | 
			
		||||
            {{- toYaml .Values.gateway.resources | nindent 12 }}
 | 
			
		||||
        {{- if .Values.gateway.extraContainers }}
 | 
			
		||||
        {{- toYaml .Values.gateway.extraContainers | nindent 8}}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      {{- with .Values.gateway.affinity }}
 | 
			
		||||
      affinity:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.gateway.dnsConfig }}
 | 
			
		||||
      dnsConfig:
 | 
			
		||||
        {{- tpl . $ | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.gateway.nodeSelector }}
 | 
			
		||||
      nodeSelector:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.gateway.topologySpreadConstraints }}
 | 
			
		||||
      topologySpreadConstraints:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.gateway.tolerations }}
 | 
			
		||||
      tolerations:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      volumes:
 | 
			
		||||
        - name: config
 | 
			
		||||
          configMap:
 | 
			
		||||
            name: {{ include "loki.gatewayFullname" . }}
 | 
			
		||||
        {{- if .Values.gateway.basicAuth.enabled }}
 | 
			
		||||
        - name: auth
 | 
			
		||||
          secret:
 | 
			
		||||
            secretName: {{ include "loki.gatewayAuthSecret" . }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        - name: tmp
 | 
			
		||||
          emptyDir: {}
 | 
			
		||||
        - name: docker-entrypoint-d-override
 | 
			
		||||
          emptyDir: {}
 | 
			
		||||
        {{- if .Values.gateway.extraVolumes }}
 | 
			
		||||
        {{- toYaml .Values.gateway.extraVolumes | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
							
								
								
									
										50
									
								
								opencloud/charts/loki/templates/gateway/hpa.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								opencloud/charts/loki/templates/gateway/hpa.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
{{- $autoscalingv2 := .Capabilities.APIVersions.Has "autoscaling/v2" -}}
 | 
			
		||||
{{- if .Values.gateway.autoscaling.enabled }}
 | 
			
		||||
{{- if $autoscalingv2 }}
 | 
			
		||||
apiVersion: autoscaling/v2
 | 
			
		||||
{{- else }}
 | 
			
		||||
apiVersion: autoscaling/v2beta1
 | 
			
		||||
{{- end }}
 | 
			
		||||
kind: HorizontalPodAutoscaler
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.gatewayFullname" . }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.gatewayLabels" . | nindent 4 }}
 | 
			
		||||
spec:
 | 
			
		||||
  scaleTargetRef:
 | 
			
		||||
    apiVersion: apps/v1
 | 
			
		||||
    kind: Deployment
 | 
			
		||||
    name: {{ include "loki.gatewayFullname" . }}
 | 
			
		||||
  minReplicas: {{ .Values.gateway.autoscaling.minReplicas }}
 | 
			
		||||
  maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }}
 | 
			
		||||
  {{- with .Values.gateway.autoscaling.behavior }}
 | 
			
		||||
  behavior:
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  metrics:
 | 
			
		||||
  {{- with .Values.gateway.autoscaling.targetMemoryUtilizationPercentage }}
 | 
			
		||||
    - type: Resource
 | 
			
		||||
      resource:
 | 
			
		||||
        name: memory
 | 
			
		||||
        {{- if $autoscalingv2 }}
 | 
			
		||||
        target:
 | 
			
		||||
          type: Utilization
 | 
			
		||||
          averageUtilization: {{ . }}
 | 
			
		||||
        {{- else }}
 | 
			
		||||
        targetAverageUtilization: {{ . }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  {{- with .Values.gateway.autoscaling.targetCPUUtilizationPercentage }}
 | 
			
		||||
    - type: Resource
 | 
			
		||||
      resource:
 | 
			
		||||
        name: cpu
 | 
			
		||||
        {{- if $autoscalingv2 }}
 | 
			
		||||
        target:
 | 
			
		||||
          type: Utilization
 | 
			
		||||
          averageUtilization: {{ . }}
 | 
			
		||||
        {{- else }}
 | 
			
		||||
        targetAverageUtilization: {{ . }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
							
								
								
									
										59
									
								
								opencloud/charts/loki/templates/gateway/ingress-gateway.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								opencloud/charts/loki/templates/gateway/ingress-gateway.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
{{- if and .Values.gateway.enabled -}}
 | 
			
		||||
{{- if .Values.gateway.ingress.enabled -}}
 | 
			
		||||
{{- $ingressApiIsStable := eq (include "loki.ingress.isStable" .) "true" -}}
 | 
			
		||||
{{- $ingressSupportsIngressClassName := eq (include "loki.ingress.supportsIngressClassName" .) "true" -}}
 | 
			
		||||
{{- $ingressSupportsPathType := eq (include "loki.ingress.supportsPathType" .) "true" -}}
 | 
			
		||||
apiVersion: {{ include "loki.ingress.apiVersion" . }}
 | 
			
		||||
kind: Ingress
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.gatewayFullname" . }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.gatewayLabels" . | nindent 4 }}
 | 
			
		||||
    {{- range $labelKey, $labelValue := .Values.gateway.ingress.labels }}
 | 
			
		||||
    {{ $labelKey }}: {{ $labelValue | toYaml }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  {{- with .Values.gateway.ingress.annotations }}
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
spec:
 | 
			
		||||
  {{- if and $ingressSupportsIngressClassName .Values.gateway.ingress.ingressClassName }}
 | 
			
		||||
  ingressClassName: {{ .Values.gateway.ingress.ingressClassName }}
 | 
			
		||||
  {{- end -}}
 | 
			
		||||
  {{- if .Values.gateway.ingress.tls }}
 | 
			
		||||
  tls:
 | 
			
		||||
    {{- range .Values.gateway.ingress.tls }}
 | 
			
		||||
    - hosts:
 | 
			
		||||
        {{- range .hosts }}
 | 
			
		||||
        - {{ tpl . $ | quote }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      {{- with .secretName }}
 | 
			
		||||
      secretName: {{ . }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  rules:
 | 
			
		||||
    {{- range .Values.gateway.ingress.hosts }}
 | 
			
		||||
    - host: {{ tpl .host $ | quote }}
 | 
			
		||||
      http:
 | 
			
		||||
        paths:
 | 
			
		||||
          {{- range .paths }}
 | 
			
		||||
          - path: {{ .path }}
 | 
			
		||||
            {{- if $ingressSupportsPathType }}
 | 
			
		||||
            pathType: {{ .pathType }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
            backend:
 | 
			
		||||
              {{- if $ingressApiIsStable }}
 | 
			
		||||
              service:
 | 
			
		||||
                name: {{ include "loki.gatewayFullname" $ }}
 | 
			
		||||
                port:
 | 
			
		||||
                  number: {{ $.Values.gateway.service.port }}
 | 
			
		||||
              {{- else }}
 | 
			
		||||
              serviceName: {{ include "loki.gatewayFullname" $ }}
 | 
			
		||||
              servicePort: {{ $.Values.gateway.service.port }}
 | 
			
		||||
              {{- end }}
 | 
			
		||||
          {{- end }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
@@ -0,0 +1,19 @@
 | 
			
		||||
{{- if and .Values.gateway.enabled }}
 | 
			
		||||
{{- if or 
 | 
			
		||||
  (and (not .Values.gateway.autoscaling.enabled) (gt (int .Values.gateway.replicas) 1)) 
 | 
			
		||||
  (and .Values.gateway.autoscaling.enabled (gt (int .Values.gateway.autoscaling.minReplicas) 1))
 | 
			
		||||
}}
 | 
			
		||||
apiVersion: policy/v1
 | 
			
		||||
kind: PodDisruptionBudget
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.gatewayFullname" . }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.gatewayLabels" . | nindent 4 }}
 | 
			
		||||
spec:
 | 
			
		||||
  selector:
 | 
			
		||||
    matchLabels:
 | 
			
		||||
      {{- include "loki.gatewaySelectorLabels" . | nindent 6 }}
 | 
			
		||||
  maxUnavailable: 1
 | 
			
		||||
{{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
							
								
								
									
										14
									
								
								opencloud/charts/loki/templates/gateway/secret-gateway.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								opencloud/charts/loki/templates/gateway/secret-gateway.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
{{- with .Values.gateway }}
 | 
			
		||||
{{- if and .enabled .basicAuth.enabled (not .basicAuth.existingSecret) }}
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
kind: Secret
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.gatewayFullname" $ }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.gatewayLabels" $ | nindent 4 }}
 | 
			
		||||
stringData:
 | 
			
		||||
  .htpasswd: |
 | 
			
		||||
    {{- tpl .basicAuth.htpasswd $ | nindent 4 }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
							
								
								
									
										40
									
								
								opencloud/charts/loki/templates/gateway/service-gateway.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								opencloud/charts/loki/templates/gateway/service-gateway.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
{{- if .Values.gateway.enabled }}
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
kind: Service
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.gatewayFullname" . }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.gatewayLabels" . | nindent 4 }}
 | 
			
		||||
    {{- with .Values.loki.serviceLabels }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- with .Values.gateway.service.labels }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- with .Values.loki.serviceAnnotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- with .Values.gateway.service.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
spec:
 | 
			
		||||
  type: {{ .Values.gateway.service.type }}
 | 
			
		||||
  {{- with .Values.gateway.service.clusterIP }}
 | 
			
		||||
  clusterIP: {{ . }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  {{- if and (eq "LoadBalancer" .Values.gateway.service.type) .Values.gateway.service.loadBalancerIP }}
 | 
			
		||||
  loadBalancerIP: {{ .Values.gateway.service.loadBalancerIP }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  ports:
 | 
			
		||||
    - name: http-metrics
 | 
			
		||||
      port: {{ .Values.gateway.service.port }}
 | 
			
		||||
      targetPort: http-metrics
 | 
			
		||||
      {{- if and (eq "NodePort" .Values.gateway.service.type) .Values.gateway.service.nodePort }}
 | 
			
		||||
      nodePort: {{ .Values.gateway.service.nodePort }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      protocol: TCP
 | 
			
		||||
  selector:
 | 
			
		||||
    {{- include "loki.gatewaySelectorLabels" . | nindent 4 }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
		Reference in New Issue
	
	Block a user