diff --git a/src/deployments/jaeger/health-svc-template.yaml b/src/deployments/jaeger/health-svc-template.yaml deleted file mode 100644 index 0124647f..00000000 --- a/src/deployments/jaeger/health-svc-template.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: replace_release_name-health - namespace: replace_namespace -spec: - ports: - - name: http - port: 14269 - protocol: TCP - targetPort: 14269 - selector: - app: jaeger - app.kubernetes.io/component: all-in-one - app.kubernetes.io/instance: replace_release_name - app.kubernetes.io/name: replace_release_name - app.kubernetes.io/part-of: jaeger - type: ClusterIP diff --git a/src/deployments/jaeger/ingress.sh b/src/deployments/jaeger/ingress.sh deleted file mode 100644 index 8d6b22da..00000000 --- a/src/deployments/jaeger/ingress.sh +++ /dev/null @@ -1,4 +0,0 @@ -JAEGER_INGRESS_ENABLED=false; -if [[ $INGRESS == "$expose" ]]; then - JAEGER_INGRESS_ENABLED=true; -fi diff --git a/src/deployments/jaeger/jaeger-svc-template.yaml b/src/deployments/jaeger/jaeger-svc-template.yaml new file mode 100644 index 00000000..f06e499d --- /dev/null +++ b/src/deployments/jaeger/jaeger-svc-template.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: tyk-jaeger + namespace: replace_namespace +spec: + type: ClusterIP + selector: + app.kubernetes.io/instance: tyk-tempo + app.kubernetes.io/name: tempo + ports: + - name: tempo-query-jaeger-ui + port: 16686 + protocol: TCP + targetPort: 16686 diff --git a/src/deployments/jaeger/jaeger.yaml b/src/deployments/jaeger/jaeger.yaml deleted file mode 100644 index 2d721d30..00000000 --- a/src/deployments/jaeger/jaeger.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: jaegertracing.io/v1 -kind: Jaeger -metadata: - name: tyk-jaeger -spec: - query: - serviceType: replace_service_type - containerSecurityContext: - runAsNonRoot: true - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - seccompProfile: - type: RuntimeDefault - ingress: - enabled: replace_enabled_ingress - ingressClassName: replace_ingress_className - security: "none" diff --git a/src/deployments/jaeger/load-balancer.sh b/src/deployments/jaeger/load-balancer.sh deleted file mode 100644 index dabaa6ab..00000000 --- a/src/deployments/jaeger/load-balancer.sh +++ /dev/null @@ -1,4 +0,0 @@ -JAEGER_SERVICE_TYPE=NodePort; -if [[ $LOADBALANCER == "$expose" ]]; then - JAEGER_SERVICE_TYPE=LoadBalancer; -fi diff --git a/src/deployments/jaeger/main.safe.sh b/src/deployments/jaeger/main.safe.sh index 7dddbbbc..2b55c4a4 100644 --- a/src/deployments/jaeger/main.safe.sh +++ b/src/deployments/jaeger/main.safe.sh @@ -4,8 +4,6 @@ if [ -z "$jaegerRegistered" ]; then jaegerReleaseName="tyk-jaeger"; jaegerDeploymentPath="src/deployments/jaeger"; - source "src/deployments/cert-manager/main.safe.sh"; - source "$jaegerDeploymentPath/load-balancer.sh"; - source "$jaegerDeploymentPath/ingress.sh"; + source "src/deployments/tempo/main.safe.sh"; source "$jaegerDeploymentPath/main.sh"; fi diff --git a/src/deployments/jaeger/main.sh b/src/deployments/jaeger/main.sh index a7da49ff..99a328f0 100644 --- a/src/deployments/jaeger/main.sh +++ b/src/deployments/jaeger/main.sh @@ -1,50 +1,8 @@ logger "$INFO" "installing $jaegerReleaseName in $namespace namespace..."; setVerbose; -helm upgrade "$jaegerReleaseName" jaegertracing/jaeger-operator --version v2.46.2 \ - --install \ - --namespace "$namespace" \ - "${helmFlags[@]}" > /dev/null; - -sed "s/replace_service_type/$JAEGER_SERVICE_TYPE/g" "$jaegerDeploymentPath/jaeger.yaml" | \ - sed "s/replace_enabled_ingress/$JAEGER_INGRESS_ENABLED/g" | \ - sed "s/replace_ingress_className/$INGRESS_CLASSNAME/g" | \ +sed "s/replace_namespace/$namespace/g" "$jaegerDeploymentPath/jaeger-svc-template.yaml" | \ kubectl apply --namespace "$namespace" -f - > /dev/null; - -helm upgrade tyk-otel-collector open-telemetry/opentelemetry-collector --version 0.99.0 \ - --install \ - --set "mode=deployment" \ - --set "image.repository=otel/opentelemetry-collector-k8s" \ - --set "config.receivers.otlp.protocols.http.endpoint=0.0.0.0:4318" \ - --set "config.receivers.otlp.protocols.grpc.endpoint=0.0.0.0:4317" \ - --set "config.exporters.otlphttp.endpoint=$jaegerReleaseName-collector.$namespace.svc:14250" \ - --set "config.exporters.otlphttp.tls.insecure=true" \ - --set "config.extensions.pprof.endpoint=\:1888" \ - --set "config.extensions.zpages.endpoint=\:55679" \ - --set "config.service.extensions[0]=pprof" \ - --set "config.service.extensions[1]=zpages" \ - --set "config.service.extensions[2]=health_check" \ - --set "config.service.pipelines.traces.receivers[0]=otlp" \ - --set "config.service.pipelines.traces.processors[0]=batch" \ - --set "config.service.pipelines.traces.exporters[0]=otlphttp" \ - --namespace "$namespace" \ - "${helmFlags[@]}" > /dev/null; unsetVerbose; -args=(--set-string "tyk-gateway.gateway.extraEnvs[$gatewayExtraEnvsCtr].name=TYK_GW_OPENTELEMETRY_ENABLED" \ - --set-string "tyk-gateway.gateway.extraEnvs[$gatewayExtraEnvsCtr].value=true" \ - --set-string "tyk-gateway.gateway.extraEnvs[$(($gatewayExtraEnvsCtr + 1))].name=TYK_GW_OPENTELEMETRY_EXPORTER" \ - --set-string "tyk-gateway.gateway.extraEnvs[$(($gatewayExtraEnvsCtr + 1))].value=grpc" \ - --set-string "tyk-gateway.gateway.extraEnvs[$(($gatewayExtraEnvsCtr + 2))].name=TYK_GW_OPENTELEMETRY_ENDPOINT" \ - --set-string "tyk-gateway.gateway.extraEnvs[$(($gatewayExtraEnvsCtr + 2))].value=tyk-otel-collector-opentelemetry-collector:4317"); - -gatewayExtraEnvsCtr=$((gatewayExtraEnvsCtr + 3)); - -addDeploymentArgs "${args[@]}"; - -sed "s/replace_release_name/$jaegerReleaseName/g" "$jaegerDeploymentPath/health-svc-template.yaml" | \ - sed "s/replace_namespace/$namespace/g" | \ - kubectl apply --namespace "$namespace" -f - > /dev/null; - -addService "$jaegerReleaseName-query"; -addService "$jaegerReleaseName-health"; +addService "tyk-jaeger"; diff --git a/src/deployments/opentelemetry/README.md b/src/deployments/opentelemetry/README.md new file mode 100644 index 00000000..a0b1a04a --- /dev/null +++ b/src/deployments/opentelemetry/README.md @@ -0,0 +1,33 @@ +## OpenTelemetry +Deploys the OpenTelemetry collector using the +`open-telemetryopentelemetry-collector` chart version `0.108.1` and configures +the Tyk deployment to send telemetry data to Grafana Tempo through the OpenTelemetry +collector. + +### Example +``` +./up.sh --deployments opentelemetry tyk-stack +``` + +### Support +| Item | Status | +|:------------:|:------------------:| +| OpenShift | :white_check_mark: | +| ARM | :white_check_mark: | +| CI Tests | N/A | +| Postman Test | N/A | +| SSL | N/A | + +### Supported Service Types with `--expose` flag +| Item | Status | +|:-------------:|:------:| +| Port Forward | N/A | +| Ingress | N/A | +| Load Balancer | N/A | + +| Icon | Description | +|:------------------:|:-------------------------:| +| :white_check_mark: | Supported and tested | +| :warning: | Not tested | +| :x: | Not supported | +| :no_entry: | Not supported by the tool | diff --git a/src/deployments/opentelemetry/main.safe.sh b/src/deployments/opentelemetry/main.safe.sh new file mode 100644 index 00000000..cf965ea7 --- /dev/null +++ b/src/deployments/opentelemetry/main.safe.sh @@ -0,0 +1,9 @@ +if [ -z "$opentelemetryRegistered" ]; then + opentelemetryRegistered=true; + + opentelemetrReleaseName="tyk-opentelemetry"; + opentelemetryDeploymentPath="src/deployments/opentelemetry"; + + source "src/deployments/cert-manager/main.safe.sh"; + source "$opentelemetryDeploymentPath/main.sh"; +fi diff --git a/src/deployments/opentelemetry/main.sh b/src/deployments/opentelemetry/main.sh new file mode 100644 index 00000000..8f6529ce --- /dev/null +++ b/src/deployments/opentelemetry/main.sh @@ -0,0 +1,35 @@ +logger "$INFO" "installing $opentelemetrReleaseName in $namespace namespace..."; + +setVerbose; +helm upgrade tyk-otel-collector open-telemetry/opentelemetry-collector --version 0.108.1 \ + --install \ + --set "mode=deployment" \ + --set "image.repository=otel/opentelemetry-collector-contrib" \ + --set "config.receivers.otlp.protocols.http.endpoint=0.0.0.0:4318" \ + --set "config.receivers.otlp.protocols.grpc.endpoint=0.0.0.0:4317" \ + --set "config.processors.transform.error_mode=ignore" \ + --set "config.processors.transform.metric_statements[0].context=datapoint" \ + --set "config.processors.transform.metric_statements[0].statements[0]=replace_all_patterns(attributes\, \"value\"\, \"[^a-zA-Z0-9]\"\, \"_\")" \ + --set "config.exporters.otlp/tempo.endpoint=$tempoReleaseName.$namespace.svc:4317" \ + --set "config.exporters.otlp/tempo.tls.insecure=true" \ + --set "config.extensions.pprof.endpoint=\:1888" \ + --set "config.extensions.zpages.endpoint=\:55679" \ + --set "config.service.extensions[0]=pprof" \ + --set "config.service.extensions[1]=zpages" \ + --set "config.service.extensions[2]=health_check" \ + --set "config.service.pipelines.traces.receivers[0]=otlp" \ + --set "config.service.pipelines.traces.processors[0]=batch" \ + --set "config.service.pipelines.traces.exporters[0]=otlp/tempo" \ + --namespace "$namespace" \ + "${helmFlags[@]}" > /dev/null; +unsetVerbose; + +args=(--set-string "tyk-gateway.gateway.extraEnvs[$gatewayExtraEnvsCtr].name=TYK_GW_OPENTELEMETRY_ENABLED" \ + --set-string "tyk-gateway.gateway.extraEnvs[$gatewayExtraEnvsCtr].value=true" \ + --set-string "tyk-gateway.gateway.extraEnvs[$(($gatewayExtraEnvsCtr + 1))].name=TYK_GW_OPENTELEMETRY_EXPORTER" \ + --set-string "tyk-gateway.gateway.extraEnvs[$(($gatewayExtraEnvsCtr + 1))].value=grpc" \ + --set-string "tyk-gateway.gateway.extraEnvs[$(($gatewayExtraEnvsCtr + 2))].name=TYK_GW_OPENTELEMETRY_ENDPOINT" \ + --set-string "tyk-gateway.gateway.extraEnvs[$(($gatewayExtraEnvsCtr + 2))].value=tyk-otel-collector-opentelemetry-collector:4317"); + +gatewayExtraEnvsCtr=$((gatewayExtraEnvsCtr + 3)); +addDeploymentArgs "${args[@]}"; diff --git a/src/deployments/prometheus-grafana/main.sh b/src/deployments/prometheus-grafana/main.sh index bc10cb27..16c41451 100644 --- a/src/deployments/prometheus-grafana/main.sh +++ b/src/deployments/prometheus-grafana/main.sh @@ -14,6 +14,11 @@ helm upgrade "$grafanaReleaseName" grafana/grafana --version 8.3.6 \ --set "datasources.datasources\.yaml.datasources[0].url=http://$prometheusReleaseName-server:$PROMETHEUS_SERVICE_PORT" \ --set "datasources.datasources\.yaml.datasources[0].access=proxy" \ --set "datasources.datasources\.yaml.datasources[0].isDefault=true" \ + --set "datasources.datasources\.yaml.datasources[1].name=Tempo" \ + --set "datasources.datasources\.yaml.datasources[1].type=tempo" \ + --set "datasources.datasources\.yaml.datasources[1].url=http://$tempoReleaseName:3100" \ + --set "datasources.datasources\.yaml.datasources[1].access=proxy" \ + --set "datasources.datasources\.yaml.datasources[1].isDefault=false" \ --set "dashboardProviders.dashboardproviders\.yaml.apiVersion=1" \ --set "dashboardProviders.dashboardproviders\.yaml.providers[0].name=Tyk" \ --set "dashboardProviders.dashboardproviders\.yaml.providers[0].orgId=1" \ diff --git a/src/deployments/tempo/README.md b/src/deployments/tempo/README.md new file mode 100644 index 00000000..c74f8ac3 --- /dev/null +++ b/src/deployments/tempo/README.md @@ -0,0 +1,30 @@ +## Tempo +Deploys the Tempo using the `grafana/tempo` chart version `v1.10.3`. + +### Example +``` +./up.sh --deployments tempo tyk-stack +``` + +### Support +| Item | Status | +|:------------:|:------------------:| +| OpenShift | :white_check_mark: | +| ARM | :white_check_mark: | +| CI Tests | :white_check_mark: | +| Postman Test | :white_check_mark: | +| SSL | :no_entry: | + +### Supported Service Types with `--expose` flag +| Item | Status | +|:-------------:|:------------------:| +| Port Forward | :white_check_mark: | +| Ingress | :white_check_mark: | +| Load Balancer | :white_check_mark: | + +| Icon | Description | +|:------------------:|:-------------------------:| +| :white_check_mark: | Supported and tested | +| :warning: | Not tested | +| :x: | Not supported | +| :no_entry: | Not supported by the tool | diff --git a/src/deployments/tempo/main.safe.sh b/src/deployments/tempo/main.safe.sh new file mode 100644 index 00000000..15c03a83 --- /dev/null +++ b/src/deployments/tempo/main.safe.sh @@ -0,0 +1,10 @@ +if [ -z "$tempoRegistered" ]; then + tempoRegistered=true; + + tempoReleaseName="tyk-tempo"; + tempoDeploymentPath="src/deployments/tempo"; + + source "src/deployments/opentelemetry/main.safe.sh"; + source "src/deployments/prometheus-grafana/main.safe.sh"; + source "$tempoDeploymentPath/main.sh"; +fi diff --git a/src/deployments/tempo/main.sh b/src/deployments/tempo/main.sh new file mode 100644 index 00000000..98cf731d --- /dev/null +++ b/src/deployments/tempo/main.sh @@ -0,0 +1,9 @@ +logger "$INFO" "installing $tempoReleaseName in $namespace namespace..."; + +setVerbose; +helm upgrade "$tempoReleaseName" grafana/tempo --version v1.10.3 \ + --install \ + --namespace "$namespace" \ + --set "tempoQuery.enabled=true" \ + "${helmFlags[@]}" > /dev/null; +unsetVerbose; diff --git a/src/helpers/down/crds.sh b/src/helpers/down/crds.sh index 5d51d056..3a0a8c83 100644 --- a/src/helpers/down/crds.sh +++ b/src/helpers/down/crds.sh @@ -1,13 +1,13 @@ set +e; policies=$(kubectl get tykpolicies --namespace "$namespace" 2> /dev/null | awk '{print $1}' | tail -n +2 | tr '\n' ' '); apis=$(kubectl get tykapis --namespace "$namespace" 2> /dev/null | awk '{print $1}' | tail -n +2 | tr '\n' ' '); -oasapis=$(kubectl get tykoasapis --namespace "$namespace" 2> /dev/null | awk '{print $1}' | tail -n +2 | tr '\n' ' '); +oasapis=$(kubectl get tykoas --namespace "$namespace" 2> /dev/null | awk '{print $1}' | tail -n +2 | tr '\n' ' '); supergraphs=$(kubectl get supergraphs --namespace "$namespace" 2> /dev/null | awk '{print $1}' | tail -n +2 | tr '\n' ' '); subgraphs=$(kubectl get subgraphs --namespace "$namespace" 2> /dev/null | awk '{print $1}' | tail -n +2 | tr '\n' ' '); kubectl delete --namespace "$namespace" tykpolicies $policies &> /dev/null; kubectl delete --namespace "$namespace" tykapis $apis &> /dev/null; -kubectl delete --namespace "$namespace" tykoasapis $oasapis &> /dev/null; +kubectl delete --namespace "$namespace" tykoas $oasapis &> /dev/null; kubectl delete --namespace "$namespace" supergraphs $supergraphs &> /dev/null; kubectl delete --namespace "$namespace" subgraphs $subgraphs &> /dev/null; set -e;