├── .gitignore ├── templates ├── serviceaccount.yaml ├── tests │ └── test-connection.yaml ├── service.yaml ├── NOTES.txt ├── _helpers.tpl ├── hpa.yaml ├── ingress.yaml └── deployment.yaml ├── README.md ├── .helmignore ├── LICENSE ├── Chart.yaml └── values.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | values-test.yaml 2 | -------------------------------------------------------------------------------- /templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.serviceAccount.create -}} 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: {{ include "gtm-cloud-helm.serviceAccountName" . }} 6 | labels: 7 | {{- include "gtm-cloud-helm.labels" . | nindent 4 }} 8 | {{- with .Values.serviceAccount.annotations }} 9 | annotations: 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | {{- end }} 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Unofficial] Google Tag Manager Helm Chart 2 | 3 | This repository provides a helm chart to deploy and manage the Google Tag Manager Serverside Tagging Container. 4 | It uses the official gtm-cloud-image to deploy both the preview server aswell as the Serverside Tagging Cluster to Kubernetes. 5 | 6 | [Official Documentation](https://developers.google.com/tag-platform/tag-manager/server-side?#set_up_a_tagging_server) -------------------------------------------------------------------------------- /.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /templates/tests/test-connection.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: "{{ include "gtm-cloud-helm.fullname" . }}-test-connection" 5 | labels: 6 | {{- include "gtm-cloud-helm.labels" . | nindent 4 }} 7 | annotations: 8 | "helm.sh/hook": test 9 | spec: 10 | containers: 11 | - name: wget 12 | image: busybox 13 | command: ['wget'] 14 | args: ['{{ include "gtm-cloud-helm.fullname" . }}:{{ .Values.sst.service.port }}'] 15 | restartPolicy: Never 16 | -------------------------------------------------------------------------------- /templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ include "gtm-cloud-helm.fullname" . }}-preview 5 | labels: 6 | {{- include "gtm-cloud-helm.labels" . | nindent 4 }} 7 | spec: 8 | type: {{ .Values.preview.service.type }} 9 | ports: 10 | - port: {{ .Values.preview.service.port }} 11 | targetPort: http 12 | protocol: TCP 13 | name: http 14 | selector: 15 | {{- include "gtm-cloud-helm.selectorLabels" . | nindent 4 }} 16 | --- 17 | apiVersion: v1 18 | kind: Service 19 | metadata: 20 | name: {{ include "gtm-cloud-helm.fullname" . }}-sst 21 | labels: 22 | {{- include "gtm-cloud-helm.labels" . | nindent 4 }} 23 | spec: 24 | type: {{ .Values.sst.service.type }} 25 | ports: 26 | - port: {{ .Values.sst.service.port }} 27 | targetPort: http 28 | protocol: TCP 29 | name: http 30 | selector: 31 | {{- include "gtm-cloud-helm.selectorLabels" . | nindent 4 }} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023 Marius Schäffer and others 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: gtm-cloud-helm 3 | description: A helm chart to deploy the gtm-cloud-image to a kubernetes cluster. 4 | 5 | # A chart can be either an 'application' or a 'library' chart. 6 | # 7 | # Application charts are a collection of templates that can be packaged into versioned archives 8 | # to be deployed. 9 | # 10 | # Library charts provide useful utilities or functions for the chart developer. They're included as 11 | # a dependency of application charts to inject those utilities and functions into the rendering 12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed. 13 | type: application 14 | 15 | # This is the chart version. This version number should be incremented each time you make changes 16 | # to the chart and its templates, including the app version. 17 | # Versions are expected to follow Semantic Versioning (https://semver.org/) 18 | version: 0.1.0 19 | 20 | # This is the version number of the application being deployed. This version number should be 21 | # incremented each time you make changes to the application. Versions are not expected to 22 | # follow Semantic Versioning. They should reflect the version the application is using. 23 | # It is recommended to use it with quotes. 24 | appVersion: "1.1.0" 25 | -------------------------------------------------------------------------------- /templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | 1. Get the application URL by running these commands: 2 | {{- if .Values.preview.ingress.enabled }} 3 | {{- range $host := .Values.preview.ingress.hosts }} 4 | {{- range .paths }} 5 | http{{ if $.Values.preview.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} 6 | {{- end }} 7 | {{- end }} 8 | {{- else if contains "NodePort" .Values.preview.service.type }} 9 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "gtm-cloud-helm.fullname" . }}) 10 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") 11 | echo http://$NODE_IP:$NODE_PORT 12 | {{- else if contains "LoadBalancer" .Values.preview.service.type }} 13 | NOTE: It may take a few minutes for the LoadBalancer IP to be available. 14 | You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "gtm-cloud-helm.fullname" . }}' 15 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "gtm-cloud-helm.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") 16 | echo http://$SERVICE_IP:{{ .Values.service.port }} 17 | {{- else if contains "ClusterIP" .Values.preview.service.type }} 18 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "gtm-cloud-helm.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") 19 | export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") 20 | echo "Visit http://127.0.0.1:8080 to use your application" 21 | kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT 22 | {{- end }} 23 | -------------------------------------------------------------------------------- /templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Expand the name of the chart. 3 | */}} 4 | {{- define "gtm-cloud-helm.name" -}} 5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} 6 | {{- end }} 7 | 8 | {{/* 9 | Create a default fully qualified app name. 10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 11 | If release name contains chart name it will be used as a full name. 12 | */}} 13 | {{- define "gtm-cloud-helm.fullname" -}} 14 | {{- if .Values.fullnameOverride }} 15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} 16 | {{- else }} 17 | {{- $name := default .Chart.Name .Values.nameOverride }} 18 | {{- if contains $name .Release.Name }} 19 | {{- .Release.Name | trunc 63 | trimSuffix "-" }} 20 | {{- else }} 21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} 22 | {{- end }} 23 | {{- end }} 24 | {{- end }} 25 | 26 | {{/* 27 | Create chart name and version as used by the chart label. 28 | */}} 29 | {{- define "gtm-cloud-helm.chart" -}} 30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} 31 | {{- end }} 32 | 33 | {{/* 34 | Common labels 35 | */}} 36 | {{- define "gtm-cloud-helm.labels" -}} 37 | helm.sh/chart: {{ include "gtm-cloud-helm.chart" . }} 38 | {{ include "gtm-cloud-helm.selectorLabels" . }} 39 | {{- if .Chart.AppVersion }} 40 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} 41 | {{- end }} 42 | app.kubernetes.io/managed-by: {{ .Release.Service }} 43 | {{- end }} 44 | 45 | {{/* 46 | Selector labels 47 | */}} 48 | {{- define "gtm-cloud-helm.selectorLabels" -}} 49 | app.kubernetes.io/name: {{ include "gtm-cloud-helm.name" . }} 50 | app.kubernetes.io/instance: {{ .Release.Name }} 51 | {{- end }} 52 | 53 | {{/* 54 | Create the name of the service account to use 55 | */}} 56 | {{- define "gtm-cloud-helm.serviceAccountName" -}} 57 | {{- if .Values.serviceAccount.create }} 58 | {{- default (include "gtm-cloud-helm.fullname" .) .Values.serviceAccount.name }} 59 | {{- else }} 60 | {{- default "default" .Values.serviceAccount.name }} 61 | {{- end }} 62 | {{- end }} 63 | -------------------------------------------------------------------------------- /templates/hpa.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.sst.autoscaling.enabled }} 2 | apiVersion: autoscaling/v2beta1 3 | kind: HorizontalPodAutoscaler 4 | metadata: 5 | name: {{ include "gtm-cloud-helm.fullname" . }}-sst 6 | labels: 7 | {{- include "gtm-cloud-helm.labels" . | nindent 4 }} 8 | spec: 9 | scaleTargetRef: 10 | apiVersion: apps/v1 11 | kind: Deployment 12 | name: {{ include "gtm-cloud-helm.fullname" . }} 13 | minReplicas: {{ .Values.sst.autoscaling.minReplicas }} 14 | maxReplicas: {{ .Values.sst.autoscaling.maxReplicas }} 15 | metrics: 16 | {{- if .Values.sst.autoscaling.targetCPUUtilizationPercentage }} 17 | - type: Resource 18 | resource: 19 | name: cpu 20 | targetAverageUtilization: {{ .Values.sst.autoscaling.targetCPUUtilizationPercentage }} 21 | {{- end }} 22 | {{- if .Values.sst.autoscaling.targetMemoryUtilizationPercentage }} 23 | - type: Resource 24 | resource: 25 | name: memory 26 | targetAverageUtilization: {{ .Values.sst.autoscaling.targetMemoryUtilizationPercentage }} 27 | {{- end }} 28 | {{- end }} 29 | --- 30 | {{- if .Values.preview.autoscaling.enabled }} 31 | apiVersion: autoscaling/v2beta1 32 | kind: HorizontalPodAutoscaler 33 | metadata: 34 | name: {{ include "gtm-cloud-helm.fullname" . }}-preview 35 | labels: 36 | {{- include "gtm-cloud-helm.labels" . | nindent 4 }} 37 | spec: 38 | scaleTargetRef: 39 | apiVersion: apps/v1 40 | kind: Deployment 41 | name: {{ include "gtm-cloud-helm.fullname" . }} 42 | minReplicas: {{ .Values.preview.autoscaling.minReplicas }} 43 | maxReplicas: {{ .Values.preview.autoscaling.maxReplicas }} 44 | metrics: 45 | {{- if .Values.preview.autoscaling.targetCPUUtilizationPercentage }} 46 | - type: Resource 47 | resource: 48 | name: cpu 49 | targetAverageUtilization: {{ .Values.preview.autoscaling.targetCPUUtilizationPercentage }} 50 | {{- end }} 51 | {{- if .Values.preview.autoscaling.targetMemoryUtilizationPercentage }} 52 | - type: Resource 53 | resource: 54 | name: memory 55 | targetAverageUtilization: {{ .Values.preview.autoscaling.targetMemoryUtilizationPercentage }} 56 | {{- end }} 57 | {{- end }} 58 | -------------------------------------------------------------------------------- /values.yaml: -------------------------------------------------------------------------------- 1 | # Default values for gtm-cloud-helm. 2 | # This is a YAML-formatted file. 3 | # Declare variables to be passed into your templates. 4 | 5 | image: 6 | repository: gcr.io/cloud-tagging-10302018/gtm-cloud-image 7 | pullPolicy: IfNotPresent 8 | # Overrides the image tag whose default is the chart appVersion. 9 | tag: "" 10 | 11 | imagePullSecrets: [] 12 | nameOverride: "" 13 | fullnameOverride: "" 14 | 15 | serviceAccount: 16 | # Specifies whether a service account should be created 17 | create: true 18 | # Annotations to add to the service account 19 | annotations: {} 20 | # The name of the service account to use. 21 | # If not set and create is true, a name is generated using the fullname template 22 | name: "" 23 | 24 | podSecurityContext: {} 25 | # fsGroup: 2000 26 | 27 | securityContext: {} 28 | # capabilities: 29 | # drop: 30 | # - ALL 31 | # readOnlyRootFilesystem: true 32 | # runAsNonRoot: true 33 | # runAsUser: 1000 34 | 35 | config: 36 | # The container config string from GTM 37 | container: "" 38 | 39 | preview: 40 | # Configuration of the GTM Preview Server 41 | replicaCount: 1 42 | service: 43 | type: ClusterIP 44 | port: 8080 45 | autoscaling: 46 | enabled: false 47 | minReplicas: 1 48 | maxReplicas: 100 49 | targetCPUUtilizationPercentage: 80 50 | podAnnotations: {} 51 | resources: {} 52 | nodeSelector: {} 53 | tolerations: [] 54 | affinity: {} 55 | ingress: 56 | enabled: false 57 | className: "" 58 | annotations: {} 59 | # kubernetes.io/ingress.class: nginx 60 | # kubernetes.io/tls-acme: "true" 61 | hosts: 62 | - host: chart-example.local 63 | paths: 64 | - path: / 65 | pathType: ImplementationSpecific 66 | tls: [] 67 | # - secretName: chart-example-tls 68 | # hosts: 69 | # - chart-example.local 70 | 71 | 72 | sst: 73 | # Configuration of the GTM Server-side tagging cluster 74 | replicaCount: 1 75 | service: 76 | type: ClusterIP 77 | port: 8080 78 | preview: 79 | url: "" 80 | autoscaling: 81 | enabled: false 82 | minReplicas: 1 83 | maxReplicas: 100 84 | targetCPUUtilizationPercentage: 80 85 | podAnnotations: {} 86 | resources: {} 87 | nodeSelector: {} 88 | tolerations: [] 89 | affinity: {} 90 | ingress: 91 | enabled: false 92 | className: "" 93 | annotations: {} 94 | # kubernetes.io/ingress.class: nginx 95 | # kubernetes.io/tls-acme: "true" 96 | hosts: 97 | - host: chart-example.local 98 | paths: 99 | - path: / 100 | pathType: ImplementationSpecific 101 | tls: [] 102 | # - secretName: chart-example-tls 103 | # hosts: 104 | # - chart-example.local -------------------------------------------------------------------------------- /templates/ingress.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.sst.ingress.enabled -}} 2 | {{- $fullName := include "gtm-cloud-helm.fullname" . -}} 3 | {{- $svcPort := .Values.sst.service.port -}} 4 | {{- if and .Values.sst.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} 5 | {{- if not (hasKey .Values.sst.ingress.annotations "kubernetes.io/ingress.class") }} 6 | {{- $_ := set .Values.sst.ingress.annotations "kubernetes.io/ingress.class" .Values.sst.ingress.className}} 7 | {{- end }} 8 | {{- end }} 9 | {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} 10 | apiVersion: networking.k8s.io/v1 11 | {{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} 12 | apiVersion: networking.k8s.io/v1beta1 13 | {{- else -}} 14 | apiVersion: extensions/v1beta1 15 | {{- end }} 16 | kind: Ingress 17 | metadata: 18 | name: {{ $fullName }}-sst 19 | labels: 20 | {{- include "gtm-cloud-helm.labels" . | nindent 4 }} 21 | {{- with .Values.sst.ingress.annotations }} 22 | annotations: 23 | {{- toYaml . | nindent 4 }} 24 | {{- end }} 25 | spec: 26 | {{- if and .Values.sst.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} 27 | ingressClassName: {{ .Values.sst.ingress.className }} 28 | {{- end }} 29 | {{- if .Values.sst.ingress.tls }} 30 | tls: 31 | {{- range .Values.sst.ingress.tls }} 32 | - hosts: 33 | {{- range .hosts }} 34 | - {{ . | quote }} 35 | {{- end }} 36 | secretName: {{ .secretName }} 37 | {{- end }} 38 | {{- end }} 39 | rules: 40 | {{- range .Values.sst.ingress.hosts }} 41 | - host: {{ .host | quote }} 42 | http: 43 | paths: 44 | {{- range .paths }} 45 | - path: {{ .path }} 46 | {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} 47 | pathType: {{ .pathType }} 48 | {{- end }} 49 | backend: 50 | {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} 51 | service: 52 | name: {{ $fullName }}-sst 53 | port: 54 | number: {{ $svcPort }} 55 | {{- else }} 56 | serviceName: {{ $fullName }}-sst 57 | servicePort: {{ $svcPort }} 58 | {{- end }} 59 | {{- end }} 60 | {{- end }} 61 | {{- end }} 62 | --- 63 | {{- if .Values.preview.ingress.enabled -}} 64 | {{- $fullName := include "gtm-cloud-helm.fullname" . -}} 65 | {{- $svcPort := .Values.preview.service.port -}} 66 | {{- if and .Values.preview.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} 67 | {{- if not (hasKey .Values.preview.ingress.annotations "kubernetes.io/ingress.class") }} 68 | {{- $_ := set .Values.preview.ingress.annotations "kubernetes.io/ingress.class" .Values.preview.ingress.className}} 69 | {{- end }} 70 | {{- end }} 71 | {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} 72 | apiVersion: networking.k8s.io/v1 73 | {{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} 74 | apiVersion: networking.k8s.io/v1beta1 75 | {{- else -}} 76 | apiVersion: extensions/v1beta1 77 | {{- end }} 78 | kind: Ingress 79 | metadata: 80 | name: {{ $fullName }}-preview 81 | labels: 82 | {{- include "gtm-cloud-helm.labels" . | nindent 4 }} 83 | {{- with .Values.preview.ingress.annotations }} 84 | annotations: 85 | {{- toYaml . | nindent 4 }} 86 | {{- end }} 87 | spec: 88 | {{- if and .Values.preview.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} 89 | ingressClassName: {{ .Values.preview.ingress.className }} 90 | {{- end }} 91 | {{- if .Values.preview.ingress.tls }} 92 | tls: 93 | {{- range .Values.preview.ingress.tls }} 94 | - hosts: 95 | {{- range .hosts }} 96 | - {{ . | quote }} 97 | {{- end }} 98 | secretName: {{ .secretName }} 99 | {{- end }} 100 | {{- end }} 101 | rules: 102 | {{- range .Values.preview.ingress.hosts }} 103 | - host: {{ .host | quote }} 104 | http: 105 | paths: 106 | {{- range .paths }} 107 | - path: {{ .path }} 108 | {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} 109 | pathType: {{ .pathType }} 110 | {{- end }} 111 | backend: 112 | {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} 113 | service: 114 | name: {{ $fullName }}-preview 115 | port: 116 | number: {{ $svcPort }} 117 | {{- else }} 118 | serviceName: {{ $fullName }}-preview 119 | servicePort: {{ $svcPort }} 120 | {{- end }} 121 | {{- end }} 122 | {{- end }} 123 | {{- end }} -------------------------------------------------------------------------------- /templates/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: {{ include "gtm-cloud-helm.fullname" . }}-sst 5 | labels: 6 | {{- include "gtm-cloud-helm.labels" . | nindent 4 }} 7 | spec: 8 | {{- if not .Values.sst.autoscaling.enabled }} 9 | replicas: {{ .Values.sst.replicaCount }} 10 | {{- end }} 11 | selector: 12 | matchLabels: 13 | {{- include "gtm-cloud-helm.selectorLabels" . | nindent 6 }} 14 | template: 15 | metadata: 16 | {{- with .Values.sst.podAnnotations }} 17 | annotations: 18 | {{- toYaml . | nindent 8 }} 19 | {{- end }} 20 | labels: 21 | {{- include "gtm-cloud-helm.selectorLabels" . | nindent 8 }} 22 | spec: 23 | {{- with .Values.imagePullSecrets }} 24 | imagePullSecrets: 25 | {{- toYaml . | nindent 8 }} 26 | {{- end }} 27 | serviceAccountName: {{ include "gtm-cloud-helm.serviceAccountName" . }} 28 | securityContext: 29 | {{- toYaml .Values.podSecurityContext | nindent 8 }} 30 | containers: 31 | - name: {{ .Chart.Name }} 32 | securityContext: 33 | {{- toYaml .Values.securityContext | nindent 12 }} 34 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" 35 | imagePullPolicy: {{ .Values.image.pullPolicy }} 36 | env: 37 | - name: CONTAINER_CONFIG 38 | value: {{ .Values.config.container | quote }} 39 | - name: RUN_AS_PREVIEW_SERVER 40 | value: "false" 41 | - name: PREVIEW_SERVER_URL 42 | value: {{ .Values.sst.preview.url | quote }} 43 | - name: PORT 44 | value: {{ toString .Values.sst.service.port | quote }} 45 | ports: 46 | - name: http 47 | containerPort: {{ .Values.sst.service.port }} 48 | protocol: TCP 49 | livenessProbe: 50 | httpGet: 51 | path: /healthz 52 | port: http 53 | readinessProbe: 54 | httpGet: 55 | path: /healthz 56 | port: http 57 | resources: 58 | {{- toYaml .Values.sst.resources | nindent 12 }} 59 | {{- with .Values.sst.nodeSelector }} 60 | nodeSelector: 61 | {{- toYaml . | nindent 8 }} 62 | {{- end }} 63 | {{- with .Values.sst.affinity }} 64 | affinity: 65 | {{- toYaml . | nindent 8 }} 66 | {{- end }} 67 | {{- with .Values.sst.tolerations }} 68 | tolerations: 69 | {{- toYaml . | nindent 8 }} 70 | {{- end }} 71 | --- 72 | apiVersion: apps/v1 73 | kind: Deployment 74 | metadata: 75 | name: {{ include "gtm-cloud-helm.fullname" . }}-preview 76 | labels: 77 | {{- include "gtm-cloud-helm.labels" . | nindent 4 }} 78 | spec: 79 | {{- if not .Values.preview.autoscaling.enabled }} 80 | replicas: {{ .Values.preview.replicaCount }} 81 | {{- end }} 82 | selector: 83 | matchLabels: 84 | {{- include "gtm-cloud-helm.selectorLabels" . | nindent 6 }} 85 | template: 86 | metadata: 87 | {{- with .Values.preview.podAnnotations }} 88 | annotations: 89 | {{- toYaml . | nindent 8 }} 90 | {{- end }} 91 | labels: 92 | {{- include "gtm-cloud-helm.selectorLabels" . | nindent 8 }} 93 | spec: 94 | {{- with .Values.imagePullSecrets }} 95 | imagePullSecrets: 96 | {{- toYaml . | nindent 8 }} 97 | {{- end }} 98 | serviceAccountName: {{ include "gtm-cloud-helm.serviceAccountName" . }} 99 | securityContext: 100 | {{- toYaml .Values.podSecurityContext | nindent 8 }} 101 | containers: 102 | - name: {{ .Chart.Name }} 103 | securityContext: 104 | {{- toYaml .Values.securityContext | nindent 12 }} 105 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" 106 | imagePullPolicy: {{ .Values.image.pullPolicy }} 107 | env: 108 | - name: CONTAINER_CONFIG 109 | value: {{ .Values.config.container | quote }} 110 | - name: RUN_AS_PREVIEW_SERVER 111 | value: "true" 112 | - name: PORT 113 | value: {{ toString .Values.preview.service.port | quote }} 114 | ports: 115 | - name: http 116 | containerPort: {{ .Values.preview.service.port }} 117 | protocol: TCP 118 | livenessProbe: 119 | httpGet: 120 | path: /healthz 121 | port: http 122 | readinessProbe: 123 | httpGet: 124 | path: /healthz 125 | port: http 126 | resources: 127 | {{- toYaml .Values.preview.resources | nindent 12 }} 128 | {{- with .Values.preview.nodeSelector }} 129 | nodeSelector: 130 | {{- toYaml . | nindent 8 }} 131 | {{- end }} 132 | {{- with .Values.preview.affinity }} 133 | affinity: 134 | {{- toYaml . | nindent 8 }} 135 | {{- end }} 136 | {{- with .Values.preview.tolerations }} 137 | tolerations: 138 | {{- toYaml . | nindent 8 }} 139 | {{- end }} 140 | --------------------------------------------------------------------------------