diff --git a/cmd/csi/provisioner/cmd.go b/cmd/csi/provisioner/cmd.go index 1a6d5cd21a..6a203abe0a 100644 --- a/cmd/csi/provisioner/cmd.go +++ b/cmd/csi/provisioner/cmd.go @@ -1,6 +1,8 @@ package provisioner import ( + "os" + "github.com/Dynatrace/dynatrace-operator/pkg/api/scheme" dtcsi "github.com/Dynatrace/dynatrace-operator/pkg/controllers/csi" csiprovisioner "github.com/Dynatrace/dynatrace-operator/pkg/controllers/csi/provisioner" @@ -91,6 +93,7 @@ func createManager(config *rest.Config, namespace string) (manager.Manager, erro Metrics: server.Options{ BindAddress: metricsBindAddress, }, + PprofBindAddress: os.Getenv("PPROF_BIND_ADDRESS"), HealthProbeBindAddress: probeAddress, LivenessEndpointName: livenessEndpointName, } diff --git a/cmd/csi/server/cmd.go b/cmd/csi/server/cmd.go index 7d6027fd5c..967f596a4f 100644 --- a/cmd/csi/server/cmd.go +++ b/cmd/csi/server/cmd.go @@ -1,6 +1,8 @@ package server import ( + "os" + "github.com/Dynatrace/dynatrace-operator/pkg/api/scheme" dtcsi "github.com/Dynatrace/dynatrace-operator/pkg/controllers/csi" csidriver "github.com/Dynatrace/dynatrace-operator/pkg/controllers/csi/driver" @@ -87,7 +89,8 @@ func createManager(config *rest.Config, namespace string) (manager.Manager, erro Metrics: server.Options{ BindAddress: metricsBindAddress, }, - Scheme: scheme.Scheme, + PprofBindAddress: os.Getenv("PPROF_BIND_ADDRESS"), + Scheme: scheme.Scheme, } mgr, err := manager.New(config, options) diff --git a/cmd/operator/manager.go b/cmd/operator/manager.go index 81424a4596..34f1c36018 100644 --- a/cmd/operator/manager.go +++ b/cmd/operator/manager.go @@ -75,6 +75,7 @@ func createOptions(namespace string) ctrl.Options { Metrics: server.Options{ BindAddress: metricsBindAddress, }, + PprofBindAddress: os.Getenv("PPROF_BIND_ADDRESS"), LeaderElection: true, LeaderElectionID: leaderElectionID, LeaderElectionResourceLock: leaderElectionResourceLock, diff --git a/cmd/webhook/manager.go b/cmd/webhook/manager.go index b394ddc8b3..7511de5452 100644 --- a/cmd/webhook/manager.go +++ b/cmd/webhook/manager.go @@ -83,6 +83,7 @@ func createOptions(namespace string) ctrl.Options { Metrics: server.Options{ BindAddress: metricsBindAddress, }, + PprofBindAddress: os.Getenv("PPROF_BIND_ADDRESS"), } } diff --git a/config/helm/chart/default/templates/Common/csi/daemonset.yaml b/config/helm/chart/default/templates/Common/csi/daemonset.yaml index 2556493a16..cb7a1f36ac 100644 --- a/config/helm/chart/default/templates/Common/csi/daemonset.yaml +++ b/config/helm/chart/default/templates/Common/csi/daemonset.yaml @@ -116,6 +116,10 @@ spec: - name: LOG_LEVEL value: "debug" {{- end }} + {{- if .Values.enableProfiling }} + - name: PPROF_BIND_ADDRESS + value: ":6060" + {{- end }} {{- if and (not .Values.debug) .Values.csidriver.server.livenessProbe.enabled }} livenessProbe: failureThreshold: {{ .Values.csidriver.server.livenessProbe.failureThreshold }} @@ -182,6 +186,10 @@ spec: - name: LOG_LEVEL value: "debug" {{- end }} + {{- if .Values.enableProfiling }} + - name: PPROF_BIND_ADDRESS + value: ":6061" + {{- end }} {{- if .Values.csidriver.cleanupPeriod }} - name: CLEANUP_PERIOD value: "{{ .Values.csidriver.cleanupPeriod}}" diff --git a/config/helm/chart/default/templates/Common/operator/deployment-operator.yaml b/config/helm/chart/default/templates/Common/operator/deployment-operator.yaml index 84305a6d8e..72aaa7d537 100644 --- a/config/helm/chart/default/templates/Common/operator/deployment-operator.yaml +++ b/config/helm/chart/default/templates/Common/operator/deployment-operator.yaml @@ -75,6 +75,10 @@ spec: - name: LOG_LEVEL value: "debug" {{- end }} + {{- if .Values.enableProfiling }} + - name: PPROF_BIND_ADDRESS + value: ":6060" + {{- end }} {{ include "dynatrace-operator.modules-json-env" . | nindent 12}} {{ include "dynatrace-operator.gomemlimit" .Values.operator | nindent 12 }} ports: diff --git a/config/helm/chart/default/templates/Common/webhook/deployment-webhook.yaml b/config/helm/chart/default/templates/Common/webhook/deployment-webhook.yaml index 95f6f5db82..c4dd5f6933 100644 --- a/config/helm/chart/default/templates/Common/webhook/deployment-webhook.yaml +++ b/config/helm/chart/default/templates/Common/webhook/deployment-webhook.yaml @@ -100,6 +100,10 @@ spec: - name: LOG_LEVEL value: "debug" {{- end }} + {{- if .Values.enableProfiling }} + - name: PPROF_BIND_ADDRESS + value: ":6060" + {{- end }} {{ include "dynatrace-operator.modules-json-env" . | nindent 12 }} readinessProbe: httpGet: diff --git a/hack/make/deploy/deploy.mk b/hack/make/deploy/deploy.mk index 65e950f2de..9d8b492b47 100644 --- a/hack/make/deploy/deploy.mk +++ b/hack/make/deploy/deploy.mk @@ -1,5 +1,6 @@ ENABLE_CSI ?= true DEBUG_LOGS ?= true +PROFILING ?= true PLATFORM ?= "kubernetes" HELM_CHART ?= config/helm/chart/default @@ -22,6 +23,7 @@ deploy: manifests/crd/helm --set manifests=true \ --set image=$(IMAGE_URI) \ --set debugLogs=$(DEBUG_LOGS) \ + --set enableProfiling=$(PROFILING) \ --set debug=$(DEBUG) ## Undeploy the current operator installation