diff --git a/LICENSE-THIRD-PARTY b/LICENSE-THIRD-PARTY index 4320bb7ea..9ace5b9e7 100644 --- a/LICENSE-THIRD-PARTY +++ b/LICENSE-THIRD-PARTY @@ -11,6 +11,7 @@ github.com/ghodss/yaml,v1.0.0,https://github.com/ghodss/yaml/blob/v1.0.0/LICENSE github.com/go-jose/go-jose/v4,v4.0.5,https://github.com/go-jose/go-jose/blob/v4.0.5/LICENSE,Apache-2.0 github.com/go-jose/go-jose/v4/json,v4.0.5,https://github.com/go-jose/go-jose/blob/v4.0.5/json/LICENSE,BSD-3-Clause github.com/go-logr/logr,v1.4.2,https://github.com/go-logr/logr/blob/v1.4.2/LICENSE,Apache-2.0 +github.com/go-logr/stdr,v1.2.2,https://github.com/go-logr/stdr/blob/v1.2.2/LICENSE,Apache-2.0 github.com/go-logr/zapr,v1.3.0,https://github.com/go-logr/zapr/blob/v1.3.0/LICENSE,Apache-2.0 github.com/go-openapi/jsonpointer,v0.19.6,https://github.com/go-openapi/jsonpointer/blob/v0.19.6/LICENSE,Apache-2.0 github.com/go-openapi/jsonreference,v0.20.2,https://github.com/go-openapi/jsonreference/blob/v0.20.2/LICENSE,Apache-2.0 @@ -23,6 +24,7 @@ github.com/google/go-cmp/cmp,v0.7.0,https://github.com/google/go-cmp/blob/v0.7.0 github.com/google/go-querystring/query,v1.1.0,https://github.com/google/go-querystring/blob/v1.1.0/LICENSE,BSD-3-Clause github.com/google/gofuzz,v1.2.0,https://github.com/google/gofuzz/blob/v1.2.0/LICENSE,Apache-2.0 github.com/google/uuid,v1.6.0,https://github.com/google/uuid/blob/v1.6.0/LICENSE,BSD-3-Clause +github.com/grpc-ecosystem/grpc-gateway/v2,v2.16.0,https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.16.0/LICENSE.txt,BSD-3-Clause github.com/hashicorp/errwrap,v1.1.0,https://github.com/hashicorp/errwrap/blob/v1.1.0/LICENSE,MPL-2.0 github.com/hashicorp/go-cleanhttp,v0.5.2,https://github.com/hashicorp/go-cleanhttp/blob/v0.5.2/LICENSE,MPL-2.0 github.com/hashicorp/go-multierror,v1.1.1,https://github.com/hashicorp/go-multierror/blob/v1.1.1/LICENSE,MPL-2.0 @@ -57,9 +59,20 @@ github.com/stretchr/testify/assert,v1.10.0,https://github.com/stretchr/testify/b github.com/vmihailenco/msgpack/v5,v5.3.5,https://github.com/vmihailenco/msgpack/blob/v5.3.5/LICENSE,BSD-2-Clause github.com/vmihailenco/tagparser/v2,v2.0.0,https://github.com/vmihailenco/tagparser/blob/v2.0.0/LICENSE,BSD-2-Clause github.com/xdg/stringprep,v1.0.3,https://github.com/xdg/stringprep/blob/v1.0.3/LICENSE,Apache-2.0 +go.opentelemetry.io/auto/sdk,v1.1.0,https://github.com/open-telemetry/opentelemetry-go-instrumentation/blob/sdk/v1.1.0/sdk/LICENSE,Apache-2.0 +go.opentelemetry.io/otel,v1.35.0,https://github.com/open-telemetry/opentelemetry-go/blob/v1.35.0/LICENSE,Apache-2.0 +go.opentelemetry.io/otel/exporters/otlp/otlptrace,v1.19.0,https://github.com/open-telemetry/opentelemetry-go/blob/exporters/otlp/otlptrace/v1.19.0/exporters/otlp/otlptrace/LICENSE,Apache-2.0 +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc,v1.19.0,https://github.com/open-telemetry/opentelemetry-go/blob/exporters/otlp/otlptrace/otlptracegrpc/v1.19.0/exporters/otlp/otlptrace/otlptracegrpc/LICENSE,Apache-2.0 +go.opentelemetry.io/otel/metric,v1.35.0,https://github.com/open-telemetry/opentelemetry-go/blob/metric/v1.35.0/metric/LICENSE,Apache-2.0 +go.opentelemetry.io/otel/sdk,v1.35.0,https://github.com/open-telemetry/opentelemetry-go/blob/sdk/v1.35.0/sdk/LICENSE,Apache-2.0 +go.opentelemetry.io/otel/trace,v1.35.0,https://github.com/open-telemetry/opentelemetry-go/blob/trace/v1.35.0/trace/LICENSE,Apache-2.0 +go.opentelemetry.io/proto/otlp,v1.0.0,https://github.com/open-telemetry/opentelemetry-proto-go/blob/otlp/v1.0.0/otlp/LICENSE,Apache-2.0 go.uber.org/multierr,v1.11.0,https://github.com/uber-go/multierr/blob/v1.11.0/LICENSE.txt,MIT go.uber.org/zap,v1.27.0,https://github.com/uber-go/zap/blob/v1.27.0/LICENSE,MIT gomodules.xyz/jsonpatch/v2,v2.4.0,https://github.com/gomodules/jsonpatch/blob/v2.4.0/v2/LICENSE,Apache-2.0 +google.golang.org/genproto/googleapis/api/httpbody,v0.0.0-20230726155614-23370e0ffb3e,https://github.com/googleapis/go-genproto/blob/23370e0ffb3e/googleapis/api/LICENSE,Apache-2.0 +google.golang.org/genproto/googleapis/rpc,v0.0.0-20230822172742-b8732ec3820d,https://github.com/googleapis/go-genproto/blob/b8732ec3820d/googleapis/rpc/LICENSE,Apache-2.0 +google.golang.org/grpc,v1.58.3,https://github.com/grpc/grpc-go/blob/v1.58.3/LICENSE,Apache-2.0 google.golang.org/protobuf,v1.36.5,https://github.com/protocolbuffers/protobuf-go/blob/v1.36.5/LICENSE,BSD-3-Clause gopkg.in/inf.v0,v0.9.1,https://github.com/go-inf/inf/blob/v0.9.1/LICENSE,BSD-3-Clause gopkg.in/natefinch/lumberjack.v2,v2.2.1,https://github.com/natefinch/lumberjack/blob/v2.2.1/LICENSE,MIT diff --git a/docker/mongodb-kubernetes-tests/tests/conftest.py b/docker/mongodb-kubernetes-tests/tests/conftest.py index d9a3da265..f39f18618 100644 --- a/docker/mongodb-kubernetes-tests/tests/conftest.py +++ b/docker/mongodb-kubernetes-tests/tests/conftest.py @@ -117,7 +117,7 @@ def get_operator_installation_config(namespace): config = KubernetesTester.read_configmap(namespace, "operator-installation-config") config["customEnvVars"] = f"OPS_MANAGER_MONITOR_APPDB={MONITOR_APPDB_E2E_DEFAULT}" if os.getenv("OM_DEBUG_HTTP") == "true": - print("Adding OM_DEBUG_HTTP=true to operator_installation_config") + logger.debug("Adding OM_DEBUG_HTTP=true to operator_installation_config") config["customEnvVars"] += "\&OM_DEBUG_HTTP=true" if local_operator(): @@ -1669,7 +1669,7 @@ def configure_telemetry(): tracer_provider.add_span_processor(prefix_processor) -# Remove the OpenTelemetryPlugin form the list and replace it with our custom generated one. +# Remove the OpenTelemetryPlugin from the list and replace it with our custom generated one. # That's why we run our pytest last. @pytest.hookimpl(trylast=True) def pytest_configure(config): diff --git a/go.mod b/go.mod index 45c8cf406..979689cd7 100644 --- a/go.mod +++ b/go.mod @@ -23,6 +23,10 @@ require ( github.com/yudai/gojsondiff v1.0.0 go.mongodb.org/atlas v0.38.0 go.mongodb.org/mongo-driver v1.17.3 + go.opentelemetry.io/otel v1.35.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 + go.opentelemetry.io/otel/sdk v1.35.0 + go.opentelemetry.io/otel/trace v1.35.0 go.uber.org/zap v1.27.0 golang.org/x/crypto v0.38.0 golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e @@ -51,6 +55,7 @@ require ( github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-jose/go-jose/v4 v4.0.5 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.3 // indirect @@ -62,6 +67,7 @@ require ( github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect @@ -97,6 +103,10 @@ require ( github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect github.com/yudai/pp v2.0.1+incompatible // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.35.0 // indirect + go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/mod v0.19.0 // indirect golang.org/x/net v0.39.0 // indirect @@ -108,6 +118,9 @@ require ( golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.23.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/grpc v1.58.3 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 10b49b50b..3b15fa463 100644 --- a/go.sum +++ b/go.sum @@ -33,8 +33,11 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3AaE= github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= @@ -50,6 +53,8 @@ github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -84,6 +89,8 @@ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -186,8 +193,8 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/r3labs/diff/v3 v3.0.1 h1:CBKqf3XmNRHXKmdU7mZP1w7TV0pDyVCis1AUHtA4Xtg= github.com/r3labs/diff/v3 v3.0.1/go.mod h1:f1S9bourRbiM66NskseyUdo0fTmEE0qKrikYJX63dgo= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= @@ -239,6 +246,22 @@ go.mongodb.org/atlas v0.38.0 h1:zfwymq20GqivGwxPZfypfUDry+WwMGVui97z1d8V4bU= go.mongodb.org/atlas v0.38.0/go.mod h1:DJYtM+vsEpPEMSkQzJnFHrT0sP7ev6cseZc/GGjJYG8= go.mongodb.org/mongo-driver v1.17.3 h1:TQyXhnsWfWtgAhMtOgtYHMTkZIfBTpMTsMnd9ZBeHxQ= go.mongodb.org/mongo-driver v1.17.3/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ= +go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 h1:3d+S281UTjM+AbF31XSOYn1qXn3BgIdWl8HNEpx08Jk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0/go.mod h1:0+KuTDyKL4gjKCF75pHOX4wuzYDUZYfAQdSu43o+Z2I= +go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M= +go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE= +go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= +go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= +go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs= +go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -321,6 +344,14 @@ golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSm golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= +google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e h1:z3vDksarJxsAKM5dmEGv0GHwE2hKJ096wZra71Vs4sw= +google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/helm_chart/templates/operator.yaml b/helm_chart/templates/operator.yaml index 8d523fbd1..39337a45c 100644 --- a/helm_chart/templates/operator.yaml +++ b/helm_chart/templates/operator.yaml @@ -80,6 +80,14 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + {{- if default false .Values.operator.opentelemetry.tracing.enabled }} + - name: OTEL_TRACE_ID + value: {{ .Values.operator.opentelemetry.tracing.traceID | quote }} + - name: OTEL_PARENT_ID + value: {{ .Values.operator.opentelemetry.tracing.parentID | quote }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ .Values.operator.opentelemetry.tracing.collectorEndpoint | quote }} + {{- end }} {{- if .Values.operator.vaultSecretBackend }} {{- if .Values.operator.vaultSecretBackend.enabled }} - name: SECRET_BACKEND diff --git a/helm_chart/values.yaml b/helm_chart/values.yaml index ea4f3a147..e5e4611d7 100644 --- a/helm_chart/values.yaml +++ b/helm_chart/values.yaml @@ -32,6 +32,15 @@ operator: - mongodbcommunity - mongodbsearch + # OpenTelemetry configuration for the operator to support tracing + opentelemetry: + tracing: + # Enable or disable sending tracing data to the OpenTelemetry collector + enabled: false + traceID: '' + parentID: '' + collectorEndpoint: '' + nodeSelector: {} tolerations: [] diff --git a/main.go b/main.go index 618ff645e..be280ee95 100644 --- a/main.go +++ b/main.go @@ -10,8 +10,11 @@ import ( "strconv" "strings" "sync" + "time" "github.com/go-logr/zapr" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" "go.uber.org/zap" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" @@ -23,6 +26,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/manager/signals" + sdktrace "go.opentelemetry.io/otel/sdk/trace" corev1 "k8s.io/api/core/v1" utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" @@ -108,7 +112,7 @@ func main() { crds = crdsToWatch{mongoDBCRDPlural, mongoDBUserCRDPlural, mongoDBOpsManagerCRDPlural, mongoDBCommunityCRDPlural, mongoDBSearchCRDPlural} } - ctx := context.Background() + signalCtx := signals.SetupSignalHandler() operator.OmUpdateChannel = make(chan event.GenericEvent) klog.InitFlags(nil) @@ -123,11 +127,39 @@ func main() { // Namespace where the operator is installed currentNamespace := env.ReadOrPanic(util.CurrentNamespace) + // Get trace and span IDs from environment variables + traceIDHex := os.Getenv("OTEL_TRACE_ID") + spanIDHex := os.Getenv("OTEL_PARENT_ID") + endpoint := os.Getenv("OTEL_EXPORTER_OTLP_ENDPOINT") + // Get a config to talk to the apiserver cfg := ctrl.GetConfigOrDie() + log.Debugf("Setting up tracing with ID: %s, Parent ID: %s, Endpoint: %s", traceIDHex, spanIDHex, endpoint) + traceCtxWithParentSpan, tp, err := telemetry.SetupTracingFromParent(signalCtx, traceIDHex, spanIDHex, endpoint) + if err != nil { + log.Warnf("Failed to setup opentelemetry tracing: %v", err) + // Continue without tracing instead of failing + traceCtxWithParentSpan = signalCtx + } else { + defer func() { + if tp != nil { + shutdownTracerProvider(signalCtx, tp) + } else { + log.Warn("No tracer provider created, opentelemetry tracing will be disabled") + } + }() + } + + ctxWithSpan, operatorSpan := startRootSpan(currentNamespace, spanIDHex, traceCtxWithParentSpan) + defer operatorSpan.End() + managerOptions := ctrl.Options{ Scheme: scheme, + BaseContext: func() context.Context { + // Ensures every controller gets the trace- and signal-aware context + return ctxWithSpan + }, } namespacesToWatch := operator.GetWatchedNamespace() @@ -153,7 +185,7 @@ func main() { managerOptions.HealthProbeBindAddress = "127.0.0.1:8181" } - webhookOptions := setupWebhook(ctx, cfg, log, slices.Contains(crds, mongoDBMultiClusterCRDPlural), currentNamespace) + webhookOptions := setupWebhook(ctxWithSpan, cfg, log, slices.Contains(crds, mongoDBMultiClusterCRDPlural), currentNamespace) managerOptions.WebhookServer = crWebhook.NewServer(webhookOptions) mgr, err := ctrl.NewManager(cfg, managerOptions) @@ -171,7 +203,7 @@ func main() { memberClusterObjectsMap := make(map[string]runtime_cluster.Cluster) if slices.Contains(crds, mongoDBMultiClusterCRDPlural) { - memberClustersNames, err := getMemberClusters(ctx, cfg, currentNamespace) + memberClustersNames, err := getMemberClusters(ctxWithSpan, cfg, currentNamespace) if err != nil { log.Fatal(err) } @@ -219,27 +251,27 @@ func main() { // Setup all Controllers if slices.Contains(crds, mongoDBCRDPlural) { - if err := setupMongoDBCRD(ctx, mgr, imageUrls, initDatabaseNonStaticImageVersion, databaseNonStaticImageVersion, forceEnterprise, memberClusterObjectsMap); err != nil { + if err := setupMongoDBCRD(ctxWithSpan, mgr, imageUrls, initDatabaseNonStaticImageVersion, databaseNonStaticImageVersion, forceEnterprise, memberClusterObjectsMap); err != nil { log.Fatal(err) } } if slices.Contains(crds, mongoDBOpsManagerCRDPlural) { - if err := setupMongoDBOpsManagerCRD(ctx, mgr, memberClusterObjectsMap, imageUrls, initAppdbVersion, initOpsManagerImageVersion); err != nil { + if err := setupMongoDBOpsManagerCRD(ctxWithSpan, mgr, memberClusterObjectsMap, imageUrls, initAppdbVersion, initOpsManagerImageVersion); err != nil { log.Fatal(err) } } if slices.Contains(crds, mongoDBUserCRDPlural) { - if err := setupMongoDBUserCRD(ctx, mgr, memberClusterObjectsMap); err != nil { + if err := setupMongoDBUserCRD(ctxWithSpan, mgr, memberClusterObjectsMap); err != nil { log.Fatal(err) } } if slices.Contains(crds, mongoDBMultiClusterCRDPlural) { - if err := setupMongoDBMultiClusterCRD(ctx, mgr, imageUrls, initDatabaseNonStaticImageVersion, databaseNonStaticImageVersion, forceEnterprise, memberClusterObjectsMap); err != nil { + if err := setupMongoDBMultiClusterCRD(ctxWithSpan, mgr, imageUrls, initDatabaseNonStaticImageVersion, databaseNonStaticImageVersion, forceEnterprise, memberClusterObjectsMap); err != nil { log.Fatal(err) } } if slices.Contains(crds, mongoDBSearchCRDPlural) { - if err := setupMongoDBSearchCRD(ctx, mgr); err != nil { + if err := setupMongoDBSearchCRD(ctxWithSpan, mgr); err != nil { log.Fatal(err) } } @@ -250,7 +282,7 @@ func main() { if slices.Contains(crds, mongoDBCommunityCRDPlural) { if err := setupCommunityController( - ctx, + ctxWithSpan, mgr, envvar.GetEnvOrDefault(mcoConstruct.MongodbCommunityRepoUrlEnv, "quay.io/mongodb"), // when running MCO resource -> mongodb-community-server @@ -290,12 +322,38 @@ func main() { log.Info("Starting the Cmd.") - // Start the Manager - if err := mgr.Start(signals.SetupSignalHandler()); err != nil { + if err := mgr.Start(signalCtx); err != nil { log.Fatal(err) } } +func startRootSpan(currentNamespace string, spanIDHex string, traceCtx context.Context) (context.Context, trace.Span) { + opts := []trace.SpanStartOption{ + trace.WithAttributes( + attribute.String("component", "operator"), + attribute.String("namespace", currentNamespace), + attribute.String("service.name", "mongodb-kubernetes-operator"), + // let's ensure that the root span follows the given parent span + attribute.String("trace.parent_id", spanIDHex), + ), + } + + ctxWithSpan, operatorSpan := telemetry.TRACER.Start(traceCtx, "MONGODB_OPERATOR_ROOT", opts...) + log.Debugf("Started root operator span with ID: %s in trace %s", operatorSpan.SpanContext().SpanID().String(), operatorSpan.SpanContext().TraceID().String()) + return ctxWithSpan, operatorSpan +} + +func shutdownTracerProvider(signalCtx context.Context, tp *sdktrace.TracerProvider) { + shutdownCtx, cancel := context.WithTimeout(signalCtx, 5*time.Second) + defer cancel() + + if err := tp.Shutdown(shutdownCtx); err != nil { + log.Errorf("Error shutting down tracer provider: %v", err) + } else { + log.Debug("Tracer provider successfully shut down") + } +} + func setupMongoDBCRD(ctx context.Context, mgr manager.Manager, imageUrls images.ImageUrls, initDatabaseNonStaticImageVersion, databaseNonStaticImageVersion string, forceEnterprise bool, memberClusterObjectsMap map[string]runtime_cluster.Cluster) error { if err := operator.AddStandaloneController(ctx, mgr, imageUrls, initDatabaseNonStaticImageVersion, databaseNonStaticImageVersion, forceEnterprise); err != nil { return err diff --git a/pipeline.py b/pipeline.py index f33f85d1e..c6d6e0a4f 100755 --- a/pipeline.py +++ b/pipeline.py @@ -69,7 +69,7 @@ def _setup_tracing(): trace_id=int(trace_id, 16), span_id=int(parent_id, 16), is_remote=False, - # Magic number needed for our OTEL collector + # This flag ensures the span is sampled and sent to the collector trace_flags=TraceFlags(0x01), ) ctx = trace.set_span_in_context(NonRecordingSpan(span_context)) diff --git a/pkg/telemetry/client.go b/pkg/telemetry/client.go index 8d08c2c2a..a1cdfb3fc 100644 --- a/pkg/telemetry/client.go +++ b/pkg/telemetry/client.go @@ -10,6 +10,7 @@ import ( "time" "github.com/hashicorp/go-retryablehttp" + "go.opentelemetry.io/otel/attribute" "go.uber.org/zap" atlas "go.mongodb.org/atlas/mongodbatlas" @@ -114,6 +115,11 @@ response: // SendEventWithRetry sends an HTTP request with retries on transient failures. func (c *Client) SendEventWithRetry(ctx context.Context, body []Event) error { + _, span := TRACER.Start(ctx, "SendEventWithRetry") + baseUrl := c.atlasClient.BaseURL + span.SetAttributes(attribute.KeyValue{Key: "mck.atlas.base_url", Value: attribute.StringValue(baseUrl.String())}) + defer span.End() + atlasClient := c.atlasClient request, err := atlasClient.NewRequest(ctx, http.MethodPost, "api/private/unauth/telemetry/events", body) if err != nil { diff --git a/pkg/telemetry/collector.go b/pkg/telemetry/collector.go index 1ee1ff52b..88a9cc2b1 100644 --- a/pkg/telemetry/collector.go +++ b/pkg/telemetry/collector.go @@ -6,6 +6,7 @@ import ( "strings" "time" + "go.opentelemetry.io/otel/attribute" "go.uber.org/zap" "golang.org/x/xerrors" "k8s.io/client-go/rest" @@ -66,9 +67,8 @@ func NewLeaderRunnable(operatorMgr manager.Manager, memberClusterObjectsMap map[ memberClusterObjectsMap: memberClusterObjectsMap, currentNamespace: currentNamespace, configuredOperatorEnv: operatorEnv, - - mongodbImage: mongodbImage, - databaseNonStaticImage: databaseNonStaticImage, + mongodbImage: mongodbImage, + databaseNonStaticImage: databaseNonStaticImage, }, nil } @@ -82,8 +82,13 @@ func (l *LeaderRunnable) Start(ctx context.Context) error { type snapshotCollector func(ctx context.Context, memberClusterMap map[string]ConfigClient, operatorClusterMgr manager.Manager, operatorUUID, mongodbImage, databaseNonStaticImage string) []Event // RunTelemetry lists the specified CRDs and sends them as events to Segment -func RunTelemetry(ctx context.Context, mongodbImage, databaseNonStaticImage, namespace string, operatorClusterMgr manager.Manager, clusterMap map[string]cluster.Cluster, atlasClient *Client, configuredOperatorEnv util.OperatorEnvironment) { - Logger.Debug("sending telemetry!") +func RunTelemetry(leaderTrace context.Context, mongodbImage, databaseNonStaticImage, namespace string, operatorClusterMgr manager.Manager, clusterMap map[string]cluster.Cluster, atlasClient *Client, configuredOperatorEnv util.OperatorEnvironment) { + Logger.Debug("Collecting telemetry!") + ctx, span := TRACER.Start(leaderTrace, "RunTelemetry") + span.SetAttributes( + attribute.String("mck.resource.type", "telemetry-collection"), + ) + defer span.End() intervalStr := envvar.GetEnvOrDefault(CollectionFrequency, DefaultCollectionFrequencyStr) // nolint:forbidigo duration, err := time.ParseDuration(intervalStr) diff --git a/pkg/telemetry/configmap.go b/pkg/telemetry/configmap.go index 01baaef25..539978b5f 100644 --- a/pkg/telemetry/configmap.go +++ b/pkg/telemetry/configmap.go @@ -8,6 +8,7 @@ import ( "time" "github.com/google/uuid" + "go.opentelemetry.io/otel/attribute" "k8s.io/apimachinery/pkg/types" corev1 "k8s.io/api/core/v1" @@ -82,6 +83,13 @@ func updateConfigMapWithNewUUID(ctx context.Context, k8sClient kubeclient.Client // Creates a new ConfigMap with a generated UUID func createNewConfigMap(ctx context.Context, k8sClient kubeclient.Client, namespace string) string { + _, span := TRACER.Start(ctx, "createNewConfigMap") + span.SetAttributes( + attribute.String("mck.resource.type", "telemetry-collection"), + attribute.String("mck.k8s.namespace", namespace), + ) + defer span.End() + newUUID, newConfigMap := createInitialConfigmap(namespace) if err := k8sClient.Create(ctx, newConfigMap); err != nil { Logger.Debugf("Failed to create ConfigMap %s: %s", OperatorConfigMapTelemetryConfigMapName, err) diff --git a/pkg/telemetry/trace.go b/pkg/telemetry/trace.go new file mode 100644 index 000000000..f03f515ea --- /dev/null +++ b/pkg/telemetry/trace.go @@ -0,0 +1,87 @@ +package telemetry + +import ( + "context" + "time" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" + "go.opentelemetry.io/otel/sdk/resource" + "go.opentelemetry.io/otel/trace" + + sdktrace "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" +) + +var TRACER = otel.Tracer("mongodb-kubernetes-operator") + +// SetupTracingFromParent initializes OpenTelemetry tracing given a remote trace and span. +func SetupTracingFromParent(ctx context.Context, traceIDHex, parentIDHex, endpoint string) (context.Context, *sdktrace.TracerProvider, error) { + if traceIDHex == "" || parentIDHex == "" || endpoint == "" { + Logger.Debug("tracing environment variables missing, not configuring tracing from a remote span and trace") + return ctx, nil, nil + } + + Logger.Debugf("Setting up tracing with traceIDHex=%s, parentIDHex=%s, endpoint=%s", traceIDHex, parentIDHex, endpoint) + + traceID, err := trace.TraceIDFromHex(traceIDHex) + if err != nil { + Logger.Warnf("Failed to parse trace ID: %v", err) + return ctx, nil, err + } + parentSpanID, err := trace.SpanIDFromHex(parentIDHex) + if err != nil { + Logger.Warnf("Failed to parse parent span ID: %v", err) + return ctx, nil, err + } + + Logger.Debugf("Using trace ID: %s, parent span ID: %s", traceID.String(), parentSpanID.String()) + // Create a span context that marks this as a remote parent span context + // This allows the operator to create spans that are children of the e2e test spans + sc := trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: traceID, + SpanID: parentSpanID, + TraceFlags: trace.FlagsSampled, + Remote: true, + }) + + ctxWithParentSpan := trace.ContextWithRemoteSpanContext(ctx, sc) + + spanCtx := trace.SpanContextFromContext(ctxWithParentSpan) + Logger.Debugf("Created span context with TraceID: %s, SpanID: %s, Remote: %t", + spanCtx.TraceID().String(), spanCtx.SpanID().String(), spanCtx.IsRemote()) + + exporter, err := otlptracegrpc.New( + context.Background(), + otlptracegrpc.WithEndpoint(endpoint), + ) + if err != nil { + Logger.Warnf("Failed to create OTLP exporter: %v", err) + return ctx, nil, err + } + + bsp := sdktrace.NewBatchSpanProcessor( + exporter, + sdktrace.WithBatchTimeout(5*time.Second), + ) + + res := resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceNameKey.String("mongodb-kubernetes-operator"), + attribute.String("component", "operator"), + // the trace we want the root to attach to + attribute.String("trace.id", traceID.String()), + ) + + tp := sdktrace.NewTracerProvider( + sdktrace.WithResource(res), + sdktrace.WithSpanProcessor(bsp), + sdktrace.WithSampler(sdktrace.AlwaysSample()), + ) + + // Set the global tracer provider + otel.SetTracerProvider(tp) + + return ctxWithParentSpan, tp, nil +} diff --git a/scripts/evergreen/deployments/test-app/templates/mongodb-enterprise-tests.yaml b/scripts/evergreen/deployments/test-app/templates/mongodb-enterprise-tests.yaml index 4ef291daa..46dd24375 100644 --- a/scripts/evergreen/deployments/test-app/templates/mongodb-enterprise-tests.yaml +++ b/scripts/evergreen/deployments/test-app/templates/mongodb-enterprise-tests.yaml @@ -80,8 +80,9 @@ spec: - name: OTEL_RESOURCE_ATTRIBUTES value: {{ .Values.otel_resource_attributes }} {{ end }} + # Set service name to identify this component in the trace - name: OTEL_SERVICE_NAME - value: evergreen-agent + value: mongodb-e2e-tests - name: PYTEST_RUN_NAME value: {{ .Values.taskName }} - name: TASK_ID @@ -179,6 +180,8 @@ spec: # Options to pytest command should go in the pytest.ini file. command: ["pytest"] {{ if .Values.otel_endpoint }} + # Use trace-parent to create the root span with specified trace ID and parent ID + # Note: we create the root span here, and the operator will create child spans that connect to it args: ["-vv", "-m", "{{ .Values.taskName }}", "--trace-parent", "00-{{ .Values.otel_trace_id }}-{{ .Values.otel_parent_id }}-01", "--export-traces"] {{ else }} args: ["-vv", "-m", "{{ .Values.taskName }}"] diff --git a/scripts/evergreen/e2e/e2e.sh b/scripts/evergreen/e2e/e2e.sh index f0294787f..f9c6af556 100755 --- a/scripts/evergreen/e2e/e2e.sh +++ b/scripts/evergreen/e2e/e2e.sh @@ -28,6 +28,50 @@ run_e2e_mco_tests() { return ${test_results} } +dump_cluster_information() { + # Dump information from all clusters. + # TODO: ensure cluster name is included in log files so there is no overwriting of cross cluster files. + # shellcheck disable=SC2154 + if [[ "${KUBE_ENVIRONMENT_NAME:-}" = "multi" ]]; then + echo "Dumping diagnostics for context ${CENTRAL_CLUSTER}" + dump_all "${CENTRAL_CLUSTER}" || true + + for member_cluster in ${MEMBER_CLUSTERS}; do + echo "Dumping diagnostics for context ${member_cluster}" + dump_all "${member_cluster}" || true + done + else + # Dump all the information we can from this namespace + dump_all || true + fi +} + +cleanup_openshift_cluster(){ + if [[ "${TEST_RESULTS}" -ne 0 ]]; then + # Mark namespace as failed to be cleaned later + kubectl label "namespace/${NAMESPACE}" "evg/state=failed" --overwrite=true + + if [ "${ALWAYS_REMOVE_TESTING_NAMESPACE-}" = "true" ]; then + # Failed namespaces might cascade into more failures if the namespaces + # are not being removed soon enough. + reset_namespace "$(kubectl config current-context)" "${NAMESPACE}" || true + fi + else + if [[ "${KUBE_ENVIRONMENT_NAME}" = "multi" ]]; then + echo "Tearing down cluster ${CENTRAL_CLUSTER}" + reset_namespace "${CENTRAL_CLUSTER}" "${NAMESPACE}" || true + + for member_cluster in ${MEMBER_CLUSTERS}; do + echo "Tearing down cluster ${member_cluster}" + reset_namespace "${member_cluster}" "${NAMESPACE}" || true + done + else + # If the test pass, then the namespace is removed + reset_namespace "$(kubectl config current-context)" "${NAMESPACE}" || true + fi + fi +} + if [[ -n "${KUBECONFIG:-}" && ! -f "${KUBECONFIG}" ]]; then echo "Kube configuration: ${KUBECONFIG} file does not exist!" exit 1 @@ -102,48 +146,21 @@ else timeout --foreground "${timeout_sec}" scripts/evergreen/e2e/single_e2e.sh || TEST_RESULTS=$? fi -# Dump information from all clusters. -# TODO: ensure cluster name is included in log files so there is no overwriting of cross cluster files. -# shellcheck disable=SC2154 -if [[ "${KUBE_ENVIRONMENT_NAME:-}" = "multi" ]]; then - echo "Dumping diagnostics for context ${CENTRAL_CLUSTER}" - dump_all "${CENTRAL_CLUSTER}" || true - - for member_cluster in ${MEMBER_CLUSTERS}; do - echo "Dumping diagnostics for context ${member_cluster}" - dump_all "${member_cluster}" || true - done -else - # Dump all the information we can from this namespace - dump_all || true -fi - -# we only have static cluster in openshift, otherwise there is no need to mark and clean them up here -if [[ ${CLUSTER_TYPE} == "openshift" ]]; then - if [[ "${TEST_RESULTS}" -ne 0 ]]; then - # Mark namespace as failed to be cleaned later - kubectl label "namespace/${NAMESPACE}" "evg/state=failed" --overwrite=true +dump_cluster_information - if [ "${ALWAYS_REMOVE_TESTING_NAMESPACE-}" = "true" ]; then - # Failed namespaces might cascade into more failures if the namespaces - # are not being removed soon enough. - reset_namespace "$(kubectl config current-context)" "${NAMESPACE}" || true - fi +# We only have static clusters in OpenShift; otherwise, there's no need to mark and clean them up here. +if [[ "${CLUSTER_TYPE}" == "openshift" ]]; then + cleanup_openshift_cluster +else + if [[ "${KUBE_ENVIRONMENT_NAME}" == "multi" ]]; then + echo "Tearing down operator on ${CENTRAL_CLUSTER}" + delete_operator "${NAMESPACE}" "mongodb-kubernetes-operator-multi-cluster" else - if [[ "${KUBE_ENVIRONMENT_NAME}" = "multi" ]]; then - echo "Tearing down cluster ${CENTRAL_CLUSTER}" - reset_namespace "${CENTRAL_CLUSTER}" "${NAMESPACE}" || true - - for member_cluster in ${MEMBER_CLUSTERS}; do - echo "Tearing down cluster ${member_cluster}" - reset_namespace "${member_cluster}" "${NAMESPACE}" || true - done - else - # If the test pass, then the namespace is removed - reset_namespace "$(kubectl config current-context)" "${NAMESPACE}" || true - fi + # If the test passed, then the namespace is removed + delete_operator "${NAMESPACE}" "mongodb-kubernetes-operator" fi fi + # We exit with the test result to surface status to Evergreen. exit ${TEST_RESULTS} diff --git a/scripts/funcs/kubernetes b/scripts/funcs/kubernetes index b5bc7f7b3..2b320b0fe 100644 --- a/scripts/funcs/kubernetes +++ b/scripts/funcs/kubernetes @@ -42,11 +42,10 @@ EOF delete_operator() { local ns="$1" - local name=${OPERATOR_NAME:=mongodb-enterprise-operator} + local name=${OPERATOR_NAME:=mongodb-kubernetes-operator} title "Removing the Operator deployment ${name}" - ! kubectl --namespace "${ns}" get deployments | grep -q "${name}" \ - || kubectl delete deployment "${name}" -n "${ns}" || true + kubectl delete deployment "${name}" -n "${ns}" --wait=true --timeout=10s|| true } # wait_for_operator waits for the Operator to start @@ -149,9 +148,8 @@ reset_namespace() { set +e - helm uninstall --kube-context="${context}" mongodb-enterprise-operator || true & - helm uninstall --kube-context="${context}" mongodb-community-operator || true & - helm uninstall --kube-context="${context}" mongodb-enterprise-operator-multi-cluster || true & + helm uninstall --kube-context="${context}" mongodb-kubernetes-operator || true & + helm uninstall --kube-context="${context}" mongodb-kubernetes-operator-multi-cluster || true & # Cleans the namespace. Note, that fine-grained cleanup is performed instead of just deleting the namespace as it takes # considerably less time @@ -169,7 +167,7 @@ reset_namespace() { # a while to delete it. should_wait="false" # shellcheck disable=SC2153 - if [[ ${CURRENT_VARIANT_CONTEXT} == e2e_mdb_openshift_ubi_cloudqa || ${CURRENT_VARIANT_CONTEXT} == e2e_openshift_static_mdb_ubi_cloudqa ]]; then + if [[ ${KUBE_ENVIRONMENT_NAME} == "openshift" ]]; then should_wait="true" echo "Removing the test namespace ${namespace}, should_wait=${should_wait}" kubectl --context "${context}" delete "namespace/${namespace}" --wait="${should_wait}" || true diff --git a/scripts/funcs/operator_deployment b/scripts/funcs/operator_deployment index 8c9984b7d..7748df988 100644 --- a/scripts/funcs/operator_deployment +++ b/scripts/funcs/operator_deployment @@ -40,6 +40,23 @@ get_operator_helm_values() { config+=("operator.telemetry.installClusterRole=${MDB_OPERATOR_TELEMETRY_INSTALL_CLUSTER_ROLE_INSTALLATION}") fi + # Add OpenTelemetry values if any of the environment variables are set + if [[ -n "${otel_trace_id:-}" || -n "${otel_parent_id:-}" || -n "${otel_collector_endpoint:-}" ]]; then + config+=("operator.opentelemetry.tracing.enabled=true") + + if [[ -n "${otel_trace_id:-}" ]]; then + config+=("operator.opentelemetry.tracing.traceID=${otel_trace_id}") + fi + + if [[ -n "${otel_parent_id:-}" ]]; then + config+=("operator.opentelemetry.tracing.parentID=${otel_parent_id}") + fi + + if [[ -n "${otel_collector_endpoint:-}" ]]; then + config+=("operator.opentelemetry.tracing.collectorEndpoint=${otel_collector_endpoint}") + fi + fi + if [[ "${MDB_OPERATOR_TELEMETRY_ENABLED:-true}" == "false" ]]; then config+=("operator.telemetry.enabled=false") config+=("operator.telemetry.collection.clusters.enabled=false")