diff --git a/deploy/k8s/helm/app.yaml b/deploy/k8s/helm/app.yaml index acea31ef1..5b4117fa0 100644 --- a/deploy/k8s/helm/app.yaml +++ b/deploy/k8s/helm/app.yaml @@ -19,6 +19,7 @@ app: # app global settings payment: payment-api # ingress entry for payment api webhooks: webhooks-api # ingress entry for webhooks api webhooksweb: webhooks-web # ingress entry for webhooks web demo client + zipkin: zipkin # ingress entry for the Zipkin tracing tool. svc: basket: basket-api # service name for basket api catalog: catalog-api # service name for catalog api @@ -36,3 +37,4 @@ app: # app global settings payment: payment-api # service name for payment api webhooks: webhooks-api # service name for webhooks api webhooksweb: webhooks-client # service name for webhooks web + zipkin: zipkin # service name for Zipkin diff --git a/deploy/k8s/helm/deploy-all.ps1 b/deploy/k8s/helm/deploy-all.ps1 index 213e60fb7..51222d923 100644 --- a/deploy/k8s/helm/deploy-all.ps1 +++ b/deploy/k8s/helm/deploy-all.ps1 @@ -12,6 +12,7 @@ Param( [parameter(Mandatory=$false)][string]$imageTag="latest", [parameter(Mandatory=$false)][bool]$useLocalk8s=$false, [parameter(Mandatory=$false)][bool]$useMesh=$false, + [parameter(Mandatory=$false)][bool]$enableTrace=$false, [parameter(Mandatory=$false)][string][ValidateSet('Always','IfNotPresent','Never', IgnoreCase=$false)]$imagePullPolicy="Always", [parameter(Mandatory=$false)][string][ValidateSet('prod','staging','none','custom', IgnoreCase=$false)]$sslSupport = "none", [parameter(Mandatory=$false)][string]$tlsSecretName = "eshop-tls-custom", @@ -119,6 +120,7 @@ if (-not [string]::IsNullOrEmpty($registry)) { Write-Host "Begin eShopOnContainers installation using Helm" -ForegroundColor Green $infras = ("sql-data", "nosql-data", "rabbitmq", "keystore-data", "basket-data") +$traceTools = ("zipkin") $charts = ("eshop-common", "basket-api","catalog-api", "identity-api", "mobileshoppingagg","ordering-api","ordering-backgroundtasks","ordering-signalrhub", "payment-api", "webmvc", "webshoppingagg", "webspa", "webstatus", "webhooks-api", "webhooks-web") $gateways = ("apigwms", "apigwws") @@ -132,6 +134,16 @@ else { Write-Host "eShopOnContainers infrastructure (bbdd, redis, ...) charts aren't installed (-deployCharts is false)" -ForegroundColor Yellow } +if ($enableTrace) { + Write-Host "Enabling traces : $traceTools" -ForegroundColor Green + #helm install "$appName-$traceTools" --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set "ingress.hosts={$dns}" $traceTools + Install-Chart $traceTools "-f app.yaml --values inf.yaml -f $ingressValuesFile -f $ingressMeshAnnotationsFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --set image.tag=latest --set image.pullPolicy=$imagePullPolicy --set inf.tls.enabled=$sslEnabled --set inf.mesh.enabled=$false --set inf.k8s.local=$useLocalk8s" $false + +} +else { + Write-Host "OpenTelemetry Trace is not enabled. Charts isn't installed (-enableTrace is false)" -ForegroundColor Yellow +} + if ($deployCharts) { foreach ($chart in $charts) { if ($chartsToDeploy -eq "*" -or $chartsToDeploy.Contains($chart)) { diff --git a/deploy/k8s/helm/webmvc/templates/configmap.yaml b/deploy/k8s/helm/webmvc/templates/configmap.yaml index 2062bdabc..fd9c48911 100644 --- a/deploy/k8s/helm/webmvc/templates/configmap.yaml +++ b/deploy/k8s/helm/webmvc/templates/configmap.yaml @@ -3,6 +3,7 @@ {{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}} {{- $mvc := include "url-of" (list .Values.app.ingress.entries.mvc .) -}} {{- $protocol := include "protocol" . -}} +{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}} apiVersion: v1 kind: ConfigMap @@ -22,3 +23,4 @@ data: urls__apigwws: {{ $protocol }}://{{ $webshoppingapigw }} urls__mvc: {{ $protocol }}://{{ $mvc }} urls__IdentityUrl: {{ $protocol }}://{{ $identity }} + urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans diff --git a/deploy/k8s/helm/webmvc/values.yaml b/deploy/k8s/helm/webmvc/values.yaml index 1f40dbb03..ef98b9ba1 100644 --- a/deploy/k8s/helm/webmvc/values.yaml +++ b/deploy/k8s/helm/webmvc/values.yaml @@ -46,6 +46,8 @@ env: key: internalurls__identity__hc - name: SignalrHubUrl key: urls__apigwws + - name: OTEL_EXPORTER_TOOL_ENDPOINT + key: urls__Otel__ExporterEndpoint # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) values: - name: ASPNETCORE_ENVIRONMENT @@ -54,4 +56,6 @@ env: value: 'K8S' - name: IsClusterEnv value: 'True' + - name: OTEL_USE_EXPORTER + value: 'zipkin' diff --git a/deploy/k8s/nginx-ingress/mandatory.yaml b/deploy/k8s/nginx-ingress/mandatory.yaml index 2e63edd59..8fd74f681 100644 --- a/deploy/k8s/nginx-ingress/mandatory.yaml +++ b/deploy/k8s/nginx-ingress/mandatory.yaml @@ -26,7 +26,7 @@ metadata: app.kubernetes.io/part-of: ingress-nginx --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: nginx-ingress-clusterrole @@ -82,7 +82,7 @@ rules: - update --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: nginx-ingress-role @@ -127,7 +127,7 @@ rules: - get --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: nginx-ingress-role-nisa-binding @@ -145,7 +145,7 @@ subjects: namespace: ingress-nginx --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: nginx-ingress-clusterrole-nisa-binding