From a79e8a018a1ddd9bc906db60a3828983c2842672 Mon Sep 17 00:00:00 2001 From: Christian Roggia Date: Fri, 1 Jan 2021 13:44:12 +0100 Subject: [PATCH] feat(helm): add extra environment variables and datadog tracing to charts (#212) Closes #211 --- helm/charts/hydra/templates/deployment.yaml | 24 ++++++-- helm/charts/hydra/values.yaml | 55 ++++++++++++++----- helm/charts/kratos/templates/deployment.yaml | 24 ++++++++ helm/charts/kratos/values.yaml | 28 +++++++++- .../templates/deployment-controller.yaml | 19 +++++++ helm/charts/oathkeeper/values.yaml | 28 +++++++++- 6 files changed, 157 insertions(+), 21 deletions(-) diff --git a/helm/charts/hydra/templates/deployment.yaml b/helm/charts/hydra/templates/deployment.yaml index 7f622d618..9f4c403ed 100644 --- a/helm/charts/hydra/templates/deployment.yaml +++ b/helm/charts/hydra/templates/deployment.yaml @@ -56,8 +56,8 @@ spec: secretKeyRef: name: {{ include "hydra.secretname" . }} key: dsn - {{- if .Values.hydra.env }} - {{- toYaml .Values.hydra.env | nindent 12 }} + {{- with .Values.deployment.extraEnv }} + {{- toYaml . | nindent 12 }} {{- end }} {{- end}} volumes: @@ -118,6 +118,22 @@ spec: periodSeconds: 10 failureThreshold: 5 env: + {{- if .Values.deployment.tracing.datadog.enabled }} + - name: TRACING_PROVIDER + value: datadog + - name: DD_ENV + value: {{ .Values.deployment.tracing.datadog.env | default "none" | quote }} + - name: DD_VERSION + value: {{ .Values.deployment.tracing.datadog.version | default .Values.image.tag | quote }} + - name: DD_SERVICE + value: {{ .Values.deployment.tracing.datadog.service | default "ory/hydra" | quote }} + {{- if .Values.deployment.tracing.datadog.useHostIP }} + - name: DD_AGENT_HOST + valueFrom: + fieldRef: + fieldPath: status.hostIP + {{- end }} + {{- end }} {{- $issuer := include "hydra.config.urls.issuer" . -}} {{- if $issuer }} - name: URLS_SELF_ISSUER @@ -138,8 +154,8 @@ spec: secretKeyRef: name: {{ include "hydra.secretname" . }} key: secretsCookie - {{- if .Values.hydra.env }} - {{- toYaml .Values.hydra.env | nindent 12 }} + {{- with .Values.deployment.extraEnv }} + {{- toYaml . | nindent 12 }} {{- end }} resources: {{- toYaml .Values.deployment.resources | nindent 12 }} diff --git a/helm/charts/hydra/values.yaml b/helm/charts/hydra/values.yaml index 1ab324fef..3145c84b5 100644 --- a/helm/charts/hydra/values.yaml +++ b/helm/charts/hydra/values.yaml @@ -5,7 +5,7 @@ image: # ORY Hydra image repository: oryd/hydra # ORY Hydra version - tag: v1.4.6 + tag: v1.8.5 # Image pull policy pullPolicy: IfNotPresent @@ -108,20 +108,6 @@ hydra: urls: self: {} - # If you want to use Jaeger with agents being deployed in a daemonset, you can - # use the following ENV vars to configure the right endpoints using the IP - # address of the node the pod has been deployed to. - # - # env: - # - name: JAEGER_AGENT_HOST - # valueFrom: - # fieldRef: - # fieldPath: status.hostIP - # - name: TRACING_PROVIDERS_JAEGER_LOCAL_AGENT_ADDRESS - # value: $(JAEGER_AGENT_HOST):6831 - # - name: TRACING_PROVIDERS_JAEGER_SAMPLING_SERVER_URL - # value: http://$(JAEGER_AGENT_HOST):5778 - autoMigrate: false dangerousForceHttp: false dangerousAllowInsecureRedirectUrls: false @@ -155,6 +141,45 @@ deployment: # lines, adjust them as necessary, and remove the curly braces after 'nodeSelector:'. # foo: bar + # If you want to use Jaeger with agents being deployed in a daemonset, you can + # use the following ENV vars to configure the right endpoints using the IP + # address of the node the pod has been deployed to. + # + # extraEnv: + # - name: JAEGER_AGENT_HOST + # valueFrom: + # fieldRef: + # fieldPath: status.hostIP + # - name: TRACING_PROVIDERS_JAEGER_LOCAL_AGENT_ADDRESS + # value: $(JAEGER_AGENT_HOST):6831 + # - name: TRACING_PROVIDERS_JAEGER_SAMPLING_SERVER_URL + # value: http://$(JAEGER_AGENT_HOST):5778 + extraEnv: [] + + # Configuration for tracing providers. Only datadog is currently supported through this block. + # If you need to use a different tracing provider, please manually set the configuration values + # via "hydra.config" or via "deployment.extraEnv". + tracing: + datadog: + enabled: false + + # Sets the datadog DD_ENV environment variable. This value indicates the environment where hydra is running. + # Default value: "none". + # env: production + + # Sets the datadog DD_VERSION environment variable. This value indicates the version that hydra is running. + # Default value: .Values.image.tag (i.e. the tag used for the docker image). + # version: X.Y.Z + + # Sets the datadog DD_SERVICE environment variable. This value indicates the name of the service running. + # Default value: "ory/hydra". + # service: ory/hydra + + # Sets the datadog DD_AGENT_HOST environment variable. This value indicates the host address of the datadog agent. + # If set to true, this configuration will automatically set DD_AGENT_HOST to the field "status.hostIP" of the pod. + # Default value: false. + # useHostIP: true + # Configure node tolerations. tolerations: [] diff --git a/helm/charts/kratos/templates/deployment.yaml b/helm/charts/kratos/templates/deployment.yaml index f169cf1f1..b3374e1c9 100644 --- a/helm/charts/kratos/templates/deployment.yaml +++ b/helm/charts/kratos/templates/deployment.yaml @@ -50,6 +50,27 @@ spec: mountPath: /etc/config readOnly: true env: + {{- if .Values.deployment.tracing.datadog.enabled }} + - + name: TRACING_PROVIDER + value: datadog + - + name: DD_ENV + value: {{ .Values.deployment.tracing.datadog.env | default "none" | quote }} + - + name: DD_VERSION + value: {{ .Values.deployment.tracing.datadog.version | default .Values.image.tag | quote }} + - + name: DD_SERVICE + value: {{ .Values.deployment.tracing.datadog.service | default "ory/kratos" | quote }} + {{- if .Values.deployment.tracing.datadog.useHostIP }} + - + name: DD_AGENT_HOST + valueFrom: + fieldRef: + fieldPath: status.hostIP + {{- end }} + {{- end }} - name: DSN valueFrom: @@ -76,6 +97,9 @@ spec: name: {{ include "kratos.secretname" . }} key: smtpConnectionURI {{- end}} + {{- with .Values.deployment.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- if .Values.deployment.environmentSecretsName }} envFrom: - secretRef: diff --git a/helm/charts/kratos/values.yaml b/helm/charts/kratos/values.yaml index 6c929cdfb..f5b956bd9 100644 --- a/helm/charts/kratos/values.yaml +++ b/helm/charts/kratos/values.yaml @@ -6,7 +6,7 @@ replicaCount: 1 image: repository: oryd/kratos - tag: v0.5.2-alpha.1-sqlite + tag: v0.5.5-alpha.1-sqlite pullPolicy: IfNotPresent imagePullSecrets: [] @@ -116,6 +116,32 @@ deployment: # lines, adjust them as necessary, and remove the curly braces after 'annotations:'. # foo: bar + extraEnv: [] + + # Configuration for tracing providers. Only datadog is currently supported through this block. + # If you need to use a different tracing provider, please manually set the configuration values + # via "kratos.config" or via "deployment.extraEnv". + tracing: + datadog: + enabled: false + + # Sets the datadog DD_ENV environment variable. This value indicates the environment where kratos is running. + # Default value: "none". + # env: production + + # Sets the datadog DD_VERSION environment variable. This value indicates the version that kratos is running. + # Default value: .Values.image.tag (i.e. the tag used for the docker image). + # version: X.Y.Z + + # Sets the datadog DD_SERVICE environment variable. This value indicates the name of the service running. + # Default value: "ory/kratos". + # service: ory/kratos + + # Sets the datadog DD_AGENT_HOST environment variable. This value indicates the host address of the datadog agent. + # If set to true, this configuration will automatically set DD_AGENT_HOST to the field "status.hostIP" of the pod. + # Default value: false. + # useHostIP: true + # Configure node tolerations. tolerations: [] diff --git a/helm/charts/oathkeeper/templates/deployment-controller.yaml b/helm/charts/oathkeeper/templates/deployment-controller.yaml index b74d52ea0..00e30c58a 100644 --- a/helm/charts/oathkeeper/templates/deployment-controller.yaml +++ b/helm/charts/oathkeeper/templates/deployment-controller.yaml @@ -62,6 +62,25 @@ spec: - name: MUTATORS_ID_TOKEN_CONFIG_JWKS_URL value: "file:///etc/secrets/mutator.id_token.jwks.json" {{- end }} + {{- if .Values.deployment.tracing.datadog.enabled }} + - name: TRACING_PROVIDER + value: datadog + - name: DD_ENV + value: {{ .Values.deployment.tracing.datadog.env | default "none" | quote }} + - name: DD_VERSION + value: {{ .Values.deployment.tracing.datadog.version | default .Values.image.tag | quote }} + - name: DD_SERVICE + value: {{ .Values.deployment.tracing.datadog.service | default "ory/oathkeeper" | quote }} + {{- if .Values.deployment.tracing.datadog.useHostIP }} + - name: DD_AGENT_HOST + valueFrom: + fieldRef: + fieldPath: status.hostIP + {{- end }} + {{- end }} + {{- with .Values.deployment.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} volumeMounts: - name: {{ include "oathkeeper.name" . }}-config-volume mountPath: /etc/config diff --git a/helm/charts/oathkeeper/values.yaml b/helm/charts/oathkeeper/values.yaml index dfefce3d4..d752b2ceb 100644 --- a/helm/charts/oathkeeper/values.yaml +++ b/helm/charts/oathkeeper/values.yaml @@ -13,7 +13,7 @@ image: # ORY Oathkeeper image repository: oryd/oathkeeper # ORY Oathkeeper version - tag: v0.38.4-beta.1 + tag: v0.38.5 # Image pull policy pullPolicy: IfNotPresent @@ -135,6 +135,32 @@ deployment: # lines, adjust them as necessary, and remove the curly braces after 'annotations:'. # foo: bar + extraEnv: [] + + # Configuration for tracing providers. Only datadog is currently supported through this block. + # If you need to use a different tracing provider, please manually set the configuration values + # via "oathkeeper.config" or via "deployment.extraEnv". + tracing: + datadog: + enabled: false + + # Sets the datadog DD_ENV environment variable. This value indicates the environment where oathkeeper is running. + # Default value: "none". + # env: production + + # Sets the datadog DD_VERSION environment variable. This value indicates the version that oathkeeper is running. + # Default value: .Values.image.tag (i.e. the tag used for the docker image). + # version: X.Y.Z + + # Sets the datadog DD_SERVICE environment variable. This value indicates the name of the service running. + # Default value: "ory/oathkeeper". + # service: ory/oathkeeper + + # Sets the datadog DD_AGENT_HOST environment variable. This value indicates the host address of the datadog agent. + # If set to true, this configuration will automatically set DD_AGENT_HOST to the field "status.hostIP" of the pod. + # Default value: false. + # useHostIP: true + # Configure node tolerations. tolerations: []