diff --git a/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml b/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml index 0a58751f17..8fb450866c 100644 --- a/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml +++ b/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml @@ -423,14 +423,6 @@ spec: type: object status: properties: - observedWorkloadGeneration: - description: |- - Runtime detection is applied on pods. - Pods run a specific workload template spec, so it's important to capture it do avoid - unpredictable behavior when multiple generations co-exist, - and to avoid running the detection when unnecessary. - format: int64 - type: integer runtimeDetailsByContainer: description: Capture Runtime Details for the workloads that this CR applies to. @@ -438,6 +430,25 @@ spec: properties: containerName: type: string + criErrorMessage: + description: Stores the error message from the CRI runtime if + returned to prevent instrumenting the container if an error + exists. + type: string + envFromContainerRuntime: + description: Holds the environment variables retrieved from + the container runtime. + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array envVars: items: properties: @@ -472,6 +483,12 @@ spec: name: type: string type: object + runtimeUpdateState: + description: A temporary variable used during migration to track + whether the new runtime detection process has been executed. + If empty, it indicates the process has not yet been run. This + field may be removed later. + type: string runtimeVersion: type: string required: diff --git a/api/config/crd/bases/odigos.io_instrumentedapplications.yaml b/api/config/crd/bases/odigos.io_instrumentedapplications.yaml index 83e7156d7f..c8b17a4444 100644 --- a/api/config/crd/bases/odigos.io_instrumentedapplications.yaml +++ b/api/config/crd/bases/odigos.io_instrumentedapplications.yaml @@ -90,6 +90,25 @@ spec: properties: containerName: type: string + criErrorMessage: + description: Stores the error message from the CRI runtime if + returned to prevent instrumenting the container if an error + exists. + type: string + envFromContainerRuntime: + description: Holds the environment variables retrieved from + the container runtime. + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array envVars: items: properties: @@ -124,6 +143,12 @@ spec: name: type: string type: object + runtimeUpdateState: + description: A temporary variable used during migration to track + whether the new runtime detection process has been executed. + If empty, it indicates the process has not yet been run. This + field may be removed later. + type: string runtimeVersion: type: string required: diff --git a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigstatus.go b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigstatus.go index 3528375e8e..efab8f15bb 100644 --- a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigstatus.go +++ b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigstatus.go @@ -20,8 +20,7 @@ package v1alpha1 // InstrumentationConfigStatusApplyConfiguration represents a declarative configuration of the InstrumentationConfigStatus type for use // with apply. type InstrumentationConfigStatusApplyConfiguration struct { - RuntimeDetailsByContainer []RuntimeDetailsByContainerApplyConfiguration `json:"runtimeDetailsByContainer,omitempty"` - ObservedWorkloadGeneration *int64 `json:"observedWorkloadGeneration,omitempty"` + RuntimeDetailsByContainer []RuntimeDetailsByContainerApplyConfiguration `json:"runtimeDetailsByContainer,omitempty"` } // InstrumentationConfigStatusApplyConfiguration constructs a declarative configuration of the InstrumentationConfigStatus type for use with @@ -42,11 +41,3 @@ func (b *InstrumentationConfigStatusApplyConfiguration) WithRuntimeDetailsByCont } return b } - -// WithObservedWorkloadGeneration sets the ObservedWorkloadGeneration field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ObservedWorkloadGeneration field is set to the value of the last call. -func (b *InstrumentationConfigStatusApplyConfiguration) WithObservedWorkloadGeneration(value int64) *InstrumentationConfigStatusApplyConfiguration { - b.ObservedWorkloadGeneration = &value - return b -} diff --git a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/runtimedetailsbycontainer.go b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/runtimedetailsbycontainer.go index 14d4b53d38..d546f6cdcf 100644 --- a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/runtimedetailsbycontainer.go +++ b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/runtimedetailsbycontainer.go @@ -18,18 +18,22 @@ limitations under the License. package v1alpha1 import ( + odigosv1alpha1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" common "github.com/odigos-io/odigos/common" ) // RuntimeDetailsByContainerApplyConfiguration represents a declarative configuration of the RuntimeDetailsByContainer type for use // with apply. type RuntimeDetailsByContainerApplyConfiguration struct { - ContainerName *string `json:"containerName,omitempty"` - Language *common.ProgrammingLanguage `json:"language,omitempty"` - RuntimeVersion *string `json:"runtimeVersion,omitempty"` - EnvVars []EnvVarApplyConfiguration `json:"envVars,omitempty"` - OtherAgent *OtherAgentApplyConfiguration `json:"otherAgent,omitempty"` - LibCType *common.LibCType `json:"libCType,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + Language *common.ProgrammingLanguage `json:"language,omitempty"` + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + EnvVars []EnvVarApplyConfiguration `json:"envVars,omitempty"` + OtherAgent *OtherAgentApplyConfiguration `json:"otherAgent,omitempty"` + LibCType *common.LibCType `json:"libCType,omitempty"` + CriErrorMessage *string `json:"criErrorMessage,omitempty"` + EnvFromContainerRuntime []EnvVarApplyConfiguration `json:"envFromContainerRuntime,omitempty"` + RuntimeUpdateState *odigosv1alpha1.ProcessingState `json:"runtimeUpdateState,omitempty"` } // RuntimeDetailsByContainerApplyConfiguration constructs a declarative configuration of the RuntimeDetailsByContainer type for use with @@ -90,3 +94,32 @@ func (b *RuntimeDetailsByContainerApplyConfiguration) WithLibCType(value common. b.LibCType = &value return b } + +// WithCriErrorMessage sets the CriErrorMessage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CriErrorMessage field is set to the value of the last call. +func (b *RuntimeDetailsByContainerApplyConfiguration) WithCriErrorMessage(value string) *RuntimeDetailsByContainerApplyConfiguration { + b.CriErrorMessage = &value + return b +} + +// WithEnvFromContainerRuntime adds the given value to the EnvFromContainerRuntime field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EnvFromContainerRuntime field. +func (b *RuntimeDetailsByContainerApplyConfiguration) WithEnvFromContainerRuntime(values ...*EnvVarApplyConfiguration) *RuntimeDetailsByContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEnvFromContainerRuntime") + } + b.EnvFromContainerRuntime = append(b.EnvFromContainerRuntime, *values[i]) + } + return b +} + +// WithRuntimeUpdateState sets the RuntimeUpdateState field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RuntimeUpdateState field is set to the value of the last call. +func (b *RuntimeDetailsByContainerApplyConfiguration) WithRuntimeUpdateState(value odigosv1alpha1.ProcessingState) *RuntimeDetailsByContainerApplyConfiguration { + b.RuntimeUpdateState = &value + return b +} diff --git a/api/go.mod b/api/go.mod index b8562cf90f..2cb5e65903 100644 --- a/api/go.mod +++ b/api/go.mod @@ -20,7 +20,7 @@ require ( github.com/hashicorp/go-version v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/x448/float16 v0.8.4 // indirect - golang.org/x/sync v0.7.0 // indirect + golang.org/x/sync v0.8.0 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect ) @@ -52,11 +52,11 @@ require ( go.opentelemetry.io/otel v1.29.0 go.opentelemetry.io/otel/trace v1.29.0 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect + golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect diff --git a/api/go.sum b/api/go.sum index a28d8f392b..3981a3c1a7 100644 --- a/api/go.sum +++ b/api/go.sum @@ -119,8 +119,8 @@ go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -131,28 +131,28 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/api/odigos/v1alpha1/instrumentationconfig_types.go b/api/odigos/v1alpha1/instrumentationconfig_types.go index 273ca211c0..0c157f3a34 100644 --- a/api/odigos/v1alpha1/instrumentationconfig_types.go +++ b/api/odigos/v1alpha1/instrumentationconfig_types.go @@ -23,12 +23,6 @@ type InstrumentationConfig struct { type InstrumentationConfigStatus struct { // Capture Runtime Details for the workloads that this CR applies to. RuntimeDetailsByContainer []RuntimeDetailsByContainer `json:"runtimeDetailsByContainer,omitempty"` - - // Runtime detection is applied on pods. - // Pods run a specific workload template spec, so it's important to capture it do avoid - // unpredictable behavior when multiple generations co-exist, - // and to avoid running the detection when unnecessary. - ObservedWorkloadGeneration int64 `json:"observedWorkloadGeneration,omitempty"` } // Config for the OpenTelemeetry SDKs that should be applied to a workload. diff --git a/api/odigos/v1alpha1/instrumentedapplication_types.go b/api/odigos/v1alpha1/instrumentedapplication_types.go index 3077d6dca2..cbedca502f 100644 --- a/api/odigos/v1alpha1/instrumentedapplication_types.go +++ b/api/odigos/v1alpha1/instrumentedapplication_types.go @@ -43,6 +43,14 @@ type OtherAgent struct { Name string `json:"name,omitempty"` } +type ProcessingState string + +const ( + ProcessingStateFailed ProcessingState = "Failed" + ProcessingStateSucceeded ProcessingState = "Succeeded" + ProcessingStateSkipped ProcessingState = "Skipped" +) + // +kubebuilder:object:generate=true type RuntimeDetailsByContainer struct { ContainerName string `json:"containerName"` @@ -51,6 +59,13 @@ type RuntimeDetailsByContainer struct { EnvVars []EnvVar `json:"envVars,omitempty"` OtherAgent *OtherAgent `json:"otherAgent,omitempty"` LibCType *common.LibCType `json:"libCType,omitempty"` + + // Stores the error message from the CRI runtime if returned to prevent instrumenting the container if an error exists. + CriErrorMessage *string `json:"criErrorMessage,omitempty"` + // Holds the environment variables retrieved from the container runtime. + EnvFromContainerRuntime []EnvVar `json:"envFromContainerRuntime,omitempty"` + // A temporary variable used during migration to track whether the new runtime detection process has been executed. If empty, it indicates the process has not yet been run. This field may be removed later. + RuntimeUpdateState *ProcessingState `json:"runtimeUpdateState,omitempty"` } // +kubebuilder:object:generate=true diff --git a/api/odigos/v1alpha1/zz_generated.deepcopy.go b/api/odigos/v1alpha1/zz_generated.deepcopy.go index 96b4a7d747..5c7edb7adf 100644 --- a/api/odigos/v1alpha1/zz_generated.deepcopy.go +++ b/api/odigos/v1alpha1/zz_generated.deepcopy.go @@ -1227,6 +1227,21 @@ func (in *RuntimeDetailsByContainer) DeepCopyInto(out *RuntimeDetailsByContainer *out = new(common.LibCType) **out = **in } + if in.CriErrorMessage != nil { + in, out := &in.CriErrorMessage, &out.CriErrorMessage + *out = new(string) + **out = **in + } + if in.EnvFromContainerRuntime != nil { + in, out := &in.EnvFromContainerRuntime, &out.EnvFromContainerRuntime + *out = make([]EnvVar, len(*in)) + copy(*out, *in) + } + if in.RuntimeUpdateState != nil { + in, out := &in.RuntimeUpdateState, &out.RuntimeUpdateState + *out = new(ProcessingState) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeDetailsByContainer. diff --git a/autoscaler/go.mod b/autoscaler/go.mod index 01d6b965f0..c7adc0ed78 100644 --- a/autoscaler/go.mod +++ b/autoscaler/go.mod @@ -74,9 +74,9 @@ require ( golang.org/x/time v0.7.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.68.1 // indirect google.golang.org/protobuf v1.35.1 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/autoscaler/go.sum b/autoscaler/go.sum index b5201a9d06..e051f87d2a 100644 --- a/autoscaler/go.sum +++ b/autoscaler/go.sum @@ -191,12 +191,12 @@ 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/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= +google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/common/envOverwrite/overwriter.go b/common/envOverwrite/overwriter.go index 66f7323a10..e713acecf9 100644 --- a/common/envOverwrite/overwriter.go +++ b/common/envOverwrite/overwriter.go @@ -58,6 +58,13 @@ var EnvValuesMap = map[string]envValues{ }, } +// EnvVarsForLanguage is a map of environment variables that are relevant for each language. +var EnvVarsForLanguage = map[common.ProgrammingLanguage][]string{ + common.JavascriptProgrammingLanguage: {"NODE_OPTIONS"}, + common.PythonProgrammingLanguage: {"PYTHONPATH"}, + common.JavaProgrammingLanguage: {"JAVA_OPTS", "JAVA_TOOL_OPTIONS"}, +} + func GetRelevantEnvVarsKeys() []string { keys := make([]string, 0, len(EnvValuesMap)) for key := range EnvValuesMap { diff --git a/frontend/go.mod b/frontend/go.mod index 13a1258e51..12ef0a5f10 100644 --- a/frontend/go.mod +++ b/frontend/go.mod @@ -75,8 +75,8 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.68.1 // indirect ) require ( @@ -133,8 +133,8 @@ require ( go.opentelemetry.io/otel/trace v1.29.0 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/crypto v0.31.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/term v0.27.0 // indirect golang.org/x/text v0.21.0 // indirect diff --git a/frontend/go.sum b/frontend/go.sum index 7ae38cb33e..1bc1d38f13 100644 --- a/frontend/go.sum +++ b/frontend/go.sum @@ -349,10 +349,10 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -392,12 +392,12 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= -google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= -google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= +google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= diff --git a/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml b/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml index 0a58751f17..8fb450866c 100644 --- a/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml +++ b/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml @@ -423,14 +423,6 @@ spec: type: object status: properties: - observedWorkloadGeneration: - description: |- - Runtime detection is applied on pods. - Pods run a specific workload template spec, so it's important to capture it do avoid - unpredictable behavior when multiple generations co-exist, - and to avoid running the detection when unnecessary. - format: int64 - type: integer runtimeDetailsByContainer: description: Capture Runtime Details for the workloads that this CR applies to. @@ -438,6 +430,25 @@ spec: properties: containerName: type: string + criErrorMessage: + description: Stores the error message from the CRI runtime if + returned to prevent instrumenting the container if an error + exists. + type: string + envFromContainerRuntime: + description: Holds the environment variables retrieved from + the container runtime. + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array envVars: items: properties: @@ -472,6 +483,12 @@ spec: name: type: string type: object + runtimeUpdateState: + description: A temporary variable used during migration to track + whether the new runtime detection process has been executed. + If empty, it indicates the process has not yet been run. This + field may be removed later. + type: string runtimeVersion: type: string required: diff --git a/helm/odigos/templates/crds/odigos.io_instrumentedapplications.yaml b/helm/odigos/templates/crds/odigos.io_instrumentedapplications.yaml index 83e7156d7f..c8b17a4444 100644 --- a/helm/odigos/templates/crds/odigos.io_instrumentedapplications.yaml +++ b/helm/odigos/templates/crds/odigos.io_instrumentedapplications.yaml @@ -90,6 +90,25 @@ spec: properties: containerName: type: string + criErrorMessage: + description: Stores the error message from the CRI runtime if + returned to prevent instrumenting the container if an error + exists. + type: string + envFromContainerRuntime: + description: Holds the environment variables retrieved from + the container runtime. + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array envVars: items: properties: @@ -124,6 +143,12 @@ spec: name: type: string type: object + runtimeUpdateState: + description: A temporary variable used during migration to track + whether the new runtime detection process has been executed. + If empty, it indicates the process has not yet been run. This + field may be removed later. + type: string runtimeVersion: type: string required: diff --git a/instrumentor/go.mod b/instrumentor/go.mod index 0622e26078..f6cd7c90bc 100644 --- a/instrumentor/go.mod +++ b/instrumentor/go.mod @@ -38,9 +38,9 @@ require ( go.opentelemetry.io/otel/trace v1.33.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.68.1 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect ) diff --git a/instrumentor/go.sum b/instrumentor/go.sum index 78eb5c07ff..bf3ca31c18 100644 --- a/instrumentor/go.sum +++ b/instrumentor/go.sum @@ -236,12 +236,12 @@ golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3j golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= 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/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= +google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= 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/k8sutils/go.mod b/k8sutils/go.mod index 124c251259..8db32c9f3e 100644 --- a/k8sutils/go.mod +++ b/k8sutils/go.mod @@ -40,27 +40,30 @@ require ( github.com/x448/float16 v0.8.4 // indirect go.opentelemetry.io/otel v1.29.0 // indirect go.opentelemetry.io/otel/trace v1.29.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect ) require ( - github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/logr v1.4.2 github.com/gogo/protobuf v1.3.2 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/text v0.18.0 // indirect + google.golang.org/grpc v1.68.1 gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + k8s.io/cri-api v0.31.3 k8s.io/klog/v2 v2.130.1 // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect sigs.k8s.io/controller-runtime v0.19.0 diff --git a/k8sutils/go.sum b/k8sutils/go.sum index 190c082480..6624568c0e 100644 --- a/k8sutils/go.sum +++ b/k8sutils/go.sum @@ -120,8 +120,8 @@ go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -130,10 +130,10 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -142,14 +142,14 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -164,6 +164,10 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= +google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -188,6 +192,8 @@ k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= +k8s.io/cri-api v0.31.3 h1:dsZXzrGrCEwHjsTDlAV7rutEplpMLY8bfNRMIqrtXjo= +k8s.io/cri-api v0.31.3/go.mod h1:Po3TMAYH/+KrZabi7QiwQI4a692oZcUOUThd/rqwxrI= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= diff --git a/k8sutils/pkg/cri/criwrapper.go b/k8sutils/pkg/cri/criwrapper.go new file mode 100644 index 0000000000..7ca9d53700 --- /dev/null +++ b/k8sutils/pkg/cri/criwrapper.go @@ -0,0 +1,186 @@ +package criwrapper + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "os" + "strings" + "time" + + "github.com/go-logr/logr" + odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + criapi "k8s.io/cri-api/pkg/apis/runtime/v1" +) + +var ( + ErrDetectingCRIEndpoint = errors.New("Unable to detect CRI runtime endpoint") + ErrFailedToValidateCRIConnection = errors.New("Failed to validate CRI runtime connection") +) + +type CriClient struct { + conn *grpc.ClientConn + client criapi.RuntimeServiceClient + Logger logr.Logger +} + +// Default runtime endpoints +var defaultRuntimeEndpoints = []string{ + "unix:///run/containerd/containerd.sock", + "unix:///run/crio/crio.sock", + "unix:///var/run/cri-dockerd.sock", +} + +func detectRuntimeSocket() string { + for _, endpoint := range defaultRuntimeEndpoints { + // Extract the file path from the endpoint + socketPath := strings.TrimPrefix(endpoint, "unix://") + if _, err := os.Stat(socketPath); err == nil { + return endpoint + } + } + return "" +} + +// Connect attempts to establish a connection to a CRI runtime. +func (rc *CriClient) Connect(ctx context.Context) error { + var err error + + endpoint := detectRuntimeSocket() + if endpoint == "" { + return ErrDetectingCRIEndpoint + } + + rc.Logger.Info("Starting connection attempt to CRI runtime", "endpoint", endpoint) + + rc.conn, err = grpc.NewClient( + endpoint, + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + + if err != nil { + return fmt.Errorf("failed to create gRPC connection: %v", err) + } + + // Create a new RuntimeService client + rc.client = criapi.NewRuntimeServiceClient(rc.conn) + + // Validate the connection by invoking a lightweight method + ctx, cancel := context.WithTimeout(ctx, time.Second*2) + defer cancel() + + _, err = rc.client.Version(ctx, &criapi.VersionRequest{}) + if err != nil { + return ErrFailedToValidateCRIConnection + } + + rc.Logger.Info("Successfully connected to CRI runtime", "endpoint", endpoint) + return nil + +} + +// GetContainerInfo retrieves the "info" field of the specified container. +func (rc *CriClient) GetContainerInfo(ctx context.Context, containerID string) (map[string]string, error) { + containerID = extractContainerID(containerID) + if containerID == "" { + return nil, fmt.Errorf("invalid container ID") + } + + if rc.client == nil { + return nil, fmt.Errorf("runtime client is not connected") + } + // Set a timeout for the request + timeoutCtx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() + + // Call the ContainerStatus API + response, err := rc.client.ContainerStatus(timeoutCtx, &criapi.ContainerStatusRequest{ + ContainerId: containerID, + Verbose: true, + }) + + if err != nil { + return nil, err + } + + return response.GetInfo(), nil +} + +func (rc *CriClient) GetContainerEnvVars(ctx context.Context, containerID string) (map[string]string, error) { + info, err := rc.GetContainerInfo(ctx, containerID) + if err != nil { + return nil, fmt.Errorf("failed to get container status: %v", err) + } + + infoData, found := info["info"] + if !found { + return nil, fmt.Errorf("info not found in container status") + } + + // Parse "info" into JSON structure + var infoJSON struct { + RuntimeSpec struct { + Process struct { + Env []string `json:"env"` + } `json:"process"` + } `json:"runtimeSpec"` + } + + if err := json.Unmarshal([]byte(infoData), &infoJSON); err != nil { + return nil, fmt.Errorf("failed to parse runtimeSpec info: %v", err) + } + + // Convert "KEY=VALUE" to a map + envVars := make(map[string]string, len(infoJSON.RuntimeSpec.Process.Env)) + for _, env := range infoJSON.RuntimeSpec.Process.Env { + if parts := strings.SplitN(env, "=", 2); len(parts) == 2 { + envVars[parts[0]] = parts[1] + } + } + + return envVars, nil +} + +func (rc *CriClient) GetContainerEnvVarsList(ctx context.Context, envVarKeys []string, containerID string) ([]odigosv1.EnvVar, error) { + envVars, err := rc.GetContainerEnvVars(ctx, containerID) + if err != nil { + return nil, fmt.Errorf("failed to get container environment variables: %v", err) + } + + // Extract only requested environment variables + result := make([]odigosv1.EnvVar, 0, len(envVarKeys)) + for _, key := range envVarKeys { + if value, exists := envVars[key]; exists { + result = append(result, odigosv1.EnvVar{Name: key, Value: value}) + } + } + + return result, nil +} + +// Close closes the gRPC connection. +func (rc *CriClient) Close() { + if rc.conn != nil { + rc.Logger.V(0).Info("Closing gRPC connection") + if err := rc.conn.Close(); err != nil { + rc.Logger.V(0).Error(err, "Failed to close gRPC connection") + // Optional: Handle the error further, such as retrying or logging to an external service. + } else { + rc.Logger.V(0).Info("gRPC connection closed successfully") + } + } +} + +// ExtractContainerID extracts the actual container ID from a containerID string. +// The input format is '://'. +// If the input is invalid, it returns an empty string. +func extractContainerID(containerUri string) string { + if containerUri == "" || !strings.Contains(containerUri, "://") { + return "" + } + parts := strings.SplitN(containerUri, "://", 2) + return parts[1] +} diff --git a/k8sutils/pkg/describe/source/analyze.go b/k8sutils/pkg/describe/source/analyze.go index cfc6eede8d..a825b39299 100644 --- a/k8sutils/pkg/describe/source/analyze.go +++ b/k8sutils/pkg/describe/source/analyze.go @@ -224,14 +224,7 @@ func analyzeRuntimeInfo(resources *OdigosSourceResources) *RuntimeInfoAnalyze { return nil } - generation := properties.EntityProperty{ - Name: "Workload Generation", - Value: resources.InstrumentationConfig.Status.ObservedWorkloadGeneration, - Explain: "the k8s object generation of the workload object that this instrumentation config is associated with", - } - return &RuntimeInfoAnalyze{ - Generation: generation, Containers: analyzeRuntimeDetails(resources.InstrumentationConfig.Status.RuntimeDetailsByContainer), } } diff --git a/odiglet/go.mod b/odiglet/go.mod index d8920ba159..129618bafe 100644 --- a/odiglet/go.mod +++ b/odiglet/go.mod @@ -106,7 +106,8 @@ require ( gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.31.3 // indirect + k8s.io/apiextensions-apiserver v0.31.0 // indirect + k8s.io/cri-api v0.32.0 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect diff --git a/odiglet/go.sum b/odiglet/go.sum index 2467a2f295..47dd9b2c65 100644 --- a/odiglet/go.sum +++ b/odiglet/go.sum @@ -582,8 +582,8 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt k8s.io/api v0.19.2/go.mod h1:IQpK0zFQ1xc5iNIQPqzgoOwuFugaYHK4iCknlAQP9nI= k8s.io/api v0.32.0 h1:OL9JpbvAU5ny9ga2fb24X8H6xQlVp+aJMFlgtQjR9CE= k8s.io/api v0.32.0/go.mod h1:4LEwHZEf6Q/cG96F3dqR965sYOfmPM7rq81BLgsE0p0= -k8s.io/apiextensions-apiserver v0.31.3 h1:+GFGj2qFiU7rGCsA5o+p/rul1OQIq6oYpQw4+u+nciE= -k8s.io/apiextensions-apiserver v0.31.3/go.mod h1:2DSpFhUZZJmn/cr/RweH1cEVVbzFw9YBu4T+U3mf1e4= +k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= +k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= k8s.io/apimachinery v0.19.2/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= k8s.io/apimachinery v0.32.0 h1:cFSE7N3rmEEtv4ei5X6DaJPHHX0C+upp+v5lVPiEwpg= k8s.io/apimachinery v0.32.0/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= @@ -591,6 +591,8 @@ k8s.io/client-go v0.19.2/go.mod h1:S5wPhCqyDNAlzM9CnEdgTGV4OqhsW3jGO1UM1epwfJA= k8s.io/client-go v0.32.0 h1:DimtMcnN/JIKZcrSrstiwvvZvLjG0aSxy8PxN8IChp8= k8s.io/client-go v0.32.0/go.mod h1:boDWvdM1Drk4NJj/VddSLnx59X3OPgwrOo0vGbtq9+8= k8s.io/component-base v0.19.2/go.mod h1:g5LrsiTiabMLZ40AR6Hl45f088DevyGY+cCE2agEIVo= +k8s.io/cri-api v0.32.0 h1:pzXJfyG7Tm4acrEt5HPqAq3r4cN5guLeapAN/NM2b70= +k8s.io/cri-api v0.32.0/go.mod h1:DCzMuTh2padoinefWME0G678Mc3QFbLMF2vEweGzBAI= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= diff --git a/odiglet/odiglet.go b/odiglet/odiglet.go index 8bac5348bc..d8793b0eee 100644 --- a/odiglet/odiglet.go +++ b/odiglet/odiglet.go @@ -6,6 +6,8 @@ import ( "github.com/kubevirt/device-plugin-manager/pkg/dpm" "github.com/odigos-io/odigos/common" + commonInstrumentation "github.com/odigos-io/odigos/instrumentation" + criwrapper "github.com/odigos-io/odigos/k8sutils/pkg/cri" k8senv "github.com/odigos-io/odigos/k8sutils/pkg/env" "github.com/odigos-io/odigos/odiglet/pkg/ebpf" "github.com/odigos-io/odigos/odiglet/pkg/env" @@ -14,11 +16,9 @@ import ( "github.com/odigos-io/odigos/odiglet/pkg/log" "github.com/odigos-io/odigos/opampserver/pkg/server" "golang.org/x/sync/errgroup" - - commonInstrumentation "github.com/odigos-io/odigos/instrumentation" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime" + controllerruntime "sigs.k8s.io/controller-runtime" ) type Odiglet struct { @@ -27,6 +27,7 @@ type Odiglet struct { ebpfManager commonInstrumentation.Manager configUpdates chan<- commonInstrumentation.ConfigUpdate[ebpf.K8sConfigGroup] deviceInjectionCallbacks instrumentation.OtelSdksLsf + criClient *criwrapper.CriClient } const ( @@ -56,8 +57,17 @@ func New(deviceInjectionCallbacks instrumentation.OtelSdksLsf, factories map[com if err != nil { return nil, fmt.Errorf("failed to create ebpf manager %w", err) } + criWrapper := criwrapper.CriClient{Logger: log.Logger} + + kubeManagerOptions := kube.KubeManagerOptions{ + Mgr: mgr, + EbpfDirectors: nil, + Clientset: clientset, + ConfigUpdates: configUpdates, + CriClient: &criWrapper, + } - err = kube.SetupWithManager(mgr, nil, clientset, configUpdates) + err = kube.SetupWithManager(kubeManagerOptions) if err != nil { return nil, fmt.Errorf("failed to setup controller-runtime manager %w", err) } @@ -68,6 +78,7 @@ func New(deviceInjectionCallbacks instrumentation.OtelSdksLsf, factories map[com ebpfManager: ebpfManager, configUpdates: configUpdates, deviceInjectionCallbacks: deviceInjectionCallbacks, + criClient: &criWrapper, }, nil } @@ -75,6 +86,12 @@ func New(deviceInjectionCallbacks instrumentation.OtelSdksLsf, factories map[com func (o *Odiglet) Run(ctx context.Context) { g, groupCtx := errgroup.WithContext(ctx) + if err := o.criClient.Connect(ctx); err != nil { + log.Logger.Error(err, "Failed to connect to CRI runtime") + } + + defer o.criClient.Close() + // Start pprof server g.Go(func() error { err := common.StartPprofServer(groupCtx, log.Logger) diff --git a/odiglet/pkg/kube/manager.go b/odiglet/pkg/kube/manager.go index 22a9e146a4..8264fc6c96 100644 --- a/odiglet/pkg/kube/manager.go +++ b/odiglet/pkg/kube/manager.go @@ -12,6 +12,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" + criwrapper "github.com/odigos-io/odigos/k8sutils/pkg/cri" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/runtime" @@ -34,6 +35,14 @@ func init() { utilruntime.Must(odigosv1.AddToScheme(scheme)) } +type KubeManagerOptions struct { + Mgr ctrl.Manager + EbpfDirectors ebpf.DirectorsMap + Clientset *kubernetes.Clientset + ConfigUpdates chan<- instrumentation.ConfigUpdate[ebpf.K8sConfigGroup] + CriClient *criwrapper.CriClient +} + func CreateManager() (ctrl.Manager, error) { log.Logger.V(0).Info("Starting reconcileres for runtime details") ctrl.SetLogger(log.Logger) @@ -68,13 +77,13 @@ func CreateManager() (ctrl.Manager, error) { }) } -func SetupWithManager(mgr ctrl.Manager, ebpfDirectors ebpf.DirectorsMap, clientset *kubernetes.Clientset, configUpdates chan<- instrumentation.ConfigUpdate[ebpf.K8sConfigGroup]) error { - err := runtime_details.SetupWithManager(mgr, clientset) +func SetupWithManager(kubeManagerOptions KubeManagerOptions) error { + err := runtime_details.SetupWithManager(kubeManagerOptions.Mgr, kubeManagerOptions.Clientset, kubeManagerOptions.CriClient) if err != nil { return err } - err = instrumentation_ebpf.SetupWithManager(mgr, ebpfDirectors, configUpdates) + err = instrumentation_ebpf.SetupWithManager(kubeManagerOptions.Mgr, kubeManagerOptions.EbpfDirectors, kubeManagerOptions.ConfigUpdates) if err != nil { return err } diff --git a/odiglet/pkg/kube/runtime_details/inspection.go b/odiglet/pkg/kube/runtime_details/inspection.go index afb33d745c..07d4474caa 100644 --- a/odiglet/pkg/kube/runtime_details/inspection.go +++ b/odiglet/pkg/kube/runtime_details/inspection.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "strings" "github.com/odigos-io/odigos/procdiscovery/pkg/libc" @@ -12,12 +13,13 @@ import ( "github.com/odigos-io/odigos/odiglet/pkg/process" - k8sutils "github.com/odigos-io/odigos/k8sutils/pkg/utils" - "github.com/go-logr/logr" odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" "github.com/odigos-io/odigos/common" + "github.com/odigos-io/odigos/common/envOverwrite" "github.com/odigos-io/odigos/common/utils" + criwrapper "github.com/odigos-io/odigos/k8sutils/pkg/cri" + k8sutils "github.com/odigos-io/odigos/k8sutils/pkg/utils" "github.com/odigos-io/odigos/k8sutils/pkg/workload" kubeutils "github.com/odigos-io/odigos/odiglet/pkg/kube/utils" "github.com/odigos-io/odigos/odiglet/pkg/log" @@ -57,7 +59,7 @@ func inspectRuntimesOfRunningPods(ctx context.Context, logger *logr.Logger, labe return err } - runtimeResults, err := runtimeInspection(pods, odigosConfig.IgnoredContainers) + runtimeResults, err := runtimeInspection(ctx, pods, odigosConfig.IgnoredContainers, nil) if err != nil { logger.Error(err, "error inspecting pods") return err @@ -72,7 +74,7 @@ func inspectRuntimesOfRunningPods(ctx context.Context, logger *logr.Logger, labe return nil } -func runtimeInspection(pods []corev1.Pod, ignoredContainers []string) ([]odigosv1.RuntimeDetailsByContainer, error) { +func runtimeInspection(ctx context.Context, pods []corev1.Pod, ignoredContainers []string, criClient *criwrapper.CriClient) ([]odigosv1.RuntimeDetailsByContainer, error) { resultsMap := make(map[string]odigosv1.RuntimeDetailsByContainer) for _, pod := range pods { for _, container := range pod.Spec.Containers { @@ -147,7 +149,7 @@ func runtimeInspection(pods []corev1.Pod, ignoredContainers []string) ([]odigosv if err == nil { libcType = typeFound } else { - log.Logger.Error(err, "error inspecting libc type", "pod", pod.Name, "container", container.Name, "namespace", pod.Namespace) + log.Logger.Error(err, "error inspecting libc type", "pod", pod.Name, "container", container.Name, "namespace", pod.Namespace) } } } @@ -165,6 +167,12 @@ func runtimeInspection(pods []corev1.Pod, ignoredContainers []string) ([]odigosv OtherAgent: detectedAgent, LibCType: libcType, } + + if criClient != nil { // CriClient passed as nil in cases that will be deprecated in the future [InstrumentedApplication] + procEnvVars := inspectProc.Environments.OverwriteEnvs + updateRuntimeDetailsWithContainerRuntimeEnvs(ctx, *criClient, pod, container, programLanguageDetails, &resultsMap, procEnvVars) + } + } } @@ -176,7 +184,112 @@ func runtimeInspection(pods []corev1.Pod, ignoredContainers []string) ([]odigosv return results, nil } +// updateRuntimeDetailsWithContainerRuntimeEnvs checks if relevant environment variables are set in the Runtime +// and updates the RuntimeDetailsByContainer accordingly. +func updateRuntimeDetailsWithContainerRuntimeEnvs(ctx context.Context, criClient criwrapper.CriClient, pod corev1.Pod, container corev1.Container, + programLanguageDetails common.ProgramLanguageDetails, resultsMap *map[string]odigosv1.RuntimeDetailsByContainer, procEnvVars map[string]string) { + // Retrieve environment variable names for the specified language + envVarNames, exists := envOverwrite.EnvVarsForLanguage[programLanguageDetails.Language] + if !exists { + return + } + + // Verify if environment variables already exist in the container manifest. + // If they exist, there's no need to fetch them from the Container Runtime, and we will just append our additions in the webhook. + if envsExistsInManifest := checkEnvVarsInContainerManifest(container, envVarNames); envsExistsInManifest { + return + } + + // Environment variables do not exist in the manifest; fetch them from the container's Runtime + fetchAndSetEnvFromContainerRuntime(ctx, criClient, pod, container, envVarNames, resultsMap, procEnvVars) +} + +// fetchAndSetEnvFromContainerRuntime retrieves environment variables from the container's runtime and updates the runtime details. +func fetchAndSetEnvFromContainerRuntime(ctx context.Context, criClient criwrapper.CriClient, pod corev1.Pod, container corev1.Container, + envVarKeys []string, resultsMap *map[string]odigosv1.RuntimeDetailsByContainer, procEnvVars map[string]string) { + containerID := getContainerID(pod.Status.ContainerStatuses, container.Name) + if containerID == "" { + log.Logger.V(0).Info("containerID not found for container", "container", container.Name, "pod", pod.Name, "namespace", pod.Namespace) + return + } + envVars, err := criClient.GetContainerEnvVarsList(ctx, envVarKeys, containerID) + runtimeDetailsByContainer := (*resultsMap)[container.Name] + + var state odigosv1.ProcessingState + + if err != nil { + // If the CRI request fails, we can still attempt to check the /proc//environ file. + // This is only applicable if the relevant value in /proc is EMPTY and we are certain it wasn't present in the manifest (as indicated by reaching this point in the code). + // In such cases, we can mark the state as `ProcessingStateSucceeded` and proceed without setting any environment variables. + for _, envVarKey := range envVarKeys { + procEnvVarValue, exists := procEnvVars[envVarKey] + if !exists || procEnvVarValue == "" { + state = odigosv1.ProcessingStateSucceeded + } else { + state = odigosv1.ProcessingStateFailed + // In Java, there are two potential relevant environment variables. If either of them exists or is not nil, we cannot consider the process as succeeded. + break + } + } + + log.Logger.Error(err, "failed to get relevant env var per language from CRI", "container", container.Name, "pod", pod.Name, "namespace", pod.Namespace) + errMessage := fmt.Sprintf("CRI communication error for container %s in pod %s/%s", + container.Name, pod.Namespace, pod.Name) + + runtimeDetailsByContainer.CriErrorMessage = &errMessage + + } else { + state = odigosv1.ProcessingStateSucceeded + runtimeDetailsByContainer.EnvFromContainerRuntime = envVars + } + + runtimeDetailsByContainer.RuntimeUpdateState = &state + + // Update the results map with the modified runtime details + (*resultsMap)[container.Name] = runtimeDetailsByContainer +} + +// getContainerID retrieves the container ID for a given container name from the list of container statuses. +func getContainerID(containerStatuses []corev1.ContainerStatus, containerName string) string { + for _, containerStatus := range containerStatuses { + if containerStatus.Name == containerName { + return containerStatus.ContainerID + } + } + return "" +} + +func checkEnvVarsInContainerManifest(container corev1.Container, envVarNames []string) bool { + // Create a map for quick lookup of envVar names + envVarSet := make(map[string]struct{}) + for _, name := range envVarNames { + envVarSet[name] = struct{}{} + } + + // Iterate over the container's environment variables + for _, containerEnvVar := range container.Env { + if _, exists := envVarSet[containerEnvVar.Name]; exists { + return true + } + } + return false +} + func persistRuntimeDetailsToInstrumentationConfig(ctx context.Context, kubeclient client.Client, instrumentationConfig *odigosv1.InstrumentationConfig, newStatus odigosv1.InstrumentationConfigStatus) error { + // This come to make sure we're updating instrumentationConfig only once (at the first time) + currentConfig := &odigosv1.InstrumentationConfig{} + err := kubeclient.Get(ctx, client.ObjectKeyFromObject(instrumentationConfig), currentConfig) + if err != nil { + return fmt.Errorf("failed to retrieve current InstrumentationConfig: %w", err) + } + + // Verify if the new RuntimeDetails process has already been executed. + // If it has, skip updating the RuntimeDetails to ensure the new runtime detection is performed only once. + for _, container := range currentConfig.Status.RuntimeDetailsByContainer { + if container.RuntimeUpdateState != nil { + return nil + } + } // persist the runtime results into the status of the instrumentation config patchStatus := odigosv1.InstrumentationConfig{ diff --git a/odiglet/pkg/kube/runtime_details/instrumentationconfigs_controller.go b/odiglet/pkg/kube/runtime_details/instrumentationconfigs_controller.go index 1ec2218582..886519ca8d 100644 --- a/odiglet/pkg/kube/runtime_details/instrumentationconfigs_controller.go +++ b/odiglet/pkg/kube/runtime_details/instrumentationconfigs_controller.go @@ -5,6 +5,7 @@ import ( "fmt" odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" + criwrapper "github.com/odigos-io/odigos/k8sutils/pkg/cri" k8sutils "github.com/odigos-io/odigos/k8sutils/pkg/utils" kubeutils "github.com/odigos-io/odigos/odiglet/pkg/kube/utils" corev1 "k8s.io/api/core/v1" @@ -51,6 +52,7 @@ type InstrumentationConfigReconciler struct { // without pulling in specific objects into the controller runtime cache // which can be expensive (memory and CPU) Clientset *kubernetes.Clientset + CriClient *criwrapper.CriClient } func (r *InstrumentationConfigReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { @@ -78,46 +80,23 @@ func (r *InstrumentationConfigReconciler) Reconcile(ctx context.Context, request return reconcile.Result{}, err } - // we need to apply runtime detection for just one pod with newer generation - var selectedPodForInspection *corev1.Pod - selectedPodGeneration := int64(0) - for i := range pods { - podPtr := &pods[i] - podGeneration, err := GetPodGeneration(ctx, r.Clientset, podPtr) - if err != nil { - logger.Error(err, "Failed to get pod generation") - return reconcile.Result{}, err - } - if podGeneration == 0 { - // 0 means the pod is not relevant for runtime detection - continue - } - - if podGeneration > instrumentationConfig.Status.ObservedWorkloadGeneration && podGeneration > selectedPodGeneration { - selectedPodGeneration = podGeneration - selectedPodForInspection = podPtr - } - } - - if selectedPodForInspection == nil { - // when a instrumentation config is created, many nodes may not have any running pods for it - // or the runtime detection has already been completed for this generation in other odiglets - return reconcile.Result{}, nil - } - odigosConfig, err := k8sutils.GetCurrentOdigosConfig(ctx, r.Client) if err != nil { return reconcile.Result{}, err } - runtimeResults, err := runtimeInspection([]corev1.Pod{*selectedPodForInspection}, odigosConfig.IgnoredContainers) + var selectedPods []corev1.Pod + if len(pods) > 0 { + selectedPods = append(selectedPods, pods[0]) + } + + runtimeResults, err := runtimeInspection(ctx, selectedPods, odigosConfig.IgnoredContainers, r.CriClient) if err != nil { return reconcile.Result{}, err } err = persistRuntimeDetailsToInstrumentationConfig(ctx, r.Client, &instrumentationConfig, odigosv1.InstrumentationConfigStatus{ - RuntimeDetailsByContainer: runtimeResults, - ObservedWorkloadGeneration: selectedPodGeneration, + RuntimeDetailsByContainer: runtimeResults, }) if err != nil { return reconcile.Result{}, err diff --git a/odiglet/pkg/kube/runtime_details/manager.go b/odiglet/pkg/kube/runtime_details/manager.go index 0521be9ae3..a05ab61f14 100644 --- a/odiglet/pkg/kube/runtime_details/manager.go +++ b/odiglet/pkg/kube/runtime_details/manager.go @@ -3,6 +3,7 @@ package runtime_details import ( odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" + criwrapper "github.com/odigos-io/odigos/k8sutils/pkg/cri" odigospredicate "github.com/odigos-io/odigos/k8sutils/pkg/predicate" corev1 "k8s.io/api/core/v1" "k8s.io/client-go/kubernetes" @@ -10,7 +11,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/builder" ) -func SetupWithManager(mgr ctrl.Manager, clientset *kubernetes.Clientset) error { +func SetupWithManager(mgr ctrl.Manager, clientset *kubernetes.Clientset, criClient *criwrapper.CriClient) error { err := builder. ControllerManagedBy(mgr). For(&odigosv1.InstrumentationConfig{}). @@ -32,6 +33,7 @@ func SetupWithManager(mgr ctrl.Manager, clientset *kubernetes.Clientset) error { Client: mgr.GetClient(), Scheme: mgr.GetScheme(), Clientset: clientset, + CriClient: criClient, }) if err != nil { return err @@ -46,6 +48,7 @@ func SetupWithManager(mgr ctrl.Manager, clientset *kubernetes.Clientset) error { Client: mgr.GetClient(), Scheme: mgr.GetScheme(), Clientset: clientset, + CriClient: criClient, }) if err != nil { return err diff --git a/odiglet/pkg/kube/runtime_details/pods_controller.go b/odiglet/pkg/kube/runtime_details/pods_controller.go index e64503bb04..bd24a4a5c4 100644 --- a/odiglet/pkg/kube/runtime_details/pods_controller.go +++ b/odiglet/pkg/kube/runtime_details/pods_controller.go @@ -5,6 +5,7 @@ import ( odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" "github.com/odigos-io/odigos/common" + criwrapper "github.com/odigos-io/odigos/k8sutils/pkg/cri" k8sutils "github.com/odigos-io/odigos/k8sutils/pkg/utils" "github.com/odigos-io/odigos/k8sutils/pkg/workload" corev1 "k8s.io/api/core/v1" @@ -23,11 +24,11 @@ type PodsReconciler struct { // without pulling in specific objects into the controller runtime cache // which can be expensive (memory and CPU) Clientset *kubernetes.Clientset + CriClient *criwrapper.CriClient } // We need to apply runtime details detection for a new running pod in the following cases: -// 1. When a new workload generation is applied, the runtime details might be changed (different env, versions, etc). -// 2. When a source is added, but there are no running pods yet. When the first pod starts running, this is chance to apply runtime details detection. +// 1. User Instrument the pod for the first time func (p *PodsReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { logger := log.FromContext(ctx) @@ -54,23 +55,6 @@ func (p *PodsReconciler) Reconcile(ctx context.Context, request reconcile.Reques if err != nil { return reconcile.Result{}, client.IgnoreNotFound(err) } - podGeneration, err := GetPodGeneration(ctx, p.Clientset, &pod) - if err != nil { - return reconcile.Result{}, err - } - - // prevent runtime inspection on pods for which we already have the runtime details for this generation - // if instrumentation config contains unknown language we need to re-inspect the pod - failedToGetPodGeneration := podGeneration == 0 - isNewPodGeneration := podGeneration > instrumentationConfig.Status.ObservedWorkloadGeneration - instrumentedConfigContainUnknown := InstrumentationConfigContainsUnknownLanguage(instrumentationConfig) - - shouldSkipDetection := failedToGetPodGeneration || (!isNewPodGeneration && !instrumentedConfigContainUnknown) - - if shouldSkipDetection { - logger.V(3).Info("skipping redundant runtime details detection since generation is not newer", "name", request.Name, "namespace", request.Namespace, "currentPodGeneration", podGeneration, "observedWorkloadGeneration", instrumentationConfig.Status.ObservedWorkloadGeneration) - return reconcile.Result{}, nil - } odigosConfig, err := k8sutils.GetCurrentOdigosConfig(ctx, p.Client) if err != nil { @@ -78,20 +62,19 @@ func (p *PodsReconciler) Reconcile(ctx context.Context, request reconcile.Reques } // Perform runtime inspection once we know the pod is newer that the latest runtime inspection performed and saved. - runtimeResults, err := runtimeInspection([]corev1.Pod{pod}, odigosConfig.IgnoredContainers) + runtimeResults, err := runtimeInspection(ctx, []corev1.Pod{pod}, odigosConfig.IgnoredContainers, p.CriClient) if err != nil { return reconcile.Result{}, err } err = persistRuntimeDetailsToInstrumentationConfig(ctx, p.Client, &instrumentationConfig, odigosv1.InstrumentationConfigStatus{ - RuntimeDetailsByContainer: runtimeResults, - ObservedWorkloadGeneration: podGeneration, + RuntimeDetailsByContainer: runtimeResults, }) if err != nil { return reconcile.Result{}, err } - logger.V(0).Info("Completed runtime details detection for a new running pod", "name", request.Name, "namespace", request.Namespace, "generation", podGeneration) + logger.V(0).Info("Completed runtime details detection for a new running pod", "name", request.Name, "namespace", request.Namespace) return reconcile.Result{}, nil } diff --git a/odiglet/pkg/kube/runtime_details/utils.go b/odiglet/pkg/kube/runtime_details/utils.go deleted file mode 100644 index f3e57b1f1c..0000000000 --- a/odiglet/pkg/kube/runtime_details/utils.go +++ /dev/null @@ -1,78 +0,0 @@ -package runtime_details - -import ( - "context" - "errors" - "strconv" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" -) - -func findDeploymentNameInOwnerReferences(ownerReferences []metav1.OwnerReference) string { - for _, owner := range ownerReferences { - if owner.Kind == "Deployment" { - return owner.Name - } - } - return "" -} - -func getGenerationFromReplicaSet(ctx context.Context, kubeClient *kubernetes.Clientset, rsName string, ns string) (int64, error) { - rs, err := kubeClient.AppsV1().ReplicaSets(ns).Get(ctx, rsName, metav1.GetOptions{}) - if err != nil { - return 0, err - } - deploymentRevision, found := rs.Annotations["deployment.kubernetes.io/revision"] - if !found { - return 0, nil - } - - deploymentName := findDeploymentNameInOwnerReferences(rs.ObjectMeta.OwnerReferences) - if deploymentName == "" { - return 0, errors.New("replica set with deployment revision has no deployment owner") - } - - deployment, err := kubeClient.AppsV1().Deployments(ns).Get(ctx, deploymentName, metav1.GetOptions{}) - if err != nil { - return 0, err - } - if deployment.Annotations["deployment.kubernetes.io/revision"] != deploymentRevision { - return 0, nil - } - if deployment.Status.ObservedGeneration == 0 { - return 0, errors.New("deployment with revision has no observed generation") - } - return deployment.Status.ObservedGeneration, nil -} - -func getGenerationForDsOrSs(pod *corev1.Pod) (int64, error) { - // the "pod-template-generation" seems to be deprecated, but still valid and populated. - // I tried to use the "controller-revision-hash" label, find the controller revision object - // and extract the generation from it, but it seems to be more complex and not worth the effort. - podTemplateGeneration, ok := pod.Labels["pod-template-generation"] - if !ok { - return 0, errors.New("pod from ds or ss has no pod-template-generation label") - } - - return strconv.ParseInt(podTemplateGeneration, 10, 64) -} - -// Givin a pod, this function calculates it's workload generation. -// e.g. it will return the generation of the deployment/ds/ss manifest that created the pod. -// This function uses clientset and not the controller-runtime client, so not to pull these objects into the cache, -// potentially increasing the memory usage of the process. -// Avoid calling this function too often, as it will make an API call to the k8s API server. -func GetPodGeneration(ctx context.Context, kubeClient *kubernetes.Clientset, pod *corev1.Pod) (int64, error) { - for _, owner := range pod.ObjectMeta.OwnerReferences { - if owner.Kind == "ReplicaSet" { - return getGenerationFromReplicaSet(ctx, kubeClient, owner.Name, pod.Namespace) - } else if owner.Kind == "DaemonSet" || owner.Kind == "StatefulSet" { - return getGenerationForDsOrSs(pod) - } - } - - // the pod is not owned by a workload odigos supports, so no need to handle it. - return 0, nil -} diff --git a/opampserver/go.mod b/opampserver/go.mod index cb453eb950..b9ad12aeaf 100644 --- a/opampserver/go.mod +++ b/opampserver/go.mod @@ -8,7 +8,7 @@ require ( github.com/odigos-io/odigos/common v0.0.0 github.com/odigos-io/odigos/k8sutils v0.0.0 go.opentelemetry.io/otel v1.29.0 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.68.1 google.golang.org/protobuf v1.34.2 k8s.io/api v0.31.0 k8s.io/apimachinery v0.31.0 @@ -60,15 +60,15 @@ require ( go.opentelemetry.io/otel/trace v1.29.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect + golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // 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/opampserver/go.sum b/opampserver/go.sum index fed84c6290..8d1702a36c 100644 --- a/opampserver/go.sum +++ b/opampserver/go.sum @@ -140,8 +140,8 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -150,10 +150,10 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -163,14 +163,14 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -187,10 +187,10 @@ golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3j golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= 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/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= +google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/scheduler/go.mod b/scheduler/go.mod index f1c4c8f4e8..08ed266e70 100644 --- a/scheduler/go.mod +++ b/scheduler/go.mod @@ -73,9 +73,9 @@ require ( golang.org/x/time v0.7.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.68.1 // indirect google.golang.org/protobuf v1.35.1 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/scheduler/go.sum b/scheduler/go.sum index 4781eb035c..e35e3ee5b4 100644 --- a/scheduler/go.sum +++ b/scheduler/go.sum @@ -234,12 +234,12 @@ golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3j golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= 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/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= +google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= 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/tests/common/assert/simple-demo-instrumented.yaml b/tests/common/assert/simple-demo-instrumented.yaml index 5086b2319f..0f72e3f887 100644 --- a/tests/common/assert/simple-demo-instrumented.yaml +++ b/tests/common/assert/simple-demo-instrumented.yaml @@ -122,12 +122,8 @@ metadata: kind: Deployment name: coupon status: - observedWorkloadGeneration: 2 # pod has been restarted after destination was added runtimeDetailsByContainer: - containerName: coupon - envVars: - - name: NODE_OPTIONS - value: --require /var/odigos/nodejs/autoinstrumentation.js language: javascript runtimeVersion: 18.3.0 --- @@ -143,14 +139,8 @@ metadata: kind: Deployment name: frontend status: - observedWorkloadGeneration: 2 # pod has been restarted after destination was added runtimeDetailsByContainer: - containerName: frontend - (sort_by(envVars, &name)): - - name: JAVA_OPTS - value: -javaagent:/var/odigos/java/javaagent.jar - - name: JAVA_TOOL_OPTIONS - value: -javaagent:/var/odigos/java/javaagent.jar language: java runtimeVersion: 17.0.11+9 --- @@ -166,13 +156,8 @@ metadata: kind: Deployment name: inventory status: - observedWorkloadGeneration: 2 # pod has been restarted after destination was added runtimeDetailsByContainer: - containerName: inventory - envVars: - - name: PYTHONPATH - # The image contains /bar in PYTHONPATH so this is concatenated with odigos value - value: /bar:/var/odigos/python:/var/odigos/python/opentelemetry/instrumentation/auto_instrumentation language: python runtimeVersion: 3.11.9 --- @@ -188,7 +173,6 @@ metadata: kind: Deployment name: membership status: - observedWorkloadGeneration: 2 # pod has been restarted after destination was added runtimeDetailsByContainer: - containerName: membership language: go @@ -206,7 +190,6 @@ metadata: kind: Deployment name: pricing status: - observedWorkloadGeneration: 2 runtimeDetailsByContainer: - containerName: pricing language: dotnet diff --git a/tests/common/assert/simple-demo-runtime-detected.yaml b/tests/common/assert/simple-demo-runtime-detected.yaml index fc6ee12492..92f893f6a9 100644 --- a/tests/common/assert/simple-demo-runtime-detected.yaml +++ b/tests/common/assert/simple-demo-runtime-detected.yaml @@ -90,7 +90,6 @@ metadata: kind: Deployment name: coupon status: - observedWorkloadGeneration: 1 # destination not yet added so pod not yet restarted runtimeDetailsByContainer: - containerName: coupon language: javascript @@ -108,7 +107,6 @@ metadata: kind: Deployment name: frontend status: - observedWorkloadGeneration: 1 # destination not yet added so pod not yet restarted runtimeDetailsByContainer: - containerName: frontend language: java @@ -126,7 +124,6 @@ metadata: kind: Deployment name: inventory status: - observedWorkloadGeneration: 1 # destination not yet added so pod not yet restarted runtimeDetailsByContainer: - containerName: inventory envVars: @@ -147,7 +144,6 @@ metadata: kind: Deployment name: membership status: - observedWorkloadGeneration: 1 runtimeDetailsByContainer: - containerName: membership language: go @@ -165,7 +161,6 @@ metadata: kind: Deployment name: pricing status: - observedWorkloadGeneration: 1 runtimeDetailsByContainer: - containerName: pricing language: dotnet