diff --git a/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml b/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml index 8fb450866..1f16bc4d0 100644 --- a/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml +++ b/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml @@ -423,6 +423,64 @@ spec: type: object status: properties: + conditions: + description: Represents the observations of a InstrumentationConfig's + current state. + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array runtimeDetailsByContainer: description: Capture Runtime Details for the workloads that this CR applies to. diff --git a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigstatus.go b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigstatus.go index efab8f15b..f6796dea5 100644 --- a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigstatus.go +++ b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigstatus.go @@ -17,10 +17,15 @@ limitations under the License. package v1alpha1 +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + // InstrumentationConfigStatusApplyConfiguration represents a declarative configuration of the InstrumentationConfigStatus type for use // with apply. type InstrumentationConfigStatusApplyConfiguration struct { RuntimeDetailsByContainer []RuntimeDetailsByContainerApplyConfiguration `json:"runtimeDetailsByContainer,omitempty"` + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` } // InstrumentationConfigStatusApplyConfiguration constructs a declarative configuration of the InstrumentationConfigStatus type for use with @@ -41,3 +46,16 @@ func (b *InstrumentationConfigStatusApplyConfiguration) WithRuntimeDetailsByCont } return b } + +// WithConditions adds the given value to the Conditions 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 Conditions field. +func (b *InstrumentationConfigStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *InstrumentationConfigStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/api/odigos/v1alpha1/instrumentationconfig_types.go b/api/odigos/v1alpha1/instrumentationconfig_types.go index 62368f562..f12a4841f 100644 --- a/api/odigos/v1alpha1/instrumentationconfig_types.go +++ b/api/odigos/v1alpha1/instrumentationconfig_types.go @@ -50,6 +50,9 @@ type RuntimeDetailsByContainer struct { type InstrumentationConfigStatus struct { // Capture Runtime Details for the workloads that this CR applies to. RuntimeDetailsByContainer []RuntimeDetailsByContainer `json:"runtimeDetailsByContainer,omitempty"` + + // Represents the observations of a InstrumentationConfig's current state. + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" protobuf:"bytes,1,rep,name=conditions"` } // Config for the OpenTelemeetry SDKs that should be applied to a workload. diff --git a/api/odigos/v1alpha1/zz_generated.deepcopy.go b/api/odigos/v1alpha1/zz_generated.deepcopy.go index 5c7edb7ad..4d703eb33 100644 --- a/api/odigos/v1alpha1/zz_generated.deepcopy.go +++ b/api/odigos/v1alpha1/zz_generated.deepcopy.go @@ -484,6 +484,13 @@ func (in *InstrumentationConfigStatus) DeepCopyInto(out *InstrumentationConfigSt (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstrumentationConfigStatus. diff --git a/cli/cmd/resources/README.md b/cli/cmd/resources/README.md index 00c6335e7..93b377484 100644 --- a/cli/cmd/resources/README.md +++ b/cli/cmd/resources/README.md @@ -22,7 +22,7 @@ In this doc, we'll keep track of the permissions requested across different reso | Instrumentor | "" | nodes, namespaces | get, list, watch | Tracks runtime detection and resource labels for instrumentation. | | Instrumentor | apps | daemonsets, deployments, statefulsets | get, list, watch, update, patch | Adjusts pod specifications for instrumentation. | | Instrumentor | odigos.io | instrumentedapplications | delete, get, list, watch | Reacts to runtime detections in workloads. | -| Instrumentor | odigos.io | instrumentedapplications/status | get, patch, update | Updates application statuses post-injection. | +| Instrumentor | odigos.io | instrumentationconfigs/status | get, patch, update | Updates application statuses post-injection. | | Instrumentor | odigos.io | instrumentationconfigs | create, delete, get, list, patch, update, watch | Manages instrumentation configurations. | | Scheduler | odigos.io | instrumentationconfigs | get, list, watch | Monitors changes in instrumentation configurations for scheduling updates. | | Autoscaler | odigos.io | instrumentationconfigs | get, list, watch | Reads instrumentation configurations to populate the `data-collector` configmaps. | diff --git a/cli/cmd/resources/instrumentor.go b/cli/cmd/resources/instrumentor.go index a78276fd4..4aad6e6e6 100644 --- a/cli/cmd/resources/instrumentor.go +++ b/cli/cmd/resources/instrumentor.go @@ -181,9 +181,9 @@ func NewInstrumentorClusterRole() *rbacv1.ClusterRole { Resources: []string{"instrumentedapplications"}, Verbs: []string{"delete", "get", "list", "watch"}, }, - { // Update the status of the instrumented applications after device injection + { // Update the status of the instrumentation configs after device injection APIGroups: []string{"odigos.io"}, - Resources: []string{"instrumentedapplications/status"}, + Resources: []string{"instrumentationconfigs/status"}, Verbs: []string{"get", "patch", "update"}, }, { @@ -191,11 +191,6 @@ func NewInstrumentorClusterRole() *rbacv1.ClusterRole { Resources: []string{"instrumentationconfigs"}, Verbs: []string{"create", "delete", "get", "list", "patch", "update", "watch"}, }, - { - APIGroups: []string{"odigos.io"}, - Resources: []string{"instrumentationconfigs/status"}, - Verbs: []string{"update"}, - }, }, } } diff --git a/frontend/endpoints/sources.go b/frontend/endpoints/sources.go index 3e2fc69bb..b0040dcc8 100644 --- a/frontend/endpoints/sources.go +++ b/frontend/endpoints/sources.go @@ -25,9 +25,8 @@ type SourceLanguage struct { } type InstrumentedApplicationDetails struct { - Languages []SourceLanguage `json:"languages,omitempty"` - Conditions []metav1.Condition `json:"conditions,omitempty"` - InstrumentationOptions []v1alpha1.WorkloadInstrumentationConfig `json:"instrumentation_options,omitempty"` + Languages []SourceLanguage `json:"languages,omitempty"` + Conditions []metav1.Condition `json:"conditions,omitempty"` } // this object contains only part of the source fields. It is used to display the sources in the frontend @@ -54,7 +53,7 @@ func GetSources(c *gin.Context, odigosns string) { var ( items []GetApplicationItem - instrumentedApplications *v1alpha1.InstrumentedApplicationList + instrumentedApplications *v1alpha1.InstrumentationConfigList ) g, errCtx := errgroup.WithContext(reqCtx) @@ -76,7 +75,7 @@ func GetSources(c *gin.Context, odigosns string) { g.Go(func() error { var err error - instrumentedApplications, err = kube.DefaultClient.OdigosClient.InstrumentedApplications("").List(errCtx, metav1.ListOptions{}) + instrumentedApplications, err = kube.DefaultClient.OdigosClient.InstrumentationConfigs("").List(errCtx, metav1.ListOptions{}) return err }) @@ -148,7 +147,7 @@ func GetSource(c *gin.Context) { NumberOfRunningInstances: numberOfRunningInstances, } - instrumentedApplication, err := kube.DefaultClient.OdigosClient.InstrumentedApplications(ns).Get(c, k8sObjectName, metav1.GetOptions{}) + instrumentedApplication, err := kube.DefaultClient.OdigosClient.InstrumentationConfigs(ns).Get(c, k8sObjectName, metav1.GetOptions{}) if err == nil { // valid instrumented application, grab the runtime details @@ -354,7 +353,7 @@ func handleInstrumentationConfigRequest(c *gin.Context, ns, kind, name string, c return err } -func k8sInstrumentedAppToThinSource(app *v1alpha1.InstrumentedApplication) ThinSource { +func k8sInstrumentedAppToThinSource(app *v1alpha1.InstrumentationConfig) ThinSource { var source ThinSource source.Name = app.OwnerReferences[0].Name source.Kind = workload.WorkloadKind(app.OwnerReferences[0].Kind) @@ -369,31 +368,12 @@ func k8sInstrumentedAppToThinSource(app *v1alpha1.InstrumentedApplication) ThinS }) } - var instrumentationOptions []v1alpha1.WorkloadInstrumentationConfig - - for _, option := range app.Spec.Options { - for _, libOptions := range option.InstrumentationLibraries { - for _, configOption := range libOptions.Options { - instrumentationOptions = append(instrumentationOptions, v1alpha1.WorkloadInstrumentationConfig{ - OptionKey: configOption.OptionKey, - SpanKind: configOption.SpanKind, - InstrumentationLibraries: []v1alpha1.InstrumentationLibrary{ - { - InstrumentationLibraryName: libOptions.LibraryName, - }, - }, - }) - } - } - } - source.IaDetails = &InstrumentedApplicationDetails{ - Languages: []SourceLanguage{}, - Conditions: conditions, - InstrumentationOptions: instrumentationOptions, + Languages: []SourceLanguage{}, + Conditions: conditions, } - for _, language := range app.Spec.RuntimeDetails { + for _, language := range app.Status.RuntimeDetailsByContainer { sourceLanguage := SourceLanguage{ ContainerName: language.ContainerName, Language: string(language.Language), @@ -406,9 +386,9 @@ func k8sInstrumentedAppToThinSource(app *v1alpha1.InstrumentedApplication) ThinS return source } -func addHealthyInstrumentationInstancesCondition(ctx context.Context, app *v1alpha1.InstrumentedApplication, source *ThinSource) error { - labelSelector := fmt.Sprintf("%s=%s", consts.InstrumentedAppNameLabel, app.Name) - instancesList, err := kube.DefaultClient.OdigosClient.InstrumentationInstances(app.Namespace).List(ctx, metav1.ListOptions{ +func addHealthyInstrumentationInstancesCondition(ctx context.Context, instConfig *v1alpha1.InstrumentationConfig, source *ThinSource) error { + labelSelector := fmt.Sprintf("%s=%s", consts.InstrumentedAppNameLabel, instConfig.Name) + instancesList, err := kube.DefaultClient.OdigosClient.InstrumentationInstances(instConfig.Namespace).List(ctx, metav1.ListOptions{ LabelSelector: labelSelector, }) diff --git a/frontend/graph/conversions.go b/frontend/graph/conversions.go index 67746ccc1..8ad8ec36a 100644 --- a/frontend/graph/conversions.go +++ b/frontend/graph/conversions.go @@ -42,10 +42,10 @@ func k8sLastTransitionTimeToGql(t v1.Time) *string { return &str } -func instrumentedApplicationToActualSource(instrumentedApp v1alpha1.InstrumentedApplication) *model.K8sActualSource { +func instrumentationConfigToActualSource(instruConfig v1alpha1.InstrumentationConfig) *model.K8sActualSource { // Map the container runtime details var containers []*model.SourceContainerRuntimeDetails - for _, container := range instrumentedApp.Spec.RuntimeDetails { + for _, container := range instruConfig.Status.RuntimeDetailsByContainer { var otherAgentName *string if container.OtherAgent != nil { otherAgentName = &container.OtherAgent.Name @@ -61,7 +61,7 @@ func instrumentedApplicationToActualSource(instrumentedApp v1alpha1.Instrumented // Map the conditions of the application var conditions []*model.Condition - for _, condition := range instrumentedApp.Status.Conditions { + for _, condition := range instruConfig.Status.Conditions { conditions = append(conditions, &model.Condition{ Type: condition.Type, Status: k8sConditionStatusToGql(condition.Status), @@ -73,12 +73,11 @@ func instrumentedApplicationToActualSource(instrumentedApp v1alpha1.Instrumented // Return the converted K8sActualSource object return &model.K8sActualSource{ - Namespace: instrumentedApp.Namespace, - Kind: k8sKindToGql(instrumentedApp.OwnerReferences[0].Kind), - Name: instrumentedApp.OwnerReferences[0].Name, - ServiceName: &instrumentedApp.Name, + Namespace: instruConfig.Namespace, + Kind: k8sKindToGql(instruConfig.OwnerReferences[0].Kind), + Name: instruConfig.OwnerReferences[0].Name, + ReportedName: &instruConfig.Spec.ServiceName, NumberOfInstances: nil, - AutoInstrumented: instrumentedApp.Spec.Options != nil, InstrumentedApplicationDetails: &model.InstrumentedApplicationDetails{ Containers: containers, Conditions: conditions, diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index caba2e253..1bcdf4d4a 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -240,22 +240,12 @@ type ComplexityRoot struct { Workload func(childComplexity int) int } - InstrumentationLibrary struct { - LibraryName func(childComplexity int) int - Options func(childComplexity int) int - } - InstrumentationLibraryGlobalId struct { Language func(childComplexity int) int Name func(childComplexity int) int SpanKind func(childComplexity int) int } - InstrumentationOption struct { - OptionKey func(childComplexity int) int - SpanKind func(childComplexity int) int - } - InstrumentationRule struct { Disabled func(childComplexity int) int InstrumentationLibraries func(childComplexity int) int @@ -266,16 +256,9 @@ type ComplexityRoot struct { Workloads func(childComplexity int) int } - InstrumentedApplicationAnalyze struct { - Containers func(childComplexity int) int - CreateTime func(childComplexity int) int - Created func(childComplexity int) int - } - InstrumentedApplicationDetails struct { - Conditions func(childComplexity int) int - Containers func(childComplexity int) int - InstrumentationOptions func(childComplexity int) int + Conditions func(childComplexity int) int + Containers func(childComplexity int) int } K8sActualNamespace struct { @@ -285,15 +268,12 @@ type ComplexityRoot struct { } K8sActualSource struct { - AutoInstrumented func(childComplexity int) int - AutoInstrumentedDecision func(childComplexity int) int InstrumentedApplicationDetails func(childComplexity int) int Kind func(childComplexity int) int Name func(childComplexity int) int Namespace func(childComplexity int) int NumberOfInstances func(childComplexity int) int ReportedName func(childComplexity int) int - ServiceName func(childComplexity int) int } LatencySamplerAction struct { @@ -435,7 +415,6 @@ type ComplexityRoot struct { RuntimeInfoAnalyze struct { Containers func(childComplexity int) int - Generation func(childComplexity int) int } SingleDestinationMetricsResponse struct { @@ -453,17 +432,16 @@ type ComplexityRoot struct { } SourceAnalyze struct { - InstrumentationConfig func(childComplexity int) int - InstrumentationDevice func(childComplexity int) int - InstrumentedApplication func(childComplexity int) int - Kind func(childComplexity int) int - Labels func(childComplexity int) int - Name func(childComplexity int) int - Namespace func(childComplexity int) int - Pods func(childComplexity int) int - PodsPhasesCount func(childComplexity int) int - RuntimeInfo func(childComplexity int) int - TotalPods func(childComplexity int) int + InstrumentationConfig func(childComplexity int) int + InstrumentationDevice func(childComplexity int) int + Kind func(childComplexity int) int + Labels func(childComplexity int) int + Name func(childComplexity int) int + Namespace func(childComplexity int) int + Pods func(childComplexity int) int + PodsPhasesCount func(childComplexity int) int + RuntimeInfo func(childComplexity int) int + TotalPods func(childComplexity int) int } SourceContainerRuntimeDetails struct { @@ -1323,20 +1301,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.InstrumentationLabelsAnalyze.Workload(childComplexity), true - case "InstrumentationLibrary.libraryName": - if e.complexity.InstrumentationLibrary.LibraryName == nil { - break - } - - return e.complexity.InstrumentationLibrary.LibraryName(childComplexity), true - - case "InstrumentationLibrary.options": - if e.complexity.InstrumentationLibrary.Options == nil { - break - } - - return e.complexity.InstrumentationLibrary.Options(childComplexity), true - case "InstrumentationLibraryGlobalId.language": if e.complexity.InstrumentationLibraryGlobalId.Language == nil { break @@ -1358,20 +1322,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.InstrumentationLibraryGlobalId.SpanKind(childComplexity), true - case "InstrumentationOption.optionKey": - if e.complexity.InstrumentationOption.OptionKey == nil { - break - } - - return e.complexity.InstrumentationOption.OptionKey(childComplexity), true - - case "InstrumentationOption.spanKind": - if e.complexity.InstrumentationOption.SpanKind == nil { - break - } - - return e.complexity.InstrumentationOption.SpanKind(childComplexity), true - case "InstrumentationRule.disabled": if e.complexity.InstrumentationRule.Disabled == nil { break @@ -1421,27 +1371,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.InstrumentationRule.Workloads(childComplexity), true - case "InstrumentedApplicationAnalyze.containers": - if e.complexity.InstrumentedApplicationAnalyze.Containers == nil { - break - } - - return e.complexity.InstrumentedApplicationAnalyze.Containers(childComplexity), true - - case "InstrumentedApplicationAnalyze.createTime": - if e.complexity.InstrumentedApplicationAnalyze.CreateTime == nil { - break - } - - return e.complexity.InstrumentedApplicationAnalyze.CreateTime(childComplexity), true - - case "InstrumentedApplicationAnalyze.created": - if e.complexity.InstrumentedApplicationAnalyze.Created == nil { - break - } - - return e.complexity.InstrumentedApplicationAnalyze.Created(childComplexity), true - case "InstrumentedApplicationDetails.conditions": if e.complexity.InstrumentedApplicationDetails.Conditions == nil { break @@ -1456,13 +1385,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.InstrumentedApplicationDetails.Containers(childComplexity), true - case "InstrumentedApplicationDetails.instrumentationOptions": - if e.complexity.InstrumentedApplicationDetails.InstrumentationOptions == nil { - break - } - - return e.complexity.InstrumentedApplicationDetails.InstrumentationOptions(childComplexity), true - case "K8sActualNamespace.instrumentationLabelEnabled": if e.complexity.K8sActualNamespace.InstrumentationLabelEnabled == nil { break @@ -1489,20 +1411,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.K8sActualNamespace.Name(childComplexity), true - case "K8sActualSource.autoInstrumented": - if e.complexity.K8sActualSource.AutoInstrumented == nil { - break - } - - return e.complexity.K8sActualSource.AutoInstrumented(childComplexity), true - - case "K8sActualSource.autoInstrumentedDecision": - if e.complexity.K8sActualSource.AutoInstrumentedDecision == nil { - break - } - - return e.complexity.K8sActualSource.AutoInstrumentedDecision(childComplexity), true - case "K8sActualSource.instrumentedApplicationDetails": if e.complexity.K8sActualSource.InstrumentedApplicationDetails == nil { break @@ -1545,13 +1453,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.K8sActualSource.ReportedName(childComplexity), true - case "K8sActualSource.serviceName": - if e.complexity.K8sActualSource.ServiceName == nil { - break - } - - return e.complexity.K8sActualSource.ServiceName(childComplexity), true - case "LatencySamplerAction.details": if e.complexity.LatencySamplerAction.Details == nil { break @@ -2257,13 +2158,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.RuntimeInfoAnalyze.Containers(childComplexity), true - case "RuntimeInfoAnalyze.generation": - if e.complexity.RuntimeInfoAnalyze.Generation == nil { - break - } - - return e.complexity.RuntimeInfoAnalyze.Generation(childComplexity), true - case "SingleDestinationMetricsResponse.id": if e.complexity.SingleDestinationMetricsResponse.ID == nil { break @@ -2334,13 +2228,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.SourceAnalyze.InstrumentationDevice(childComplexity), true - case "SourceAnalyze.instrumentedApplication": - if e.complexity.SourceAnalyze.InstrumentedApplication == nil { - break - } - - return e.complexity.SourceAnalyze.InstrumentedApplication(childComplexity), true - case "SourceAnalyze.kind": if e.complexity.SourceAnalyze.Kind == nil { break @@ -4146,16 +4033,10 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSource(ctx con return ec.fieldContext_K8sActualSource_kind(ctx, field) case "name": return ec.fieldContext_K8sActualSource_name(ctx, field) - case "serviceName": - return ec.fieldContext_K8sActualSource_serviceName(ctx, field) case "numberOfInstances": return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) case "reportedName": return ec.fieldContext_K8sActualSource_reportedName(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - case "autoInstrumentedDecision": - return ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) case "instrumentedApplicationDetails": return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) } @@ -4221,16 +4102,10 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSources(_ cont return ec.fieldContext_K8sActualSource_kind(ctx, field) case "name": return ec.fieldContext_K8sActualSource_name(ctx, field) - case "serviceName": - return ec.fieldContext_K8sActualSource_serviceName(ctx, field) case "numberOfInstances": return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) case "reportedName": return ec.fieldContext_K8sActualSource_reportedName(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - case "autoInstrumentedDecision": - return ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) case "instrumentedApplicationDetails": return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) } @@ -8226,100 +8101,6 @@ func (ec *executionContext) fieldContext_InstrumentationLabelsAnalyze_instrument return fc, nil } -func (ec *executionContext) _InstrumentationLibrary_libraryName(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLibrary) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationLibrary_libraryName(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.LibraryName, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_InstrumentationLibrary_libraryName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "InstrumentationLibrary", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _InstrumentationLibrary_options(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLibrary) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationLibrary_options(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Options, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]*model.InstrumentationOption) - fc.Result = res - return ec.marshalNInstrumentationOption2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationOptionᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_InstrumentationLibrary_options(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "InstrumentationLibrary", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "optionKey": - return ec.fieldContext_InstrumentationOption_optionKey(ctx, field) - case "spanKind": - return ec.fieldContext_InstrumentationOption_spanKind(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type InstrumentationOption", field.Name) - }, - } - return fc, nil -} - func (ec *executionContext) _InstrumentationLibraryGlobalId_name(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLibraryGlobalID) (ret graphql.Marshaler) { fc, err := ec.fieldContext_InstrumentationLibraryGlobalId_name(ctx, field) if err != nil { @@ -8446,94 +8227,6 @@ func (ec *executionContext) fieldContext_InstrumentationLibraryGlobalId_language return fc, nil } -func (ec *executionContext) _InstrumentationOption_optionKey(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationOption) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationOption_optionKey(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.OptionKey, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_InstrumentationOption_optionKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "InstrumentationOption", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _InstrumentationOption_spanKind(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationOption) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationOption_spanKind(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SpanKind, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(model.SpanKind) - fc.Result = res - return ec.marshalNSpanKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSpanKind(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_InstrumentationOption_spanKind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "InstrumentationOption", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type SpanKind does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _InstrumentationRule_ruleId(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { fc, err := ec.fieldContext_InstrumentationRule_ruleId(ctx, field) if err != nil { @@ -8850,8 +8543,8 @@ func (ec *executionContext) fieldContext_InstrumentationRule_payloadCollection(_ return fc, nil } -func (ec *executionContext) _InstrumentedApplicationAnalyze_created(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationAnalyze_created(ctx, field) +func (ec *executionContext) _InstrumentedApplicationDetails_containers(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentedApplicationDetails_containers(ctx, field) if err != nil { return graphql.Null } @@ -8864,48 +8557,45 @@ func (ec *executionContext) _InstrumentedApplicationAnalyze_created(ctx context. }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Created, nil + return obj.Containers, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(*model.EntityProperty) + res := resTmp.([]*model.SourceContainerRuntimeDetails) fc.Result = res - return ec.marshalNEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) + return ec.marshalOSourceContainerRuntimeDetails2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceContainerRuntimeDetailsᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentedApplicationAnalyze_created(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_containers(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentedApplicationAnalyze", + Object: "InstrumentedApplicationDetails", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "name": - return ec.fieldContext_EntityProperty_name(ctx, field) - case "value": - return ec.fieldContext_EntityProperty_value(ctx, field) - case "status": - return ec.fieldContext_EntityProperty_status(ctx, field) - case "explain": - return ec.fieldContext_EntityProperty_explain(ctx, field) + case "containerName": + return ec.fieldContext_SourceContainerRuntimeDetails_containerName(ctx, field) + case "language": + return ec.fieldContext_SourceContainerRuntimeDetails_language(ctx, field) + case "runtimeVersion": + return ec.fieldContext_SourceContainerRuntimeDetails_runtimeVersion(ctx, field) + case "otherAgent": + return ec.fieldContext_SourceContainerRuntimeDetails_otherAgent(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) + return nil, fmt.Errorf("no field named %q was found under type SourceContainerRuntimeDetails", field.Name) }, } return fc, nil } -func (ec *executionContext) _InstrumentedApplicationAnalyze_createTime(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationAnalyze_createTime(ctx, field) +func (ec *executionContext) _InstrumentedApplicationDetails_conditions(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) if err != nil { return graphql.Null } @@ -8918,7 +8608,7 @@ func (ec *executionContext) _InstrumentedApplicationAnalyze_createTime(ctx conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.CreateTime, nil + return obj.Conditions, nil }) if err != nil { ec.Error(ctx, err) @@ -8927,163 +8617,7 @@ func (ec *executionContext) _InstrumentedApplicationAnalyze_createTime(ctx conte if resTmp == nil { return graphql.Null } - res := resTmp.(*model.EntityProperty) - fc.Result = res - return ec.marshalOEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_InstrumentedApplicationAnalyze_createTime(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "InstrumentedApplicationAnalyze", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_EntityProperty_name(ctx, field) - case "value": - return ec.fieldContext_EntityProperty_value(ctx, field) - case "status": - return ec.fieldContext_EntityProperty_status(ctx, field) - case "explain": - return ec.fieldContext_EntityProperty_explain(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _InstrumentedApplicationAnalyze_containers(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationAnalyze_containers(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Containers, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]*model.ContainerRuntimeInfoAnalyze) - fc.Result = res - return ec.marshalNContainerRuntimeInfoAnalyze2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐContainerRuntimeInfoAnalyzeᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_InstrumentedApplicationAnalyze_containers(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "InstrumentedApplicationAnalyze", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "containerName": - return ec.fieldContext_ContainerRuntimeInfoAnalyze_containerName(ctx, field) - case "language": - return ec.fieldContext_ContainerRuntimeInfoAnalyze_language(ctx, field) - case "runtimeVersion": - return ec.fieldContext_ContainerRuntimeInfoAnalyze_runtimeVersion(ctx, field) - case "envVars": - return ec.fieldContext_ContainerRuntimeInfoAnalyze_envVars(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ContainerRuntimeInfoAnalyze", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _InstrumentedApplicationDetails_containers(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationDetails_containers(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Containers, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]*model.SourceContainerRuntimeDetails) - fc.Result = res - return ec.marshalOSourceContainerRuntimeDetails2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceContainerRuntimeDetailsᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_containers(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "InstrumentedApplicationDetails", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "containerName": - return ec.fieldContext_SourceContainerRuntimeDetails_containerName(ctx, field) - case "language": - return ec.fieldContext_SourceContainerRuntimeDetails_language(ctx, field) - case "runtimeVersion": - return ec.fieldContext_SourceContainerRuntimeDetails_runtimeVersion(ctx, field) - case "otherAgent": - return ec.fieldContext_SourceContainerRuntimeDetails_otherAgent(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type SourceContainerRuntimeDetails", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _InstrumentedApplicationDetails_conditions(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Conditions, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]*model.Condition) + res := resTmp.([]*model.Condition) fc.Result = res return ec.marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionᚄ(ctx, field.Selections, res) } @@ -9113,56 +8647,6 @@ func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_conditio return fc, nil } -func (ec *executionContext) _InstrumentedApplicationDetails_instrumentationOptions(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationDetails_instrumentationOptions(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.InstrumentationOptions, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]*model.InstrumentationLibrary) - fc.Result = res - return ec.marshalNInstrumentationLibrary2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationLibraryᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_instrumentationOptions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "InstrumentedApplicationDetails", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "libraryName": - return ec.fieldContext_InstrumentationLibrary_libraryName(ctx, field) - case "options": - return ec.fieldContext_InstrumentationLibrary_options(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type InstrumentationLibrary", field.Name) - }, - } - return fc, nil -} - func (ec *executionContext) _K8sActualNamespace_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { fc, err := ec.fieldContext_K8sActualNamespace_name(ctx, field) if err != nil { @@ -9293,16 +8777,10 @@ func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(ctx return ec.fieldContext_K8sActualSource_kind(ctx, field) case "name": return ec.fieldContext_K8sActualSource_name(ctx, field) - case "serviceName": - return ec.fieldContext_K8sActualSource_serviceName(ctx, field) case "numberOfInstances": return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) case "reportedName": return ec.fieldContext_K8sActualSource_reportedName(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - case "autoInstrumentedDecision": - return ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) case "instrumentedApplicationDetails": return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) } @@ -9455,47 +8933,6 @@ func (ec *executionContext) fieldContext_K8sActualSource_name(_ context.Context, return fc, nil } -func (ec *executionContext) _K8sActualSource_serviceName(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_serviceName(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ServiceName, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_K8sActualSource_serviceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "K8sActualSource", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _K8sActualSource_numberOfInstances(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { fc, err := ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) if err != nil { @@ -9578,94 +9015,6 @@ func (ec *executionContext) fieldContext_K8sActualSource_reportedName(_ context. return fc, nil } -func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.AutoInstrumented, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "K8sActualSource", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _K8sActualSource_autoInstrumentedDecision(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.AutoInstrumentedDecision, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumentedDecision(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "K8sActualSource", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _K8sActualSource_instrumentedApplicationDetails(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { fc, err := ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) if err != nil { @@ -9706,8 +9055,6 @@ func (ec *executionContext) fieldContext_K8sActualSource_instrumentedApplication return ec.fieldContext_InstrumentedApplicationDetails_containers(ctx, field) case "conditions": return ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) - case "instrumentationOptions": - return ec.fieldContext_InstrumentedApplicationDetails_instrumentationOptions(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type InstrumentedApplicationDetails", field.Name) }, @@ -13825,8 +13172,6 @@ func (ec *executionContext) fieldContext_Query_describeSource(ctx context.Contex return ec.fieldContext_SourceAnalyze_instrumentationConfig(ctx, field) case "runtimeInfo": return ec.fieldContext_SourceAnalyze_runtimeInfo(ctx, field) - case "instrumentedApplication": - return ec.fieldContext_SourceAnalyze_instrumentedApplication(ctx, field) case "instrumentationDevice": return ec.fieldContext_SourceAnalyze_instrumentationDevice(ctx, field) case "totalPods": @@ -14284,60 +13629,6 @@ func (ec *executionContext) fieldContext_RenameAttributeAction_details(_ context return fc, nil } -func (ec *executionContext) _RuntimeInfoAnalyze_generation(ctx context.Context, field graphql.CollectedField, obj *model.RuntimeInfoAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_RuntimeInfoAnalyze_generation(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Generation, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*model.EntityProperty) - fc.Result = res - return ec.marshalNEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_RuntimeInfoAnalyze_generation(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "RuntimeInfoAnalyze", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_EntityProperty_name(ctx, field) - case "value": - return ec.fieldContext_EntityProperty_value(ctx, field) - case "status": - return ec.fieldContext_EntityProperty_status(ctx, field) - case "explain": - return ec.fieldContext_EntityProperty_explain(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) - }, - } - return fc, nil -} - func (ec *executionContext) _RuntimeInfoAnalyze_containers(ctx context.Context, field graphql.CollectedField, obj *model.RuntimeInfoAnalyze) (ret graphql.Marshaler) { fc, err := ec.fieldContext_RuntimeInfoAnalyze_containers(ctx, field) if err != nil { @@ -15010,55 +14301,8 @@ func (ec *executionContext) fieldContext_SourceAnalyze_instrumentationConfig(_ c return fc, nil } -func (ec *executionContext) _SourceAnalyze_runtimeInfo(ctx context.Context, field graphql.CollectedField, obj *model.SourceAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_SourceAnalyze_runtimeInfo(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.RuntimeInfo, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.RuntimeInfoAnalyze) - fc.Result = res - return ec.marshalORuntimeInfoAnalyze2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐRuntimeInfoAnalyze(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_SourceAnalyze_runtimeInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "SourceAnalyze", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "generation": - return ec.fieldContext_RuntimeInfoAnalyze_generation(ctx, field) - case "containers": - return ec.fieldContext_RuntimeInfoAnalyze_containers(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type RuntimeInfoAnalyze", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _SourceAnalyze_instrumentedApplication(ctx context.Context, field graphql.CollectedField, obj *model.SourceAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_SourceAnalyze_instrumentedApplication(ctx, field) +func (ec *executionContext) _SourceAnalyze_runtimeInfo(ctx context.Context, field graphql.CollectedField, obj *model.SourceAnalyze) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SourceAnalyze_runtimeInfo(ctx, field) if err != nil { return graphql.Null } @@ -15071,24 +14315,21 @@ func (ec *executionContext) _SourceAnalyze_instrumentedApplication(ctx context.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InstrumentedApplication, nil + return obj.RuntimeInfo, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(*model.InstrumentedApplicationAnalyze) + res := resTmp.(*model.RuntimeInfoAnalyze) fc.Result = res - return ec.marshalNInstrumentedApplicationAnalyze2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentedApplicationAnalyze(ctx, field.Selections, res) + return ec.marshalORuntimeInfoAnalyze2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐRuntimeInfoAnalyze(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SourceAnalyze_instrumentedApplication(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SourceAnalyze_runtimeInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SourceAnalyze", Field: field, @@ -15096,14 +14337,10 @@ func (ec *executionContext) fieldContext_SourceAnalyze_instrumentedApplication(_ IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "created": - return ec.fieldContext_InstrumentedApplicationAnalyze_created(ctx, field) - case "createTime": - return ec.fieldContext_InstrumentedApplicationAnalyze_createTime(ctx, field) case "containers": - return ec.fieldContext_InstrumentedApplicationAnalyze_containers(ctx, field) + return ec.fieldContext_RuntimeInfoAnalyze_containers(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type InstrumentedApplicationAnalyze", field.Name) + return nil, fmt.Errorf("no field named %q was found under type RuntimeInfoAnalyze", field.Name) }, } return fc, nil @@ -20031,50 +19268,6 @@ func (ec *executionContext) _InstrumentationLabelsAnalyze(ctx context.Context, s return out } -var instrumentationLibraryImplementors = []string{"InstrumentationLibrary"} - -func (ec *executionContext) _InstrumentationLibrary(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentationLibrary) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, instrumentationLibraryImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("InstrumentationLibrary") - case "libraryName": - out.Values[i] = ec._InstrumentationLibrary_libraryName(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "options": - out.Values[i] = ec._InstrumentationLibrary_options(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - var instrumentationLibraryGlobalIdImplementors = []string{"InstrumentationLibraryGlobalId"} func (ec *executionContext) _InstrumentationLibraryGlobalId(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentationLibraryGlobalID) graphql.Marshaler { @@ -20118,50 +19311,6 @@ func (ec *executionContext) _InstrumentationLibraryGlobalId(ctx context.Context, return out } -var instrumentationOptionImplementors = []string{"InstrumentationOption"} - -func (ec *executionContext) _InstrumentationOption(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentationOption) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, instrumentationOptionImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("InstrumentationOption") - case "optionKey": - out.Values[i] = ec._InstrumentationOption_optionKey(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "spanKind": - out.Values[i] = ec._InstrumentationOption_spanKind(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - var instrumentationRuleImplementors = []string{"InstrumentationRule"} func (ec *executionContext) _InstrumentationRule(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentationRule) graphql.Marshaler { @@ -20213,52 +19362,6 @@ func (ec *executionContext) _InstrumentationRule(ctx context.Context, sel ast.Se return out } -var instrumentedApplicationAnalyzeImplementors = []string{"InstrumentedApplicationAnalyze"} - -func (ec *executionContext) _InstrumentedApplicationAnalyze(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentedApplicationAnalyze) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, instrumentedApplicationAnalyzeImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("InstrumentedApplicationAnalyze") - case "created": - out.Values[i] = ec._InstrumentedApplicationAnalyze_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "createTime": - out.Values[i] = ec._InstrumentedApplicationAnalyze_createTime(ctx, field, obj) - case "containers": - out.Values[i] = ec._InstrumentedApplicationAnalyze_containers(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - var instrumentedApplicationDetailsImplementors = []string{"InstrumentedApplicationDetails"} func (ec *executionContext) _InstrumentedApplicationDetails(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentedApplicationDetails) graphql.Marshaler { @@ -20274,11 +19377,6 @@ func (ec *executionContext) _InstrumentedApplicationDetails(ctx context.Context, out.Values[i] = ec._InstrumentedApplicationDetails_containers(ctx, field, obj) case "conditions": out.Values[i] = ec._InstrumentedApplicationDetails_conditions(ctx, field, obj) - case "instrumentationOptions": - out.Values[i] = ec._InstrumentedApplicationDetails_instrumentationOptions(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -20405,22 +19503,10 @@ func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.Select if out.Values[i] == graphql.Null { out.Invalids++ } - case "serviceName": - out.Values[i] = ec._K8sActualSource_serviceName(ctx, field, obj) case "numberOfInstances": out.Values[i] = ec._K8sActualSource_numberOfInstances(ctx, field, obj) case "reportedName": out.Values[i] = ec._K8sActualSource_reportedName(ctx, field, obj) - case "autoInstrumented": - out.Values[i] = ec._K8sActualSource_autoInstrumented(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "autoInstrumentedDecision": - out.Values[i] = ec._K8sActualSource_autoInstrumentedDecision(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } case "instrumentedApplicationDetails": out.Values[i] = ec._K8sActualSource_instrumentedApplicationDetails(ctx, field, obj) default: @@ -21551,11 +20637,6 @@ func (ec *executionContext) _RuntimeInfoAnalyze(ctx context.Context, sel ast.Sel switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("RuntimeInfoAnalyze") - case "generation": - out.Values[i] = ec._RuntimeInfoAnalyze_generation(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } case "containers": out.Values[i] = ec._RuntimeInfoAnalyze_containers(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -21730,11 +20811,6 @@ func (ec *executionContext) _SourceAnalyze(ctx context.Context, sel ast.Selectio } case "runtimeInfo": out.Values[i] = ec._SourceAnalyze_runtimeInfo(ctx, field, obj) - case "instrumentedApplication": - out.Values[i] = ec._SourceAnalyze_instrumentedApplication(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } case "instrumentationDevice": out.Values[i] = ec._SourceAnalyze_instrumentationDevice(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -23001,60 +22077,6 @@ func (ec *executionContext) marshalNInstrumentationLabelsAnalyze2ᚖgithubᚗcom return ec._InstrumentationLabelsAnalyze(ctx, sel, v) } -func (ec *executionContext) marshalNInstrumentationLibrary2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationLibraryᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.InstrumentationLibrary) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNInstrumentationLibrary2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationLibrary(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNInstrumentationLibrary2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationLibrary(ctx context.Context, sel ast.SelectionSet, v *model.InstrumentationLibrary) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._InstrumentationLibrary(ctx, sel, v) -} - func (ec *executionContext) marshalNInstrumentationLibraryGlobalId2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationLibraryGlobalID(ctx context.Context, sel ast.SelectionSet, v *model.InstrumentationLibraryGlobalID) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -23070,60 +22092,6 @@ func (ec *executionContext) unmarshalNInstrumentationLibraryGlobalIdInput2ᚖgit return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNInstrumentationOption2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationOptionᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.InstrumentationOption) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNInstrumentationOption2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationOption(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNInstrumentationOption2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationOption(ctx context.Context, sel ast.SelectionSet, v *model.InstrumentationOption) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._InstrumentationOption(ctx, sel, v) -} - func (ec *executionContext) marshalNInstrumentationRule2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationRule(ctx context.Context, sel ast.SelectionSet, v model.InstrumentationRule) graphql.Marshaler { return ec._InstrumentationRule(ctx, sel, &v) } @@ -23187,16 +22155,6 @@ func (ec *executionContext) unmarshalNInstrumentationRuleInput2githubᚗcomᚋod return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNInstrumentedApplicationAnalyze2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentedApplicationAnalyze(ctx context.Context, sel ast.SelectionSet, v *model.InstrumentedApplicationAnalyze) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._InstrumentedApplicationAnalyze(ctx, sel, v) -} - func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { res, err := graphql.UnmarshalInt(v) return res, graphql.ErrorOnPath(ctx, err) @@ -23757,16 +22715,6 @@ func (ec *executionContext) marshalNSourceContainerRuntimeDetails2ᚖgithubᚗco return ec._SourceContainerRuntimeDetails(ctx, sel, v) } -func (ec *executionContext) unmarshalNSpanKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSpanKind(ctx context.Context, v interface{}) (model.SpanKind, error) { - var res model.SpanKind - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNSpanKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSpanKind(ctx context.Context, sel ast.SelectionSet, v model.SpanKind) graphql.Marshaler { - return v -} - func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index d5407efa3..624015ed0 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -264,11 +264,6 @@ type InstrumentationLabelsAnalyze struct { InstrumentedText *EntityProperty `json:"instrumentedText,omitempty"` } -type InstrumentationLibrary struct { - LibraryName string `json:"libraryName"` - Options []*InstrumentationOption `json:"options"` -} - type InstrumentationLibraryGlobalID struct { Name string `json:"name"` SpanKind *SpanKind `json:"spanKind,omitempty"` @@ -281,11 +276,6 @@ type InstrumentationLibraryGlobalIDInput struct { Language *ProgrammingLanguage `json:"language,omitempty"` } -type InstrumentationOption struct { - OptionKey string `json:"optionKey"` - SpanKind SpanKind `json:"spanKind"` -} - type InstrumentationRule struct { RuleID string `json:"ruleId"` RuleName *string `json:"ruleName,omitempty"` @@ -305,16 +295,9 @@ type InstrumentationRuleInput struct { PayloadCollection *PayloadCollectionInput `json:"payloadCollection,omitempty"` } -type InstrumentedApplicationAnalyze struct { - Created *EntityProperty `json:"created"` - CreateTime *EntityProperty `json:"createTime,omitempty"` - Containers []*ContainerRuntimeInfoAnalyze `json:"containers"` -} - type InstrumentedApplicationDetails struct { - Containers []*SourceContainerRuntimeDetails `json:"containers,omitempty"` - Conditions []*Condition `json:"conditions,omitempty"` - InstrumentationOptions []*InstrumentationLibrary `json:"instrumentationOptions"` + Containers []*SourceContainerRuntimeDetails `json:"containers,omitempty"` + Conditions []*Condition `json:"conditions,omitempty"` } type K8sActualNamespace struct { @@ -327,11 +310,8 @@ type K8sActualSource struct { Namespace string `json:"namespace"` Kind K8sResourceKind `json:"kind"` Name string `json:"name"` - ServiceName *string `json:"serviceName,omitempty"` NumberOfInstances *int `json:"numberOfInstances,omitempty"` ReportedName *string `json:"reportedName,omitempty"` - AutoInstrumented bool `json:"autoInstrumented"` - AutoInstrumentedDecision string `json:"autoInstrumentedDecision"` InstrumentedApplicationDetails *InstrumentedApplicationDetails `json:"instrumentedApplicationDetails,omitempty"` } @@ -568,7 +548,6 @@ func (this RenameAttributeAction) GetSignals() []SignalType { } type RuntimeInfoAnalyze struct { - Generation *EntityProperty `json:"generation"` Containers []*ContainerRuntimeInfoAnalyze `json:"containers"` } @@ -587,17 +566,16 @@ type SingleSourceMetricsResponse struct { } type SourceAnalyze struct { - Name *EntityProperty `json:"name"` - Kind *EntityProperty `json:"kind"` - Namespace *EntityProperty `json:"namespace"` - Labels *InstrumentationLabelsAnalyze `json:"labels"` - InstrumentationConfig *InstrumentationConfigAnalyze `json:"instrumentationConfig"` - RuntimeInfo *RuntimeInfoAnalyze `json:"runtimeInfo,omitempty"` - InstrumentedApplication *InstrumentedApplicationAnalyze `json:"instrumentedApplication"` - InstrumentationDevice *InstrumentationDeviceAnalyze `json:"instrumentationDevice"` - TotalPods int `json:"totalPods"` - PodsPhasesCount string `json:"podsPhasesCount"` - Pods []*PodAnalyze `json:"pods"` + Name *EntityProperty `json:"name"` + Kind *EntityProperty `json:"kind"` + Namespace *EntityProperty `json:"namespace"` + Labels *InstrumentationLabelsAnalyze `json:"labels"` + InstrumentationConfig *InstrumentationConfigAnalyze `json:"instrumentationConfig"` + RuntimeInfo *RuntimeInfoAnalyze `json:"runtimeInfo,omitempty"` + InstrumentationDevice *InstrumentationDeviceAnalyze `json:"instrumentationDevice"` + TotalPods int `json:"totalPods"` + PodsPhasesCount string `json:"podsPhasesCount"` + Pods []*PodAnalyze `json:"pods"` } type SourceContainerRuntimeDetails struct { diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 3fb7b0f4d..0209cd9e8 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -51,20 +51,9 @@ type SourceContainerRuntimeDetails { otherAgent: String } -type InstrumentationOption { - optionKey: String! - spanKind: SpanKind! -} - -type InstrumentationLibrary { - libraryName: String! - options: [InstrumentationOption!]! -} - type InstrumentedApplicationDetails { containers: [SourceContainerRuntimeDetails!] conditions: [Condition!] - instrumentationOptions: [InstrumentationLibrary!]! } type Condition { @@ -93,11 +82,8 @@ type K8sActualSource { namespace: String! kind: K8sResourceKind! name: String! - serviceName: String numberOfInstances: Int reportedName: String - autoInstrumented: Boolean! - autoInstrumentedDecision: String! instrumentedApplicationDetails: InstrumentedApplicationDetails } @@ -479,13 +465,6 @@ type ContainerRuntimeInfoAnalyze { } type RuntimeInfoAnalyze { - generation: EntityProperty! - containers: [ContainerRuntimeInfoAnalyze!]! -} - -type InstrumentedApplicationAnalyze { - created: EntityProperty! - createTime: EntityProperty containers: [ContainerRuntimeInfoAnalyze!]! } @@ -527,7 +506,6 @@ type SourceAnalyze { instrumentationConfig: InstrumentationConfigAnalyze! runtimeInfo: RuntimeInfoAnalyze - instrumentedApplication: InstrumentedApplicationAnalyze! instrumentationDevice: InstrumentationDeviceAnalyze! totalPods: Int! diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index ffddced75..6eb08d550 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -81,7 +81,7 @@ func (r *computePlatformResolver) K8sActualSource(ctx context.Context, obj *mode // K8sActualSources is the resolver for the k8sActualSources field. func (r *computePlatformResolver) K8sActualSources(ctx context.Context, obj *model.ComputePlatform) ([]*model.K8sActualSource, error) { - instrumentedApplications, err := kube.DefaultClient.OdigosClient.InstrumentedApplications("").List(ctx, metav1.ListOptions{}) + instrumentationConfigs, err := kube.DefaultClient.OdigosClient.InstrumentationConfigs("").List(ctx, metav1.ListOptions{}) if err != nil { return nil, err } @@ -90,9 +90,9 @@ func (r *computePlatformResolver) K8sActualSources(ctx context.Context, obj *mod var actualSources []*model.K8sActualSource // Convert each instrumented application to the K8sActualSource type - for _, app := range instrumentedApplications.Items { - actualSource := instrumentedApplicationToActualSource(app) - services.AddHealthyInstrumentationInstancesCondition(ctx, &app, actualSource) + for _, ic := range instrumentationConfigs.Items { + actualSource := instrumentationConfigToActualSource(ic) + services.AddHealthyInstrumentationInstancesCondition(ctx, &ic, actualSource) owner, _ := services.GetWorkload(ctx, actualSource.Namespace, string(actualSource.Kind), actualSource.Name) if owner == nil { diff --git a/frontend/services/describe/source_describe/source_describe.go b/frontend/services/describe/source_describe/source_describe.go index b422e9836..f61e48c1a 100644 --- a/frontend/services/describe/source_describe/source_describe.go +++ b/frontend/services/describe/source_describe/source_describe.go @@ -55,11 +55,6 @@ func ConvertSourceAnalyzeToGQL(analyze *source.SourceAnalyze) *model.SourceAnaly CreateTime: describe_utils.ConvertEntityPropertyToGQL(analyze.InstrumentationConfig.CreateTime), }, RuntimeInfo: convertRuntimeInfoToGQL(analyze.RuntimeInfo), - InstrumentedApplication: &model.InstrumentedApplicationAnalyze{ - Created: describe_utils.ConvertEntityPropertyToGQL(&analyze.InstrumentedApplication.Created), - CreateTime: describe_utils.ConvertEntityPropertyToGQL(analyze.InstrumentedApplication.CreateTime), - Containers: convertRuntimeInfoContainersToGQL(analyze.InstrumentedApplication.Containers), - }, InstrumentationDevice: &model.InstrumentationDeviceAnalyze{ StatusText: describe_utils.ConvertEntityPropertyToGQL(&analyze.InstrumentationDevice.StatusText), Containers: convertWorkloadManifestContainersToGQL(analyze.InstrumentationDevice.Containers), @@ -75,7 +70,6 @@ func convertRuntimeInfoToGQL(info *source.RuntimeInfoAnalyze) *model.RuntimeInfo return nil } return &model.RuntimeInfoAnalyze{ - Generation: describe_utils.ConvertEntityPropertyToGQL(&info.Generation), Containers: convertRuntimeInfoContainersToGQL(info.Containers), } } diff --git a/frontend/services/sources.go b/frontend/services/sources.go index 9549fba7a..d596c3dfa 100644 --- a/frontend/services/sources.go +++ b/frontend/services/sources.go @@ -87,9 +87,9 @@ func GetWorkload(c context.Context, ns string, kind string, name string) (metav1 } } -func AddHealthyInstrumentationInstancesCondition(ctx context.Context, app *v1alpha1.InstrumentedApplication, source *model.K8sActualSource) error { - labelSelector := fmt.Sprintf("%s=%s", consts.InstrumentedAppNameLabel, app.Name) - instancesList, err := kube.DefaultClient.OdigosClient.InstrumentationInstances(app.Namespace).List(ctx, metav1.ListOptions{ +func AddHealthyInstrumentationInstancesCondition(ctx context.Context, instConfig *v1alpha1.InstrumentationConfig, source *model.K8sActualSource) error { + labelSelector := fmt.Sprintf("%s=%s", consts.InstrumentedAppNameLabel, instConfig.Name) + instancesList, err := kube.DefaultClient.OdigosClient.InstrumentationInstances(instConfig.Namespace).List(ctx, metav1.ListOptions{ LabelSelector: labelSelector, }) @@ -179,7 +179,7 @@ func getDeployments(ctx context.Context, namespace corev1.Namespace, instrumenta var response []model.K8sActualSource err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().Deployments(namespace.Name).List, ctx, metav1.ListOptions{}, func(deps *appsv1.DeploymentList) error { for _, dep := range deps.Items { - _, _, decisionText, autoInstrumented := workload.GetInstrumentationLabelTexts(dep.GetLabels(), string(WorkloadKindDeployment), namespace.GetLabels()) + _, _, _, autoInstrumented := workload.GetInstrumentationLabelTexts(dep.GetLabels(), string(WorkloadKindDeployment), namespace.GetLabels()) if instrumentationLabeled != nil && *instrumentationLabeled != autoInstrumented { continue } @@ -189,9 +189,6 @@ func getDeployments(ctx context.Context, namespace corev1.Namespace, instrumenta Name: dep.Name, Kind: k8sKindToGql(string(WorkloadKindDeployment)), NumberOfInstances: &numberOfInstances, - AutoInstrumented: autoInstrumented, - AutoInstrumentedDecision: decisionText, - InstrumentedApplicationDetails: nil, // TODO: fill this }) } return nil @@ -208,7 +205,7 @@ func getDaemonSets(ctx context.Context, namespace corev1.Namespace, instrumentat var response []model.K8sActualSource err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().DaemonSets(namespace.Name).List, ctx, metav1.ListOptions{}, func(dss *appsv1.DaemonSetList) error { for _, ds := range dss.Items { - _, _, decisionText, autoInstrumented := workload.GetInstrumentationLabelTexts(ds.GetLabels(), string(WorkloadKindDaemonSet), namespace.GetLabels()) + _, _, _, autoInstrumented := workload.GetInstrumentationLabelTexts(ds.GetLabels(), string(WorkloadKindDaemonSet), namespace.GetLabels()) if instrumentationLabeled != nil && *instrumentationLabeled != autoInstrumented { continue } @@ -218,9 +215,6 @@ func getDaemonSets(ctx context.Context, namespace corev1.Namespace, instrumentat Name: ds.Name, Kind: k8sKindToGql(string(WorkloadKindDaemonSet)), NumberOfInstances: &numberOfInstances, - AutoInstrumented: autoInstrumented, - AutoInstrumentedDecision: decisionText, - InstrumentedApplicationDetails: nil, // TODO: fill this }) } return nil @@ -237,7 +231,7 @@ func getStatefulSets(ctx context.Context, namespace corev1.Namespace, instrument var response []model.K8sActualSource err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().StatefulSets(namespace.Name).List, ctx, metav1.ListOptions{}, func(sss *appsv1.StatefulSetList) error { for _, ss := range sss.Items { - _, _, decisionText, autoInstrumented := workload.GetInstrumentationLabelTexts(ss.GetLabels(), string(WorkloadKindStatefulSet), namespace.GetLabels()) + _, _, _, autoInstrumented := workload.GetInstrumentationLabelTexts(ss.GetLabels(), string(WorkloadKindStatefulSet), namespace.GetLabels()) if instrumentationLabeled != nil && *instrumentationLabeled != autoInstrumented { continue } @@ -247,9 +241,6 @@ func getStatefulSets(ctx context.Context, namespace corev1.Namespace, instrument Name: ss.Name, Kind: k8sKindToGql(string(WorkloadKindStatefulSet)), NumberOfInstances: &numberOfInstances, - AutoInstrumented: autoInstrumented, - AutoInstrumentedDecision: decisionText, - InstrumentedApplicationDetails: nil, // TODO: fill this }) } return nil diff --git a/frontend/webapp/graphql/queries/describe.ts b/frontend/webapp/graphql/queries/describe.ts index 1280a312e..9fda73894 100644 --- a/frontend/webapp/graphql/queries/describe.ts +++ b/frontend/webapp/graphql/queries/describe.ts @@ -203,52 +203,6 @@ export const DESCRIBE_SOURCE = gql` } } runtimeInfo { - generation { - name - value - status - explain - } - containers { - containerName { - name - value - status - explain - } - language { - name - value - status - explain - } - runtimeVersion { - name - value - status - explain - } - envVars { - name - value - status - explain - } - } - } - instrumentedApplication { - created { - name - value - status - explain - } - createTime { - name - value - status - explain - } containers { containerName { name diff --git a/frontend/webapp/types/describe.ts b/frontend/webapp/types/describe.ts index ead5c51e0..862ef8c5a 100644 --- a/frontend/webapp/types/describe.ts +++ b/frontend/webapp/types/describe.ts @@ -25,13 +25,6 @@ interface ContainerRuntimeInfoAnalyze { } interface RuntimeInfoAnalyze { - generation: EntityProperty; - containers: ContainerRuntimeInfoAnalyze[]; -} - -interface InstrumentedApplicationAnalyze { - created: EntityProperty; - createTime?: EntityProperty; containers: ContainerRuntimeInfoAnalyze[]; } @@ -73,7 +66,6 @@ interface SourceAnalyze { instrumentationConfig: InstrumentationConfigAnalyze; runtimeInfo?: RuntimeInfoAnalyze; - instrumentedApplication: InstrumentedApplicationAnalyze; instrumentationDevice: InstrumentationDeviceAnalyze; totalPods: number; diff --git a/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml b/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml index 8fb450866..1f16bc4d0 100644 --- a/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml +++ b/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml @@ -423,6 +423,64 @@ spec: type: object status: properties: + conditions: + description: Represents the observations of a InstrumentationConfig's + current state. + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array runtimeDetailsByContainer: description: Capture Runtime Details for the workloads that this CR applies to. diff --git a/helm/odigos/templates/instrumentor/clusterrole.yaml b/helm/odigos/templates/instrumentor/clusterrole.yaml index f5fdeb791..d5e06da5e 100644 --- a/helm/odigos/templates/instrumentor/clusterrole.yaml +++ b/helm/odigos/templates/instrumentor/clusterrole.yaml @@ -61,7 +61,7 @@ rules: - apiGroups: - odigos.io resources: - - instrumentedapplications/status + - instrumentationconfigs/status verbs: - get - patch @@ -78,9 +78,4 @@ rules: - patch - update - watch - - apiGroups: - - odigos.io - resources: - - instrumentationconfigs/status - verbs: - - update + diff --git a/instrumentor/controllers/instrumentationdevice/collectorsgroup_controller.go b/instrumentor/controllers/instrumentationdevice/collectorsgroup_controller.go index dea2bef09..d46c77d68 100644 --- a/instrumentor/controllers/instrumentationdevice/collectorsgroup_controller.go +++ b/instrumentor/controllers/instrumentationdevice/collectorsgroup_controller.go @@ -43,7 +43,7 @@ func (r *CollectorsGroupReconciler) Reconcile(ctx context.Context, req ctrl.Requ logger := log.FromContext(ctx) isDataCollectionReady := isDataCollectionReady(ctx, r.Client) - var instApps odigosv1.InstrumentedApplicationList + var instApps odigosv1.InstrumentationConfigList if err := r.List(ctx, &instApps); err != nil { return ctrl.Result{}, err } @@ -54,7 +54,7 @@ func (r *CollectorsGroupReconciler) Reconcile(ctx context.Context, req ctrl.Requ var gotConflict bool for _, runtimeDetails := range instApps.Items { - var currentInstApp odigosv1.InstrumentedApplication + var currentInstApp odigosv1.InstrumentationConfig err := r.Get(ctx, client.ObjectKey{Namespace: runtimeDetails.Namespace, Name: runtimeDetails.Name}, ¤tInstApp) if apierrors.IsNotFound(err) { // the loop can take time, so the instrumented application might get deleted diff --git a/instrumentor/controllers/instrumentationdevice/common.go b/instrumentor/controllers/instrumentationdevice/common.go index 6f222e70d..c7cbe0747 100644 --- a/instrumentor/controllers/instrumentationdevice/common.go +++ b/instrumentor/controllers/instrumentationdevice/common.go @@ -65,13 +65,13 @@ func isDataCollectionReady(ctx context.Context, c client.Client) bool { return nodeCollectorsGroup.Status.Ready } -func addInstrumentationDeviceToWorkload(ctx context.Context, kubeClient client.Client, instApp *odigosv1.InstrumentedApplication) (error, bool) { +func addInstrumentationDeviceToWorkload(ctx context.Context, kubeClient client.Client, instConfig *odigosv1.InstrumentationConfig) (error, bool) { // devicePartiallyApplied is used to indicate that the instrumentation device was partially applied for some of the containers. devicePartiallyApplied := false deviceNotAppliedDueToPresenceOfAnotherAgent := false logger := log.FromContext(ctx) - obj, err := getWorkloadObject(ctx, kubeClient, instApp) + obj, err := getWorkloadObject(ctx, kubeClient, instConfig) if err != nil { return err, false } @@ -132,7 +132,7 @@ func addInstrumentationDeviceToWorkload(ctx context.Context, kubeClient client.C agentsCanRunConcurrently = *odigosConfiguration.AllowConcurrentAgents } - err, deviceApplied, deviceSkippedDueToOtherAgent := instrumentation.ApplyInstrumentationDevicesToPodTemplate(podSpec, instApp.Spec.RuntimeDetails, otelSdkToUse, obj, logger, agentsCanRunConcurrently) + err, deviceApplied, deviceSkippedDueToOtherAgent := instrumentation.ApplyInstrumentationDevicesToPodTemplate(podSpec, instConfig.Status.RuntimeDetailsByContainer, otelSdkToUse, obj, logger, agentsCanRunConcurrently) if err != nil { return err } @@ -212,8 +212,8 @@ func removeInstrumentationDeviceFromWorkload(ctx context.Context, kubeClient cli return nil } -func getWorkloadObject(ctx context.Context, kubeClient client.Client, runtimeDetails *odigosv1.InstrumentedApplication) (client.Object, error) { - name, kind, err := workload.ExtractWorkloadInfoFromRuntimeObjectName(runtimeDetails.Name) +func getWorkloadObject(ctx context.Context, kubeClient client.Client, instConfig *odigosv1.InstrumentationConfig) (client.Object, error) { + name, kind, err := workload.ExtractWorkloadInfoFromRuntimeObjectName(instConfig.Name) if err != nil { return nil, err } @@ -224,7 +224,7 @@ func getWorkloadObject(ctx context.Context, kubeClient client.Client, runtimeDet } err = kubeClient.Get(ctx, client.ObjectKey{ - Namespace: runtimeDetails.Namespace, + Namespace: instConfig.Namespace, Name: name, }, workloadObject) if err != nil { @@ -249,46 +249,41 @@ func getPodSpecFromObject(obj client.Object) (*corev1.PodTemplateSpec, error) { // reconciles a single workload, which might be triggered by a change in multiple resources. // each time a relevant resource changes, this function is called to reconcile the workload -// and always writes the status into the InstrumentedApplication CR -func reconcileSingleWorkload(ctx context.Context, kubeClient client.Client, instrumentedApplication *odigosv1.InstrumentedApplication, isNodeCollectorReady bool) error { +// and always writes the status into the InstrumentationConfig CR +func reconcileSingleWorkload(ctx context.Context, kubeClient client.Client, instrumentationConfig *odigosv1.InstrumentationConfig, isNodeCollectorReady bool) error { + // RuntimeDetailsByContainer will be empty for short period until the first language detection is executed + if len(instrumentationConfig.Status.RuntimeDetailsByContainer) == 0 { + return nil + } - workloadName, workloadKind, err := workload.ExtractWorkloadInfoFromRuntimeObjectName(instrumentedApplication.Name) + workloadName, workloadKind, err := workload.ExtractWorkloadInfoFromRuntimeObjectName(instrumentationConfig.Name) if err != nil { - conditions.UpdateStatusConditions(ctx, kubeClient, instrumentedApplication, &instrumentedApplication.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonErrRemoving), err.Error()) + conditions.UpdateStatusConditions(ctx, kubeClient, instrumentationConfig, &instrumentationConfig.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonErrRemoving), err.Error()) return err } if !isNodeCollectorReady { - err := removeInstrumentationDeviceFromWorkload(ctx, kubeClient, instrumentedApplication.Namespace, workloadKind, workloadName, ApplyInstrumentationDeviceReasonDataCollectionNotReady) + err := removeInstrumentationDeviceFromWorkload(ctx, kubeClient, instrumentationConfig.Namespace, workloadKind, workloadName, ApplyInstrumentationDeviceReasonDataCollectionNotReady) if err == nil { - conditions.UpdateStatusConditions(ctx, kubeClient, instrumentedApplication, &instrumentedApplication.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonDataCollectionNotReady), "OpenTelemetry pipeline not yet ready to receive data") + conditions.UpdateStatusConditions(ctx, kubeClient, instrumentationConfig, &instrumentationConfig.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonDataCollectionNotReady), "OpenTelemetry pipeline not yet ready to receive data") } else { - conditions.UpdateStatusConditions(ctx, kubeClient, instrumentedApplication, &instrumentedApplication.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonErrRemoving), err.Error()) + conditions.UpdateStatusConditions(ctx, kubeClient, instrumentationConfig, &instrumentationConfig.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonErrRemoving), err.Error()) } return err } - if len(instrumentedApplication.Spec.RuntimeDetails) == 0 { - err := removeInstrumentationDeviceFromWorkload(ctx, kubeClient, instrumentedApplication.Namespace, workloadKind, workloadName, ApplyInstrumentationDeviceReasonNoRuntimeDetails) - if err == nil { - conditions.UpdateStatusConditions(ctx, kubeClient, instrumentedApplication, &instrumentedApplication.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonNoRuntimeDetails), "No runtime details found") - } else { - conditions.UpdateStatusConditions(ctx, kubeClient, instrumentedApplication, &instrumentedApplication.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonErrRemoving), err.Error()) - } - return err - } - runtimeVersionSupport, err := versionsupport.IsRuntimeVersionSupported(ctx, instrumentedApplication.Spec.RuntimeDetails) + runtimeVersionSupport, err := versionsupport.IsRuntimeVersionSupported(ctx, instrumentationConfig.Status.RuntimeDetailsByContainer) if !runtimeVersionSupport { - errRemove := removeInstrumentationDeviceFromWorkload(ctx, kubeClient, instrumentedApplication.Namespace, workloadKind, workloadName, ApplyInstrumentationDeviceReasonRuntimeVersionNotSupported) + errRemove := removeInstrumentationDeviceFromWorkload(ctx, kubeClient, instrumentationConfig.Namespace, workloadKind, workloadName, ApplyInstrumentationDeviceReasonRuntimeVersionNotSupported) if errRemove == nil { - conditions.UpdateStatusConditions(ctx, kubeClient, instrumentedApplication, &instrumentedApplication.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonRuntimeVersionNotSupported), err.Error()) + conditions.UpdateStatusConditions(ctx, kubeClient, instrumentationConfig, &instrumentationConfig.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonRuntimeVersionNotSupported), err.Error()) } else { - conditions.UpdateStatusConditions(ctx, kubeClient, instrumentedApplication, &instrumentedApplication.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonErrRemoving), errRemove.Error()) + conditions.UpdateStatusConditions(ctx, kubeClient, instrumentationConfig, &instrumentationConfig.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonErrRemoving), errRemove.Error()) } return nil } - err, devicePartiallyApplied := addInstrumentationDeviceToWorkload(ctx, kubeClient, instrumentedApplication) + err, devicePartiallyApplied := addInstrumentationDeviceToWorkload(ctx, kubeClient, instrumentationConfig) if err == nil { var successMessage string if devicePartiallyApplied { @@ -296,9 +291,9 @@ func reconcileSingleWorkload(ctx context.Context, kubeClient client.Client, inst } else { successMessage = "Instrumentation device applied successfully" } - conditions.UpdateStatusConditions(ctx, kubeClient, instrumentedApplication, &instrumentedApplication.Status.Conditions, metav1.ConditionTrue, appliedInstrumentationDeviceType, "InstrumentationDeviceApplied", successMessage) + conditions.UpdateStatusConditions(ctx, kubeClient, instrumentationConfig, &instrumentationConfig.Status.Conditions, metav1.ConditionTrue, appliedInstrumentationDeviceType, "InstrumentationDeviceApplied", successMessage) } else { - conditions.UpdateStatusConditions(ctx, kubeClient, instrumentedApplication, &instrumentedApplication.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonErrApplying), err.Error()) + conditions.UpdateStatusConditions(ctx, kubeClient, instrumentationConfig, &instrumentationConfig.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonErrApplying), err.Error()) } return err } diff --git a/instrumentor/controllers/instrumentationdevice/envoverwiter_test.go b/instrumentor/controllers/instrumentationdevice/envoverwiter_test.go deleted file mode 100644 index 5d57e8bc0..000000000 --- a/instrumentor/controllers/instrumentationdevice/envoverwiter_test.go +++ /dev/null @@ -1,280 +0,0 @@ -package instrumentationdevice_test - -import ( - "context" - - odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" - "github.com/odigos-io/odigos/api/odigos/v1alpha1/instrumentationrules" - "github.com/odigos-io/odigos/common" - "github.com/odigos-io/odigos/common/consts" - "github.com/odigos-io/odigos/common/envOverwrite" - "github.com/odigos-io/odigos/instrumentor/internal/testutil" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - appsv1 "k8s.io/api/apps/v1" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -var _ = Describe("envoverwrite", func() { - ctx := context.Background() - var namespace *corev1.Namespace - var deployment *appsv1.Deployment - var instrumentedApplication *odigosv1.InstrumentedApplication - - testProgrammingLanguagePython := common.PythonProgrammingLanguage - deploymentSdk := common.OtelSdkNativeCommunity - testEnvVarPythonPath := "PYTHONPATH" - // the following is the value that odigos will append to the user's env - var testEnvOdigosValue string - - BeforeEach(func() { - // create a new namespace for each test to prevent conflict - namespace = testutil.NewMockNamespace() - Expect(k8sClient.Create(ctx, namespace)).Should(Succeed()) - - sdkEnvVal, found := envOverwrite.ValToAppend(testEnvVarPythonPath, deploymentSdk) - Expect(found).Should(BeTrue()) - testEnvOdigosValue = sdkEnvVal - }) - - AfterEach(func() { - // restore to the default SDK - testutil.SetDefaultSDK(testProgrammingLanguagePython, common.OtelSdkNativeCommunity) - }) - - Describe("User did not set env in manifest or docker image", func() { - - BeforeEach(func() { - // create a deployment with no env - deployment = testutil.SetOdigosInstrumentationEnabled(testutil.NewMockTestDeployment(namespace)) - Expect(k8sClient.Create(ctx, deployment)).Should(Succeed()) - }) - - It("should not add env vars to deployment", func() { - // initial state - no env varas in manifest or dockerfile - // and odigos haven't yet injected it's env, so the deployment should have no env vars - instrumentedApplication = testutil.NewMockInstrumentedApplication(deployment) - Expect(k8sClient.Create(ctx, instrumentedApplication)).Should(Succeed()) - - // odigos env is the only one, so no need to inject anything to the manifest - testutil.AssertDepContainerEnvRemainEmpty(ctx, k8sClient, deployment) - - // now the pods restarts, and odigos detects the env var it injected - // via the instrumentation device. - // instrumented application should be updated with the odigos env - k8sClient.Get(ctx, client.ObjectKeyFromObject(instrumentedApplication), instrumentedApplication) - instrumentedApplication = testutil.SetInstrumentedApplicationContainer(instrumentedApplication, &testEnvVarPythonPath, &testEnvOdigosValue, testProgrammingLanguagePython) - Expect(k8sClient.Update(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerEnvRemainEmpty(ctx, k8sClient, deployment) - - // uninstrument the deployment, env var in deployment should remain empty - Expect(k8sClient.Delete(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerEnvRemainEmpty(ctx, k8sClient, deployment) - }) - }) - - Describe("User set env var via dockerfile and not in manifest", func() { - userEnvValue := "/from_dockerfile" - var mergedEnvValue string - - BeforeEach(func() { - mergedEnvValue = userEnvValue + ":" + testEnvOdigosValue - // the env var is in dockerfile, thus the manifest should start empty of env vars - deployment = testutil.SetOdigosInstrumentationEnabled(testutil.NewMockTestDeployment(namespace)) - Expect(k8sClient.Create(ctx, deployment)).Should(Succeed()) - }) - - It("Should add the dockerfile env and odigos env to manifest and successfully revert", func() { - // initial state - should capture the env var from dockerfile only - instrumentedApplication = testutil.SetInstrumentedApplicationContainer(testutil.NewMockInstrumentedApplication(deployment), &testEnvVarPythonPath, &userEnvValue, testProgrammingLanguagePython) - Expect(k8sClient.Create(ctx, instrumentedApplication)).Should(Succeed()) - - // odigos should merge the value from dockerfile and odigos env - testutil.AssertDepContainerSingleEnv(ctx, k8sClient, deployment, testEnvVarPythonPath, mergedEnvValue) - - // after instrumentation is applied, now the value in the pod should be the merged value - Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(instrumentedApplication), instrumentedApplication)).Should(Succeed()) - instrumentedApplication.Spec.RuntimeDetails[0].EnvVars[0].Value = mergedEnvValue - Expect(k8sClient.Update(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerSingleEnvRemainsSame(ctx, k8sClient, deployment, testEnvVarPythonPath, mergedEnvValue) - - // when uninstrumented, the value should be reverted to the original value which was empty in manifest - Expect(k8sClient.Delete(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerSingleEnvBecomesEmpty(ctx, k8sClient, deployment) - }) - - }) - - Describe("Container is run with env variables of other language than what it runs", func() { - - userEnvValue := "/from_dockerfile" - - BeforeEach(func() { - // the env var is in dockerfile, thus the manifest should start empty of env vars - deployment = testutil.SetOdigosInstrumentationEnabled(testutil.NewMockTestDeployment(namespace)) - Expect(k8sClient.Create(ctx, deployment)).Should(Succeed()) - }) - - It("Should not add the unrelated env vars to the manifest", func() { - instrumentedApplication = testutil.SetInstrumentedApplicationContainer(testutil.NewMockInstrumentedApplication(deployment), &testEnvVarPythonPath, &userEnvValue, common.JavaProgrammingLanguage) - Expect(k8sClient.Create(ctx, instrumentedApplication)).Should(Succeed()) - - // odigos found a relevant env var for python, but it should not be injected to the manifest - // as the language is not Python - testutil.AssertDepContainerEnvRemainEmpty(ctx, k8sClient, deployment) - }) - - It("Should not add the unrelated env vars with different otel SDKs", func() { - // make the SDK for python and java different - testutil.SetDefaultSDK(common.JavaProgrammingLanguage, common.OtelSdkEbpfEnterprise) - - instrumentedApplication = testutil.SetInstrumentedApplicationContainer(testutil.NewMockInstrumentedApplication(deployment), &testEnvVarPythonPath, &userEnvValue, common.JavaProgrammingLanguage) - Expect(k8sClient.Create(ctx, instrumentedApplication)).Should(Succeed()) - - // odigos found a relevant env var for python, but it should not be injected to the manifest - // as the language is not Python - testutil.AssertDepContainerEnvRemainEmpty(ctx, k8sClient, deployment) - }) - }) - - Describe("User set env var via manifest and not in dockerfile", func() { - userEnvValue := "/from_manifest" - var mergedEnvValue string - - BeforeEach(func() { - mergedEnvValue = userEnvValue + ":" + testEnvOdigosValue - // the env var is in manifest, thus the deployment should contain it at the start - deployment = testutil.SetDeploymentContainerEnv( - testutil.SetOdigosInstrumentationEnabled( - testutil.NewMockTestDeployment(namespace), - ), - testEnvVarPythonPath, userEnvValue) - Expect(k8sClient.Create(ctx, deployment)).Should(Succeed()) - }) - - It("Should update the manifest with merged value, and revet when uninstrumenting", func() { - // initial state - should capture the env var from manifest only - instrumentedApplication = testutil.SetInstrumentedApplicationContainer(testutil.NewMockInstrumentedApplication(deployment), &testEnvVarPythonPath, &userEnvValue, testProgrammingLanguagePython) - Expect(k8sClient.Create(ctx, instrumentedApplication)).Should(Succeed()) - - // odigos should merge the value from manifest and odigos env - testutil.AssertDepContainerSingleEnv(ctx, k8sClient, deployment, testEnvVarPythonPath, mergedEnvValue) - - // after instrumentation is applied, now the value in the pod should be the merged value - Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(instrumentedApplication), instrumentedApplication)).Should(Succeed()) - instrumentedApplication.Spec.RuntimeDetails[0].EnvVars[0].Value = mergedEnvValue - Expect(k8sClient.Update(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerSingleEnvRemainsSame(ctx, k8sClient, deployment, testEnvVarPythonPath, mergedEnvValue) - - // when uninstrumented, the value should be reverted to the original value which was in the manifest - Expect(k8sClient.Delete(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerSingleEnv(ctx, k8sClient, deployment, testEnvVarPythonPath, userEnvValue) - }) - }) - - When("Default SDK changes after env var is injected", func() { - - userEnvValue := "/from_manifest" - - BeforeEach(func() { - // the env var is in manifest, thus the deployment should contain it at the start - deployment = testutil.SetDeploymentContainerEnv( - testutil.SetOdigosInstrumentationEnabled( - testutil.NewMockTestDeployment(namespace), - ), - testEnvVarPythonPath, userEnvValue) - Expect(k8sClient.Create(ctx, deployment)).Should(Succeed()) - - // initial state - should capture the env var from manifest only - mergedEnvValue := userEnvValue + ":" + testEnvOdigosValue - instrumentedApplication = testutil.SetInstrumentedApplicationContainer(testutil.NewMockInstrumentedApplication(deployment), &testEnvVarPythonPath, &userEnvValue, testProgrammingLanguagePython) - Expect(k8sClient.Create(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerSingleEnv(ctx, k8sClient, deployment, testEnvVarPythonPath, mergedEnvValue) - - // after instrumentation is applied, now the value in the pod should be the merged value - Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(instrumentedApplication), instrumentedApplication)).Should(Succeed()) - instrumentedApplication.Spec.RuntimeDetails[0].EnvVars[0].Value = mergedEnvValue - Expect(k8sClient.Update(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerSingleEnvRemainsSame(ctx, k8sClient, deployment, testEnvVarPythonPath, mergedEnvValue) - }) - - When("Default SDK changes to another SDK", func() { - newSdk := common.OtelSdkEbpfEnterprise - const ruleName = "test-instrumentation-rule" - - BeforeEach(func() { - // change the default SDK to another SDK by creating a rule - rule := testutil.NewMockEmptyInstrumentationRule(ruleName, consts.DefaultOdigosNamespace) - Expect(k8sClient.Create(ctx, rule)).Should(Succeed()) - rule.Spec.OtelSdks = &instrumentationrules.OtelSdks{ - OtelSdkByLanguage: map[common.ProgrammingLanguage]common.OtelSdk{ - testProgrammingLanguagePython: newSdk, - }, - } - Expect(k8sClient.Update(ctx, rule)).Should(Succeed()) - }) - - AfterEach(func() { - // revert the default SDK back to the original value by deleting the rule - var rule odigosv1.InstrumentationRule - Expect(k8sClient.Get(ctx, types.NamespacedName{Name: ruleName, Namespace: consts.DefaultOdigosNamespace}, &rule)).Should(Succeed()) - Expect(k8sClient.Delete(ctx, &rule)).Should(Succeed()) - }) - - It("Should update the manifest with new odigos env value", func() { - newOdigosValue, found := envOverwrite.ValToAppend(testEnvVarPythonPath, newSdk) - Expect(found).Should(BeTrue()) - newMergedEnvValue := userEnvValue + ":" + newOdigosValue - - // after the SDK is updated, the deployment should be updated with the new odigos value - testutil.AssertDepContainerSingleEnv(ctx, k8sClient, deployment, testEnvVarPythonPath, newMergedEnvValue) - - // when uninstrumented, the value should be reverted to the original value which was in the manifest - Expect(k8sClient.Delete(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerSingleEnv(ctx, k8sClient, deployment, testEnvVarPythonPath, userEnvValue) - }) - }) - }) - - When("Apply to workload restores the value to it's original state", func() { - - userEnvValue := "/orig_in_manifest" - var mergedEnvValue string - - BeforeEach(func() { - // the env var is in manifest, thus the deployment should contain it at the start - deployment = testutil.SetDeploymentContainerEnv( - testutil.SetOdigosInstrumentationEnabled( - testutil.NewMockTestDeployment(namespace), - ), - testEnvVarPythonPath, userEnvValue) - Expect(k8sClient.Create(ctx, deployment)).Should(Succeed()) - - // initial state - should capture the env var from manifest only - mergedEnvValue = userEnvValue + ":" + testEnvOdigosValue - instrumentedApplication = testutil.SetInstrumentedApplicationContainer(testutil.NewMockInstrumentedApplication(deployment), &testEnvVarPythonPath, &userEnvValue, testProgrammingLanguagePython) - Expect(k8sClient.Create(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerSingleEnv(ctx, k8sClient, deployment, testEnvVarPythonPath, mergedEnvValue) - - // after instrumentation is applied, now the value in the pod should be the merged value - Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(instrumentedApplication), instrumentedApplication)).Should(Succeed()) - instrumentedApplication.Spec.RuntimeDetails[0].EnvVars[0].Value = mergedEnvValue - Expect(k8sClient.Update(ctx, instrumentedApplication)).Should(Succeed()) - testutil.AssertDepContainerSingleEnvRemainsSame(ctx, k8sClient, deployment, testEnvVarPythonPath, mergedEnvValue) - }) - - It("Should reapply odigos value to the manifest", func() { - // when the deployment is updated, the odigos value should be reapplied - Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(deployment), deployment)).Should(Succeed()) - // restore the value to the original state - deployment = testutil.SetDeploymentContainerEnv(deployment, testEnvVarPythonPath, userEnvValue) - Expect(k8sClient.Update(ctx, deployment)).Should(Succeed()) - - // the odigos value should be reapplied - testutil.AssertDepContainerSingleEnv(ctx, k8sClient, deployment, testEnvVarPythonPath, mergedEnvValue) - }) - }) - -}) diff --git a/instrumentor/controllers/instrumentationdevice/instrumentationconfig_controller.go b/instrumentor/controllers/instrumentationdevice/instrumentationconfig_controller.go new file mode 100644 index 000000000..724dd63b4 --- /dev/null +++ b/instrumentor/controllers/instrumentationdevice/instrumentationconfig_controller.go @@ -0,0 +1,110 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package instrumentationdevice + +import ( + "context" + + odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" + "github.com/odigos-io/odigos/k8sutils/pkg/utils" + "github.com/odigos-io/odigos/k8sutils/pkg/workload" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/predicate" +) + +type InstrumentationConfigReconciler struct { + client.Client + Scheme *runtime.Scheme +} + +type runtimeDetailsChangedPredicate struct{} + +func (o runtimeDetailsChangedPredicate) Create(e event.CreateEvent) bool { + if e.Object == nil { + return false + } + + ic, ok := e.Object.(*odigosv1.InstrumentationConfig) + if !ok { + return false + } + + return len(ic.Status.RuntimeDetailsByContainer) > 0 +} + +func (i runtimeDetailsChangedPredicate) Update(e event.UpdateEvent) bool { + if e.ObjectOld == nil || e.ObjectNew == nil { + return false + } + + oldIc, oldOk := e.ObjectOld.(*odigosv1.InstrumentationConfig) + newIc, newOk := e.ObjectNew.(*odigosv1.InstrumentationConfig) + + if !oldOk || !newOk { + return false + } + + // currently, we only check the lengths of the runtime details + // we should improve this once we support updating the runtime details more than once + if len(oldIc.Status.RuntimeDetailsByContainer) != len(newIc.Status.RuntimeDetailsByContainer) { + return true + } + + return false +} + +func (i runtimeDetailsChangedPredicate) Delete(e event.DeleteEvent) bool { + // when the instrumentation config is deleted we need to clean up the device + return true +} + +func (i runtimeDetailsChangedPredicate) Generic(e event.GenericEvent) bool { + return false +} + +var _ predicate.Predicate = &runtimeDetailsChangedPredicate{} + +func (r *InstrumentationConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + logger := log.FromContext(ctx) + + var instConfig odigosv1.InstrumentationConfig + err := r.Client.Get(ctx, req.NamespacedName, &instConfig) + if err != nil { + + if !apierrors.IsNotFound(err) { + return ctrl.Result{}, err + } + + // instrumentation config deleted: remove instrumentation from resource requests + workloadName, workloadKind, err := workload.ExtractWorkloadInfoFromRuntimeObjectName(req.Name) + if err != nil { + logger.Error(err, "error parsing workload info from runtime object name") + return ctrl.Result{}, err + } + err = removeInstrumentationDeviceFromWorkload(ctx, r.Client, req.Namespace, workloadKind, workloadName, ApplyInstrumentationDeviceReasonNoRuntimeDetails) + return utils.K8SUpdateErrorHandler(err) + } + + isNodeCollectorReady := isDataCollectionReady(ctx, r.Client) + err = reconcileSingleWorkload(ctx, r.Client, &instConfig, isNodeCollectorReady) + return utils.K8SUpdateErrorHandler(err) +} diff --git a/instrumentor/controllers/instrumentationdevice/instrumentationrule_controller.go b/instrumentor/controllers/instrumentationdevice/instrumentationrule_controller.go index c6c4cf707..86fac7326 100644 --- a/instrumentor/controllers/instrumentationdevice/instrumentationrule_controller.go +++ b/instrumentor/controllers/instrumentationdevice/instrumentationrule_controller.go @@ -20,7 +20,7 @@ type InstrumentationRuleReconciler struct { func (r *InstrumentationRuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - var instApps odigosv1.InstrumentedApplicationList + var instApps odigosv1.InstrumentationConfigList if err := r.List(ctx, &instApps); err != nil { return ctrl.Result{}, err } diff --git a/instrumentor/controllers/instrumentationdevice/instrumentedapplication_controller.go b/instrumentor/controllers/instrumentationdevice/instrumentedapplication_controller.go deleted file mode 100644 index f1bcd2d6d..000000000 --- a/instrumentor/controllers/instrumentationdevice/instrumentedapplication_controller.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package instrumentationdevice - -import ( - "context" - - odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" - "github.com/odigos-io/odigos/k8sutils/pkg/utils" - "github.com/odigos-io/odigos/k8sutils/pkg/workload" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" -) - -type InstrumentedApplicationReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -func (r *InstrumentedApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - logger := log.FromContext(ctx) - - var runtimeDetails odigosv1.InstrumentedApplication - err := r.Client.Get(ctx, req.NamespacedName, &runtimeDetails) - if err != nil { - - if !apierrors.IsNotFound(err) { - return ctrl.Result{}, err - } - - // runtime details deleted: remove instrumentation from resource requests - workloadName, workloadKind, err := workload.ExtractWorkloadInfoFromRuntimeObjectName(req.Name) - if err != nil { - logger.Error(err, "error parsing workload info from runtime object name") - return ctrl.Result{}, err - } - err = removeInstrumentationDeviceFromWorkload(ctx, r.Client, req.Namespace, workloadKind, workloadName, ApplyInstrumentationDeviceReasonNoRuntimeDetails) - return utils.K8SUpdateErrorHandler(err) - } - - isNodeCollectorReady := isDataCollectionReady(ctx, r.Client) - err = reconcileSingleWorkload(ctx, r.Client, &runtimeDetails, isNodeCollectorReady) - return utils.K8SUpdateErrorHandler(err) -} diff --git a/instrumentor/controllers/instrumentationdevice/manager.go b/instrumentor/controllers/instrumentationdevice/manager.go index 135357e30..7748820b1 100644 --- a/instrumentor/controllers/instrumentationdevice/manager.go +++ b/instrumentor/controllers/instrumentationdevice/manager.go @@ -103,9 +103,9 @@ func SetupWithManager(mgr ctrl.Manager) error { err = builder. ControllerManagedBy(mgr). Named("instrumentationdevice-instrumentedapplication"). - For(&odigosv1.InstrumentedApplication{}). - WithEventFilter(&predicate.GenerationChangedPredicate{}). - Complete(&InstrumentedApplicationReconciler{ + For(&odigosv1.InstrumentationConfig{}). + WithEventFilter(&runtimeDetailsChangedPredicate{}). + Complete(&InstrumentationConfigReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), }) diff --git a/instrumentor/controllers/instrumentationdevice/workload_controllers.go b/instrumentor/controllers/instrumentationdevice/workload_controllers.go index faab08504..6d142a145 100644 --- a/instrumentor/controllers/instrumentationdevice/workload_controllers.go +++ b/instrumentor/controllers/instrumentationdevice/workload_controllers.go @@ -43,11 +43,11 @@ func (r *StatefulSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) } func reconcileSingleInstrumentedApplicationByName(ctx context.Context, k8sClient client.Client, instrumentedAppName string, namespace string) error { - var instrumentedApplication odigosv1.InstrumentedApplication - err := k8sClient.Get(ctx, types.NamespacedName{Name: instrumentedAppName, Namespace: namespace}, &instrumentedApplication) + var instrumentationConfig odigosv1.InstrumentationConfig + err := k8sClient.Get(ctx, types.NamespacedName{Name: instrumentedAppName, Namespace: namespace}, &instrumentationConfig) if err != nil { if apierrors.IsNotFound(err) { - // if there is no instrumented application, make sure the device is removed from the workload pod template manifest + // if there is no instrumentation config, make sure the device is removed from the workload pod template manifest workloadName, workloadKind, err := workload.ExtractWorkloadInfoFromRuntimeObjectName(instrumentedAppName) if err != nil { return err @@ -60,5 +60,5 @@ func reconcileSingleInstrumentedApplicationByName(ctx context.Context, k8sClient } isNodeCollectorReady := isDataCollectionReady(ctx, k8sClient) - return reconcileSingleWorkload(ctx, k8sClient, &instrumentedApplication, isNodeCollectorReady) + return reconcileSingleWorkload(ctx, k8sClient, &instrumentationConfig, isNodeCollectorReady) } diff --git a/k8sutils/pkg/describe/source.go b/k8sutils/pkg/describe/source.go index d5bf6a75e..bdcc0f874 100644 --- a/k8sutils/pkg/describe/source.go +++ b/k8sutils/pkg/describe/source.go @@ -30,14 +30,13 @@ func printInstrumentationConfigInfo(analyze *source.SourceAnalyze, sb *strings.B } func printRuntimeDetails(analyze *source.SourceAnalyze, sb *strings.Builder) { - describeText(sb, 0, "\nRuntime Inspection Details (new):") + describeText(sb, 0, "\nRuntime Inspection Details:") if analyze.RuntimeInfo == nil { describeText(sb, 1, "No runtime details") return } - printProperty(sb, 1, &analyze.RuntimeInfo.Generation) describeText(sb, 1, "Detected Containers:") for _, container := range analyze.RuntimeInfo.Containers { printProperty(sb, 2, &container.ContainerName) @@ -52,26 +51,6 @@ func printRuntimeDetails(analyze *source.SourceAnalyze, sb *strings.Builder) { } } -func printInstrumentedApplicationInfo(analyze *source.SourceAnalyze, sb *strings.Builder) { - - describeText(sb, 0, "\nRuntime Inspection Details (old):") - printProperty(sb, 1, &analyze.InstrumentedApplication.Created) - printProperty(sb, 1, analyze.InstrumentedApplication.CreateTime) - - describeText(sb, 1, "Detected Containers:") - for _, container := range analyze.InstrumentedApplication.Containers { - printProperty(sb, 2, &container.ContainerName) - printProperty(sb, 3, &container.Language) - printProperty(sb, 3, &container.RuntimeVersion) - if len(container.EnvVars) > 0 { - describeText(sb, 3, "Relevant Environment Variables:") - for _, envVar := range container.EnvVars { - describeText(sb, 4, fmt.Sprintf("%s: %s", envVar.Name, envVar.Value)) - } - } - } -} - func printAppliedInstrumentationDeviceInfo(analyze *source.SourceAnalyze, sb *strings.Builder) { describeText(sb, 0, "\nInstrumentation Device:") @@ -124,7 +103,6 @@ func DescribeSourceToText(analyze *source.SourceAnalyze) string { printWorkloadManifestInfo(analyze, &sb) printInstrumentationConfigInfo(analyze, &sb) printRuntimeDetails(analyze, &sb) - printInstrumentedApplicationInfo(analyze, &sb) printAppliedInstrumentationDeviceInfo(analyze, &sb) printPodsInfo(analyze, &sb) diff --git a/k8sutils/pkg/describe/source/analyze.go b/k8sutils/pkg/describe/source/analyze.go index a825b3929..cbffd0ae6 100644 --- a/k8sutils/pkg/describe/source/analyze.go +++ b/k8sutils/pkg/describe/source/analyze.go @@ -34,13 +34,6 @@ type ContainerRuntimeInfoAnalyze struct { } type RuntimeInfoAnalyze struct { - Generation properties.EntityProperty `json:"generation"` - Containers []ContainerRuntimeInfoAnalyze `json:"containers"` -} - -type InstrumentedApplicationAnalyze struct { - Created properties.EntityProperty `json:"created"` - CreateTime *properties.EntityProperty `json:"createTime"` Containers []ContainerRuntimeInfoAnalyze `json:"containers"` } @@ -82,7 +75,6 @@ type SourceAnalyze struct { InstrumentationConfig InstrumentationConfigAnalyze `json:"instrumentationConfig"` RuntimeInfo *RuntimeInfoAnalyze `json:"runtimeInfo"` - InstrumentedApplication InstrumentedApplicationAnalyze `json:"instrumentedApplication"` InstrumentationDevice InstrumentationDeviceAnalyze `json:"instrumentationDevice"` TotalPods int `json:"totalPods"` @@ -229,40 +221,9 @@ func analyzeRuntimeInfo(resources *OdigosSourceResources) *RuntimeInfoAnalyze { } } -func analyzeInstrumentedApplication(resources *OdigosSourceResources) InstrumentedApplicationAnalyze { - instrumentedApplicationCreated := resources.InstrumentedApplication != nil - - created := properties.EntityProperty{ - Name: "Created", - Value: properties.GetTextCreated(instrumentedApplicationCreated), - Status: properties.GetSuccessOrTransitioning(instrumentedApplicationCreated), - Explain: "whether the instrumented application object exists in the cluster. When a workload is labeled for instrumentation, an instrumented application object is created", - } - - var createdTime *properties.EntityProperty - if instrumentedApplicationCreated { - createdTime = &properties.EntityProperty{ - Name: "create time", - Value: resources.InstrumentedApplication.GetCreationTimestamp().String(), - Explain: "the time when the instrumented application object was created", - } - } - - containers := make([]ContainerRuntimeInfoAnalyze, 0) - if resources.InstrumentedApplication != nil { - containers = analyzeRuntimeDetails(resources.InstrumentedApplication.Spec.RuntimeDetails) - } - - return InstrumentedApplicationAnalyze{ - Created: created, - CreateTime: createdTime, - Containers: containers, - } -} - func analyzeInstrumentationDevice(resources *OdigosSourceResources, workloadObj *K8sSourceObject, instrumented bool) InstrumentationDeviceAnalyze { - instrumentedApplication := resources.InstrumentedApplication + instrumentationConfig := resources.InstrumentationConfig appliedInstrumentationDeviceStatusMessage := "Unknown" var appliedDeviceStatus properties.PropertyStatus @@ -271,10 +232,10 @@ func analyzeInstrumentationDevice(resources *OdigosSourceResources, workloadObj appliedInstrumentationDeviceStatusMessage = "No instrumentation devices expected" appliedDeviceStatus = properties.PropertyStatusSuccess } - if instrumentedApplication != nil && instrumentedApplication.Status.Conditions != nil { - for _, condition := range instrumentedApplication.Status.Conditions { + if instrumentationConfig != nil && instrumentationConfig.Status.Conditions != nil { + for _, condition := range instrumentationConfig.Status.Conditions { if condition.Type == "AppliedInstrumentationDevice" { // TODO: share this constant with instrumentor - if condition.ObservedGeneration == instrumentedApplication.GetGeneration() { + if condition.ObservedGeneration == instrumentationConfig.GetGeneration() { appliedInstrumentationDeviceStatusMessage = condition.Message if condition.Status == metav1.ConditionTrue { appliedDeviceStatus = properties.PropertyStatusSuccess @@ -522,7 +483,6 @@ func AnalyzeSource(resources *OdigosSourceResources, workloadObj *K8sSourceObjec labelsAnalysis, instrumented := analyzeInstrumentationLabels(resources, workloadObj) icAnalysis := analyzeInstrumentationConfig(resources, instrumented) runtimeAnalysis := analyzeRuntimeInfo(resources) - instrumentedApplication := analyzeInstrumentedApplication(resources) device := analyzeInstrumentationDevice(resources, workloadObj, instrumented) pods, podsText := analyzePods(resources, device) @@ -534,7 +494,6 @@ func AnalyzeSource(resources *OdigosSourceResources, workloadObj *K8sSourceObjec InstrumentationConfig: icAnalysis, RuntimeInfo: runtimeAnalysis, - InstrumentedApplication: instrumentedApplication, InstrumentationDevice: device, TotalPods: len(pods), diff --git a/k8sutils/pkg/describe/source/resources.go b/k8sutils/pkg/describe/source/resources.go index 3f585f51f..cf0bbcfaa 100644 --- a/k8sutils/pkg/describe/source/resources.go +++ b/k8sutils/pkg/describe/source/resources.go @@ -17,7 +17,6 @@ import ( type OdigosSourceResources struct { Namespace *corev1.Namespace InstrumentationConfig *odigosv1.InstrumentationConfig - InstrumentedApplication *odigosv1.InstrumentedApplication InstrumentationInstances *odigosv1.InstrumentationInstanceList Pods *corev1.PodList } @@ -43,13 +42,6 @@ func GetRelevantSourceResources(ctx context.Context, kubeClient kubernetes.Inter return nil, err } - ia, err := odigosClient.InstrumentedApplications(workloadNs).Get(ctx, runtimeObjectName, metav1.GetOptions{}) - if err == nil { - sourceResources.InstrumentedApplication = ia - } else if !apierrors.IsNotFound(err) { - return nil, err - } - instrumentedAppSelector := labels.SelectorFromSet(labels.Set{ "instrumented-app": runtimeObjectName, }) diff --git a/tests/e2e/workload-lifecycle/01-assert-apps-installed.yaml b/tests/e2e/workload-lifecycle/01-assert-apps-installed.yaml index b897f2a44..96ac993e3 100644 --- a/tests/e2e/workload-lifecycle/01-assert-apps-installed.yaml +++ b/tests/e2e/workload-lifecycle/01-assert-apps-installed.yaml @@ -96,20 +96,6 @@ status: started: true phase: Running --- -apiVersion: v1 -kind: Pod -metadata: - labels: - app: language-change - namespace: default -status: - containerStatuses: - - name: language-change - ready: true - restartCount: 0 - started: true - phase: Running ---- apiVersion: v1 kind: Pod diff --git a/tests/e2e/workload-lifecycle/01-assert-instrumented.yaml b/tests/e2e/workload-lifecycle/01-assert-instrumented.yaml index 48959e724..1c24b23a9 100644 --- a/tests/e2e/workload-lifecycle/01-assert-instrumented.yaml +++ b/tests/e2e/workload-lifecycle/01-assert-instrumented.yaml @@ -1,5 +1,5 @@ apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-nodejs-unsupported-version @@ -7,35 +7,35 @@ status: conditions: - message: "javascript runtime version not supported by OpenTelemetry SDK. Found: 8.17.0, supports: 14.0.0" - observedGeneration: 1 + (observedGeneration != null): true reason: RuntimeVersionNotSupported status: "False" type: AppliedInstrumentationDevice --- # expecting injection of instrumentation device to be successful since the runtime version was not detected apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-nodejs-very-old-version status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- # expecting injection of instrumentation device to be successful since the runtime version is supported apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-nodejs-minimum-version status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice @@ -67,14 +67,14 @@ status: (value != null): true --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-nodejs-latest-version status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice @@ -106,14 +106,14 @@ status: (value != null): true --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-nodejs-dockerfile-env status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice @@ -145,14 +145,14 @@ status: (value != null): true --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-nodejs-manifest-env status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice @@ -184,184 +184,157 @@ status: (value != null): true --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-cpp-http-server status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication -metadata: - namespace: default - name: deployment-language-change -status: - conditions: - - message: "Instrumentation device applied successfully" - observedGeneration: 1 - reason: InstrumentationDeviceApplied - status: "True" - type: AppliedInstrumentationDevice ---- -apiVersion: odigos.io/v1alpha1 -kind: InstrumentationInstance -metadata: - namespace: default - labels: - instrumented-app: deployment-language-change -status: - healthy: true - # no need to verify all properties, as this is not the intent of this test ---- - -apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-java-supported-version status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-java-azul status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-java-supported-docker-env status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-java-supported-manifest-env status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-java-latest-version status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-java-old-version status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-python-alpine -spec: - runtimeDetails: - - containerName: python-alpine status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-python-latest-version status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-python-min-version status: conditions: - message: "Instrumentation device applied successfully" - observedGeneration: 1 + (observedGeneration != null): true reason: InstrumentationDeviceApplied status: "True" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-python-not-supported status: conditions: - message: "python runtime version not supported by OpenTelemetry SDK. Found: 3.6.15, supports: 3.8.0" - observedGeneration: 1 + (observedGeneration != null): true reason: RuntimeVersionNotSupported status: "False" type: AppliedInstrumentationDevice --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: namespace: default name: deployment-python-other-agent status: conditions: - message: "device not added to any container due to the presence of another agent" - observedGeneration: 1 + (observedGeneration != null): true reason: ErrApplyingInstrumentationDevice status: "False" type: AppliedInstrumentationDevice diff --git a/tests/e2e/workload-lifecycle/01-assert-runtime-detected.yaml b/tests/e2e/workload-lifecycle/01-assert-runtime-detected.yaml index fd9d001a7..ed0b9bb09 100644 --- a/tests/e2e/workload-lifecycle/01-assert-runtime-detected.yaml +++ b/tests/e2e/workload-lifecycle/01-assert-runtime-detected.yaml @@ -1,5 +1,5 @@ apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-nodejs-unsupported-version namespace: default @@ -9,14 +9,14 @@ metadata: controller: true kind: Deployment name: nodejs-unsupported-version -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: nodejs-unsupported-version language: javascript runtimeVersion: 8.17.0 --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-nodejs-very-old-version namespace: default @@ -26,14 +26,14 @@ metadata: controller: true kind: Deployment name: nodejs-very-old-version -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: nodejs-very-old-version language: javascript (runtimeVersion == null): true --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-nodejs-minimum-version namespace: default @@ -43,14 +43,14 @@ metadata: controller: true kind: Deployment name: nodejs-minimum-version -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: nodejs-minimum-version language: javascript runtimeVersion: 14.0.0 --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-nodejs-latest-version namespace: default @@ -60,14 +60,14 @@ metadata: controller: true kind: Deployment name: nodejs-latest-version -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: nodejs-latest-version language: javascript (runtimeVersion != null): true --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-nodejs-dockerfile-env namespace: default @@ -77,8 +77,8 @@ metadata: controller: true kind: Deployment name: nodejs-dockerfile-env -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: nodejs-dockerfile-env envVars: - name: NODE_OPTIONS @@ -87,7 +87,7 @@ spec: runtimeVersion: 20.17.0 --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-nodejs-manifest-env namespace: default @@ -97,8 +97,8 @@ metadata: controller: true kind: Deployment name: nodejs-manifest-env -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: nodejs-manifest-env envVars: - name: NODE_OPTIONS @@ -107,7 +107,7 @@ spec: runtimeVersion: 20.17.0 --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-cpp-http-server namespace: default @@ -117,33 +117,13 @@ metadata: controller: true kind: Deployment name: cpp-http-server -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: cpp-http-server language: unknown --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication -metadata: - name: deployment-language-change - namespace: default - ownerReferences: - - apiVersion: apps/v1 - blockOwnerDeletion: true - controller: true - kind: Deployment - name: language-change -spec: - runtimeDetails: - - containerName: language-change - envVars: - - name: NODE_OPTIONS - value: "--require /app/execute_before.js --max-old-space-size=256" - language: javascript - runtimeVersion: 20.17.0 ---- -apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-java-supported-version namespace: default @@ -153,14 +133,14 @@ metadata: controller: true kind: Deployment name: java-supported-version -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: java-supported-version language: java runtimeVersion: 17.0.12+7 --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-java-azul namespace: default @@ -170,13 +150,13 @@ metadata: controller: true kind: Deployment name: java-azul -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: java-azul language: java --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-java-supported-docker-env namespace: default @@ -186,8 +166,8 @@ metadata: controller: true kind: Deployment name: java-supported-docker-env -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: java-supported-docker-env language: java envVars: @@ -197,7 +177,7 @@ spec: --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-java-supported-manifest-env namespace: default @@ -207,8 +187,8 @@ metadata: controller: true kind: Deployment name: java-supported-manifest-env -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: java-supported-manifest-env language: java envVars: @@ -218,7 +198,7 @@ spec: --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-java-latest-version namespace: default @@ -228,13 +208,13 @@ metadata: controller: true kind: Deployment name: java-latest-version -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: java-latest-version language: java --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-java-old-version namespace: default @@ -244,14 +224,14 @@ metadata: controller: true kind: Deployment name: java-old-version -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: java-old-version language: java --- ## Python apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-python-alpine namespace: default @@ -261,8 +241,8 @@ metadata: controller: true kind: Deployment name: python-alpine -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: python-alpine envVars: - name: PYTHONPATH @@ -271,7 +251,7 @@ spec: runtimeVersion: 3.10.15 --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-python-latest-version namespace: default @@ -281,14 +261,14 @@ metadata: controller: true kind: Deployment name: python-latest-version -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: python-latest-version language: python (runtimeVersion != null): true --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-python-other-agent namespace: default @@ -298,8 +278,8 @@ metadata: controller: true kind: Deployment name: python-other-agent -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: python-other-agent language: python otherAgent: @@ -307,7 +287,7 @@ spec: (runtimeVersion != null): true --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-python-min-version namespace: default @@ -317,14 +297,14 @@ metadata: controller: true kind: Deployment name: python-min-version -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: python-min-version language: python runtimeVersion: 3.8.0 --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-python-not-supported namespace: default @@ -334,14 +314,14 @@ metadata: controller: true kind: Deployment name: python-not-supported -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: python-not-supported language: python runtimeVersion: 3.6.15 --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-dotnet8-musl namespace: default @@ -351,14 +331,14 @@ metadata: controller: true kind: Deployment name: dotnet8-musl -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: dotnet8-musl language: dotnet libCType: musl --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-dotnet6-musl namespace: default @@ -368,14 +348,14 @@ metadata: controller: true kind: Deployment name: dotnet6-musl -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: dotnet6-musl language: dotnet libCType: musl --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-dotnet8-glibc namespace: default @@ -385,14 +365,14 @@ metadata: controller: true kind: Deployment name: dotnet8-glibc -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: dotnet8-glibc language: dotnet libCType: glibc --- apiVersion: odigos.io/v1alpha1 -kind: InstrumentedApplication +kind: InstrumentationConfig metadata: name: deployment-dotnet6-glibc namespace: default @@ -402,8 +382,8 @@ metadata: controller: true kind: Deployment name: dotnet6-glibc -spec: - runtimeDetails: +status: + runtimeDetailsByContainer: - containerName: dotnet6-glibc language: dotnet libCType: glibc \ No newline at end of file diff --git a/tests/e2e/workload-lifecycle/01-assert-workloads.yaml b/tests/e2e/workload-lifecycle/01-assert-workloads.yaml index efbca6ebf..dc332afd5 100644 --- a/tests/e2e/workload-lifecycle/01-assert-workloads.yaml +++ b/tests/e2e/workload-lifecycle/01-assert-workloads.yaml @@ -201,37 +201,6 @@ status: --- apiVersion: apps/v1 kind: Deployment -metadata: - annotations: - deployment.kubernetes.io/revision: "2" # the deployment spec changed when odigos resource was added - generation: 2 # the deployment spec changed when odigos resource was added - labels: - app: language-change - name: language-change - namespace: default -spec: - selector: - matchLabels: - app: language-change - template: - spec: - containers: - - name: language-change - resources: - limits: - instrumentation.odigos.io/javascript-native-community: "1" - env: - - name: NODE_OPTIONS - value: "--require /app/execute_before.js --max-old-space-size=256 --require /var/odigos/nodejs/autoinstrumentation.js" -status: - availableReplicas: 1 - observedGeneration: 2 # the deployment spec changed when odigos resource was added - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 ---- -apiVersion: apps/v1 -kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: "2" diff --git a/tests/e2e/workload-lifecycle/01-generate-traffic.yaml b/tests/e2e/workload-lifecycle/01-generate-traffic.yaml index 7e1b6e408..7f1f141f0 100644 --- a/tests/e2e/workload-lifecycle/01-generate-traffic.yaml +++ b/tests/e2e/workload-lifecycle/01-generate-traffic.yaml @@ -32,8 +32,6 @@ spec: curl -s --fail http://cpp-http-server:3000 - curl -s --fail http://language-change:3000 - curl -s --fail http://java-supported-version:3000 curl -s --fail http://java-supported-docker-env:3000 curl -s --fail http://java-azul:3000 diff --git a/tests/e2e/workload-lifecycle/01-install-test-apps.yaml b/tests/e2e/workload-lifecycle/01-install-test-apps.yaml index 234277136..92714228d 100644 --- a/tests/e2e/workload-lifecycle/01-install-test-apps.yaml +++ b/tests/e2e/workload-lifecycle/01-install-test-apps.yaml @@ -246,41 +246,6 @@ spec: - protocol: TCP port: 3000 --- -kind: Deployment -apiVersion: apps/v1 -metadata: - name: language-change - namespace: default - labels: - app: language-change -spec: - selector: - matchLabels: - app: language-change - template: - metadata: - labels: - app: language-change - spec: - containers: - - name: language-change - image: nodejs-dockerfile-env:v0.0.1 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 3000 ---- -kind: Service -apiVersion: v1 -metadata: - name: language-change - namespace: default -spec: - selector: - app: language-change - ports: - - protocol: TCP - port: 3000 ---- apiVersion: apps/v1 kind: Deployment metadata: diff --git a/tests/e2e/workload-lifecycle/01-wait-for-trace.yaml b/tests/e2e/workload-lifecycle/01-wait-for-trace.yaml index 27980046c..659059059 100644 --- a/tests/e2e/workload-lifecycle/01-wait-for-trace.yaml +++ b/tests/e2e/workload-lifecycle/01-wait-for-trace.yaml @@ -6,7 +6,6 @@ query: | { resource.service.name = "nodejs-latest-version" } || { resource.service.name = "nodejs-dockerfile-env" } || { resource.service.name = "nodejs-manifest-env" } || - { resource.service.name = "language-change" } || { resource.service.name = "java-supported-version" } || { resource.service.name = "java-latest-version" } || { resource.service.name = "java-old-version" } || @@ -15,11 +14,10 @@ query: | { resource.service.name = "java-azul" } || { resource.service.name = "python-latest-version" && span.http.route = "insert-random/" } || { resource.service.name = "python-alpine" && span.http.route = "insert-random/" } || - { resource.service.name = "python-not-supported" && span.http.route = "insert-random/" } || { resource.service.name = "python-min-version" && span.http.route = "insert-random/" } || { resource.service.name = "dotnet8-glibc" } || { resource.service.name = "dotnet8-musl" } || { resource.service.name = "dotnet6-glibc" } || { resource.service.name = "dotnet6-musl" } expected: - count: 18 + count: 17 diff --git a/tests/e2e/workload-lifecycle/02-assert-workload-update.yaml b/tests/e2e/workload-lifecycle/02-assert-workload-update.yaml index 0c04a78e5..c40805c7b 100644 --- a/tests/e2e/workload-lifecycle/02-assert-workload-update.yaml +++ b/tests/e2e/workload-lifecycle/02-assert-workload-update.yaml @@ -187,35 +187,6 @@ status: --- apiVersion: apps/v1 kind: Deployment -metadata: - annotations: - (odigos.io/manifest-env-original-val == null): true - generation: 5 # started as 2, updated by test once, then by instrumentor and again after new runtime details updated - labels: - app: language-change - name: language-change - namespace: default -spec: - selector: - matchLabels: - app: language-change - template: - spec: - containers: - - (env == null): true - image: cpp-http-server:v0.0.1 - name: language-change - resources: {} -status: - availableReplicas: 1 - observedGeneration: 5 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 - ---- -apiVersion: apps/v1 -kind: Deployment metadata: generation: 4 # on step 2, the manifest was updated (1->2) labels: diff --git a/tests/e2e/workload-lifecycle/02-update-workload-manifests.yaml b/tests/e2e/workload-lifecycle/02-update-workload-manifests.yaml index b2310a1fa..c9b5432c9 100644 --- a/tests/e2e/workload-lifecycle/02-update-workload-manifests.yaml +++ b/tests/e2e/workload-lifecycle/02-update-workload-manifests.yaml @@ -178,31 +178,6 @@ spec: --- kind: Deployment apiVersion: apps/v1 -metadata: - name: language-change - namespace: default - labels: - app: language-change -spec: - selector: - matchLabels: - app: language-change - template: - metadata: - labels: - app: language-change - annotations: - odigos-test-step: "2" - spec: - containers: - - name: language-change - image: cpp-http-server:v0.0.1 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 3000 ---- -kind: Deployment -apiVersion: apps/v1 metadata: name: java-supported-version namespace: default diff --git a/tests/e2e/workload-lifecycle/02-wait-for-trace.yaml b/tests/e2e/workload-lifecycle/02-wait-for-trace.yaml index 2b25b6e35..41289ee4b 100644 --- a/tests/e2e/workload-lifecycle/02-wait-for-trace.yaml +++ b/tests/e2e/workload-lifecycle/02-wait-for-trace.yaml @@ -6,7 +6,6 @@ query: | { resource.service.name = "nodejs-latest-version" } || { resource.service.name = "nodejs-dockerfile-env" } || { resource.service.name = "nodejs-manifest-env" } || - { resource.service.name = "language-change" } || { resource.service.name = "java-supported-version" } || { resource.service.name = "java-latest-version" } || { resource.service.name = "java-old-version" } || @@ -15,7 +14,6 @@ query: | { resource.service.name = "java-azul" } || { resource.service.name = "python-latest-version" && span.http.route = "insert-random/" } || { resource.service.name = "python-alpine" && span.http.route = "insert-random/" } || - { resource.service.name = "python-not-supported" && span.http.route = "insert-random/" } || { resource.service.name = "python-min-version" && span.http.route = "insert-random/" } expected: - count: 27 # 14 before +13 new ones + count: 26 # 13 before +13 new ones diff --git a/tests/e2e/workload-lifecycle/README.md b/tests/e2e/workload-lifecycle/README.md index d8336a5d6..47ffb35de 100644 --- a/tests/e2e/workload-lifecycle/README.md +++ b/tests/e2e/workload-lifecycle/README.md @@ -106,17 +106,6 @@ This e2e test verify various scenarios related to the lifecycle of workloads in - Workload with a language odigos does not support. - Should not be instrumented or restarted. -## Multi Language Workloads - -### language-change - -A workload that starts as nodejs in step 1 and changes to cpp (unknown in odigos) in step 2. -This is not very realistic, but it's a way to test if odigos can handle a change in the workload language. -Since the runtime detection mechanism is not bullet-proof, we can't guarantee that the detected language will not modify from known to unknown and vice-versa. -In case we run into this scenario, we should be able to handle it gracefully. - -It would be best to simulate a more realistic scenario where the workload still runs nodejs but it is not detected. however, this is more complex and is left for future improvements. - ## Steps ## Step 01 - Deploy Initial Workloads and Instrumentation @@ -155,11 +144,6 @@ Verify the expected state for each workload according to it's caracteristics. - cpp-http-server - should NOT detect the runtime language and report it as `unknown` - should NOT add instrumentation device -- language-change - - should detect the runtime version - - should add instrumentation device - - should report health in the instrumented instance CR - - agent should load and report traces ## Step 02 - Update Workload Manifest @@ -189,8 +173,4 @@ This steps will make a change in the workload manifests and make sure that after - it should report traces - cpp-http-server - deployment manifest should be patched by odigos - - workload should not restart and agent should not load -- language-change - - deployment should revert the instrumentation device - - deployment should revert the injected env vars - - deployment should remove the env override annotation + - workload should not restart and agent should not load \ No newline at end of file diff --git a/tests/e2e/workload-lifecycle/chainsaw-test.yaml b/tests/e2e/workload-lifecycle/chainsaw-test.yaml index a08c235a1..9359550c0 100644 --- a/tests/e2e/workload-lifecycle/chainsaw-test.yaml +++ b/tests/e2e/workload-lifecycle/chainsaw-test.yaml @@ -174,13 +174,6 @@ spec: try: - apply: file: 02-update-workload-manifests.yaml - - script: - timeout: 60s - content: | - # this is temporary and is here to trigger runtime detection after the language-change deployment is updated to simulate this scenario. - # after the migration to the new runtime detection mechanism, we will no longer need to restart the instrumentor. - kubectl rollout restart deployment odigos-instrumentor -n odigos-test - sleep 30 - assert: file: 02-assert-workload-update.yaml