From b749ff1d6c09cbff93156d9db77746754cae0cfb Mon Sep 17 00:00:00 2001 From: Komal Sukhani Date: Wed, 4 Oct 2023 14:33:46 +0530 Subject: [PATCH 1/3] Enable analytics only if analyticsEnabled or global.components.pump is set --- .../tyk-gateway/templates/deployment-gw-repset.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/tyk-gateway/templates/deployment-gw-repset.yaml b/components/tyk-gateway/templates/deployment-gw-repset.yaml index 1cdea685..86a2bd9f 100644 --- a/components/tyk-gateway/templates/deployment-gw-repset.yaml +++ b/components/tyk-gateway/templates/deployment-gw-repset.yaml @@ -153,8 +153,17 @@ spec: {{- else}} value: "file" {{- end}} + + # Set this environment variable only if either analyticsEnabled or global.components.pump is set + {{ if or .Values.gateway.analyticsEnabled ((.Values.global.components).pump)}} - name: TYK_GW_ENABLEANALYTICS - value: "{{.Values.gateway.analyticsEnabled}}" + {{- if .Values.gateway.analyticsEnabled }} + value: "{{ .Values.gateway.analyticsEnabled }}" + {{- else }} + value: "{{ .Values.global.components.pump }}" + {{- end}} + {{- end}} + - name: TYK_GW_ANALYTICSCONFIG_TYPE value: "{{.Values.gateway.analyticsConfigType}}" {{- if .Values.global.remoteControlPlane.enabled }} From 798eec005468205aa25ddac93b6667f6368bf600 Mon Sep 17 00:00:00 2001 From: Komal Sukhani Date: Wed, 4 Oct 2023 14:44:21 +0530 Subject: [PATCH 2/3] Set analyticsEnabled to empty string by default --- components/tyk-gateway/values.yaml | 5 +++-- tyk-mdcb-data-plane/values.yaml | 5 +++-- tyk-oss/values.yaml | 5 +++-- tyk-single-dc/values.yaml | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/components/tyk-gateway/values.yaml b/components/tyk-gateway/values.yaml index 4adbeb06..19b66078 100644 --- a/components/tyk-gateway/values.yaml +++ b/components/tyk-gateway/values.yaml @@ -273,8 +273,9 @@ gateway: ## readOnly: true extraVolumeMounts: [] - # analyticsEnabled property is used to enable or disable analytics. - analyticsEnabled: "false" + # analyticsEnabled property is used to enable/disable analytics. + # If set to empty or nil, analytics will be enabled/disabled based on `global.components.pump`. + analyticsEnabled: "" # used to decide whether to send the results back directly to Tyk without a hybrid pump # if you want to send analytics to control plane instead of pump, change analyticsConfigType to "rpc" diff --git a/tyk-mdcb-data-plane/values.yaml b/tyk-mdcb-data-plane/values.yaml index 524d7a66..6e55a2ed 100644 --- a/tyk-mdcb-data-plane/values.yaml +++ b/tyk-mdcb-data-plane/values.yaml @@ -269,8 +269,9 @@ tyk-gateway: enabled: false tags: "" - # analyticsEnabled property is used to enable or disable analytics. - analyticsEnabled: "true" + # analyticsEnabled property is used to enable/disable analytics. + # If set to empty or nil, analytics will be enabled/disabled based on `global.components.pump`. + analyticsEnabled: "" # used to decide whether to send the results back directly to Tyk without a hybrid pump # if you want to send analytics to control plane instead of pump, change value to "rpc" diff --git a/tyk-oss/values.yaml b/tyk-oss/values.yaml index 6d5b11fa..b2863d3f 100644 --- a/tyk-oss/values.yaml +++ b/tyk-oss/values.yaml @@ -230,8 +230,9 @@ tyk-gateway: # affinity for gateway pod assignment affinity: {} - # analyticsEnabled property is used to enable or disable analytics. - analyticsEnabled: "false" + # analyticsEnabled property is used to enable/disable analytics. + # If set to empty or nil, analytics will be enabled/disabled based on `global.components.pump`. + analyticsEnabled: "" # extraEnvs is used to set gateway env variables # - name: TYK_GW_HTTPSERVEROPTIONS_SSLINSECURESKIPVERIFY diff --git a/tyk-single-dc/values.yaml b/tyk-single-dc/values.yaml index 0f15d0b1..f33e31be 100644 --- a/tyk-single-dc/values.yaml +++ b/tyk-single-dc/values.yaml @@ -222,8 +222,9 @@ tyk-gateway: # replicaCount specifies number of replicas to be created if kind is Deployment. replicaCount: 1 - # analyticsEnabled property is used to enable or disable analytics. - analyticsEnabled: "true" + # analyticsEnabled property is used to enable/disable analytics. + # If set to empty or nil, analytics will be enabled/disabled based on `global.components.pump`. + analyticsEnabled: "" image: # image repository for Tyk Gateway From 6a2574415b799222393dc53fb513bce5264fbfb1 Mon Sep 17 00:00:00 2001 From: Komal Sukhani Date: Wed, 4 Oct 2023 16:58:45 +0530 Subject: [PATCH 3/3] Minor fix in indentation --- components/tyk-gateway/templates/deployment-gw-repset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/tyk-gateway/templates/deployment-gw-repset.yaml b/components/tyk-gateway/templates/deployment-gw-repset.yaml index 86a2bd9f..0d6fa497 100644 --- a/components/tyk-gateway/templates/deployment-gw-repset.yaml +++ b/components/tyk-gateway/templates/deployment-gw-repset.yaml @@ -155,7 +155,7 @@ spec: {{- end}} # Set this environment variable only if either analyticsEnabled or global.components.pump is set - {{ if or .Values.gateway.analyticsEnabled ((.Values.global.components).pump)}} + {{ if or .Values.gateway.analyticsEnabled ((.Values.global.components).pump) }} - name: TYK_GW_ENABLEANALYTICS {{- if .Values.gateway.analyticsEnabled }} value: "{{ .Values.gateway.analyticsEnabled }}"