diff --git a/api/actions/v1alpha1/k8sattributes_types.go b/api/actions/v1alpha1/k8sattributes_types.go index 50caac1445..9fcaa278ec 100644 --- a/api/actions/v1alpha1/k8sattributes_types.go +++ b/api/actions/v1alpha1/k8sattributes_types.go @@ -88,12 +88,12 @@ type K8sAttributesStatus struct { //+genclient //+kubebuilder:object:root=true //+kubebuilder:subresource:status -//+kubebuilder:resource:path=k8sattributes,scope=Namespaced +//+kubebuilder:resource:path=k8sattributesresolvers,scope=Namespaced //+kubebuilder:metadata:labels=metadata.labels.odigos.io/config=1 //+kubebuilder:metadata:labels=metadata.labels.odigos.io/system-object=true -// K8sAttributes allows adding an action to collect k8s attributes. -type K8sAttributes struct { +// K8sAttributesResolver allows adding an action to collect k8s attributes. +type K8sAttributesResolver struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -103,13 +103,13 @@ type K8sAttributes struct { //+kubebuilder:object:root=true -// K8sAttributesList contains a list of K8sAttributes -type K8sAttributesList struct { +// K8sAttributesResolverList contains a list of K8sAttributes +type K8sAttributesResolverList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []K8sAttributes `json:"items"` + Items []K8sAttributesResolver `json:"items"` } func init() { - SchemeBuilder.Register(&K8sAttributes{}, &K8sAttributesList{}) + SchemeBuilder.Register(&K8sAttributesResolver{}, &K8sAttributesResolverList{}) } diff --git a/api/actions/v1alpha1/zz_generated.deepcopy.go b/api/actions/v1alpha1/zz_generated.deepcopy.go index 087ff0afa4..1a77a34880 100644 --- a/api/actions/v1alpha1/zz_generated.deepcopy.go +++ b/api/actions/v1alpha1/zz_generated.deepcopy.go @@ -372,7 +372,7 @@ func (in *K8sAnnotationAttribute) DeepCopy() *K8sAnnotationAttribute { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *K8sAttributes) DeepCopyInto(out *K8sAttributes) { +func (in *K8sAttributesResolver) DeepCopyInto(out *K8sAttributesResolver) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -380,18 +380,18 @@ func (in *K8sAttributes) DeepCopyInto(out *K8sAttributes) { in.Status.DeepCopyInto(&out.Status) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new K8sAttributes. -func (in *K8sAttributes) DeepCopy() *K8sAttributes { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new K8sAttributesResolver. +func (in *K8sAttributesResolver) DeepCopy() *K8sAttributesResolver { if in == nil { return nil } - out := new(K8sAttributes) + out := new(K8sAttributesResolver) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *K8sAttributes) DeepCopyObject() runtime.Object { +func (in *K8sAttributesResolver) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -399,31 +399,31 @@ func (in *K8sAttributes) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *K8sAttributesList) DeepCopyInto(out *K8sAttributesList) { +func (in *K8sAttributesResolverList) DeepCopyInto(out *K8sAttributesResolverList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]K8sAttributes, len(*in)) + *out = make([]K8sAttributesResolver, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new K8sAttributesList. -func (in *K8sAttributesList) DeepCopy() *K8sAttributesList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new K8sAttributesResolverList. +func (in *K8sAttributesResolverList) DeepCopy() *K8sAttributesResolverList { if in == nil { return nil } - out := new(K8sAttributesList) + out := new(K8sAttributesResolverList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *K8sAttributesList) DeepCopyObject() runtime.Object { +func (in *K8sAttributesResolverList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } diff --git a/api/config/crd/bases/actions.odigos.io_k8sattributesresolvers.yaml b/api/config/crd/bases/actions.odigos.io_k8sattributesresolvers.yaml new file mode 100644 index 0000000000..bf9decec8e --- /dev/null +++ b/api/config/crd/bases/actions.odigos.io_k8sattributesresolvers.yaml @@ -0,0 +1,194 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.1 + labels: + metadata.labels.odigos.io/config: "1" + metadata.labels.odigos.io/system-object: "true" + name: k8sattributesresolvers.actions.odigos.io +spec: + group: actions.odigos.io + names: + kind: K8sAttributesResolver + listKind: K8sAttributesResolverList + plural: k8sattributesresolvers + singular: k8sattributesresolver + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: K8sAttributesResolver allows adding an action to collect k8s + attributes. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + properties: + actionName: + type: string + annotationsAttributes: + description: list of annotations to be extracted from the pod, and + the attribute key to be used for the resource attribute created + from each annotation. + items: + properties: + annotationKey: + description: |- + The label name to be extracted from the pod. + e.g. "kubectl.kubernetes.io/restartedAt" + type: string + attributeKey: + description: |- + The attribute key to be used for the resource attribute created from the label. + e.g. "kubectl.kubernetes.restartedAte" + type: string + required: + - annotationKey + - attributeKey + type: object + type: array + collectClusterUID: + description: Collect the k8s.cluster.uid attribute, which is set to + the uid of the namespace "kube-system" + type: boolean + collectContainerAttributes: + description: |- + Collect the following container related attributes: + k8s.container.name + container.id + container.image.name + container.image.tag + type: boolean + collectWorkloadUID: + description: |- + Collect the following workload UID attributes: + k8s.deployment.uid + k8s.daemonset.uid + k8s.statefulset.uid + type: boolean + disabled: + type: boolean + labelsAttributes: + description: list of labels to be extracted from the pod, and the + attribute key to be used for the resource attribute created from + each label. + items: + properties: + attributeKey: + description: |- + The attribute key to be used for the resource attribute created from the label. + e.g. "app.kubernetes.name" + type: string + labelKey: + description: |- + The label name to be extracted from the pod. + e.g. "app.kubernetes.io/name" + type: string + required: + - attributeKey + - labelKey + type: object + type: array + notes: + type: string + signals: + items: + enum: + - LOGS + - TRACES + - METRICS + type: string + type: array + required: + - signals + type: object + status: + description: K8sAttributesStatus defines the observed state of K8sAttributes + action + properties: + conditions: + description: |- + Represents the observations of a k8sattributes' current state. + Known .status.conditions.type are: "Available", "Progressing" + 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 + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml b/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml index a4327066b1..bff82ce4db 100644 --- a/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml +++ b/api/config/crd/bases/odigos.io_instrumentationconfigs.yaml @@ -46,6 +46,13 @@ spec: description: determines if odigos should inject agents to pods of this workload. type: boolean + agentsMetaHash: + description: |- + this hash is used to determine the deployment of the agents. + e.g. when the distro for container changes, or it's compatibility version, + or something else that requires rollout, the hash change will indicate that. + if the hash is empty, it means that no agent should be enabled in any pod container. + type: string containers: description: configuration for each instrumented container in the workload @@ -611,9 +618,9 @@ spec: type: array workloadRolloutHash: description: |- - The hash used to determine whether the associated workload needs to be rolled out. - This hash is calculated based on the containers config array and takes into account the - container name, Instrumented flag and the OTel distro name. + This hash is recorded only after the rollout took place. + it allows us to determine if the workload needs to be rollout based on previous rollout and the current config. + if this field is different than the spec.AgentsDeploymentHash it means rollout is needed or not yet updated. type: string type: object type: object diff --git a/api/generated/actions/applyconfiguration/actions/v1alpha1/k8sattributes.go b/api/generated/actions/applyconfiguration/actions/v1alpha1/k8sattributesresolver.go similarity index 75% rename from api/generated/actions/applyconfiguration/actions/v1alpha1/k8sattributes.go rename to api/generated/actions/applyconfiguration/actions/v1alpha1/k8sattributesresolver.go index a800f493a5..78d141f9ed 100644 --- a/api/generated/actions/applyconfiguration/actions/v1alpha1/k8sattributes.go +++ b/api/generated/actions/applyconfiguration/actions/v1alpha1/k8sattributesresolver.go @@ -23,22 +23,22 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// K8sAttributesApplyConfiguration represents a declarative configuration of the K8sAttributes type for use +// K8sAttributesResolverApplyConfiguration represents a declarative configuration of the K8sAttributesResolver type for use // with apply. -type K8sAttributesApplyConfiguration struct { +type K8sAttributesResolverApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` Spec *K8sAttributesSpecApplyConfiguration `json:"spec,omitempty"` Status *K8sAttributesStatusApplyConfiguration `json:"status,omitempty"` } -// K8sAttributes constructs a declarative configuration of the K8sAttributes type for use with +// K8sAttributesResolver constructs a declarative configuration of the K8sAttributesResolver type for use with // apply. -func K8sAttributes(name, namespace string) *K8sAttributesApplyConfiguration { - b := &K8sAttributesApplyConfiguration{} +func K8sAttributesResolver(name, namespace string) *K8sAttributesResolverApplyConfiguration { + b := &K8sAttributesResolverApplyConfiguration{} b.WithName(name) b.WithNamespace(namespace) - b.WithKind("K8sAttributes") + b.WithKind("K8sAttributesResolver") b.WithAPIVersion("actions/v1alpha1") return b } @@ -46,7 +46,7 @@ func K8sAttributes(name, namespace string) *K8sAttributesApplyConfiguration { // WithKind sets the Kind field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Kind field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithKind(value string) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithKind(value string) *K8sAttributesResolverApplyConfiguration { b.TypeMetaApplyConfiguration.Kind = &value return b } @@ -54,7 +54,7 @@ func (b *K8sAttributesApplyConfiguration) WithKind(value string) *K8sAttributesA // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the APIVersion field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithAPIVersion(value string) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithAPIVersion(value string) *K8sAttributesResolverApplyConfiguration { b.TypeMetaApplyConfiguration.APIVersion = &value return b } @@ -62,7 +62,7 @@ func (b *K8sAttributesApplyConfiguration) WithAPIVersion(value string) *K8sAttri // WithName sets the Name field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Name field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithName(value string) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithName(value string) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Name = &value return b @@ -71,7 +71,7 @@ func (b *K8sAttributesApplyConfiguration) WithName(value string) *K8sAttributesA // WithGenerateName sets the GenerateName field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the GenerateName field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithGenerateName(value string) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithGenerateName(value string) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.GenerateName = &value return b @@ -80,7 +80,7 @@ func (b *K8sAttributesApplyConfiguration) WithGenerateName(value string) *K8sAtt // WithNamespace sets the Namespace field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Namespace field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithNamespace(value string) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithNamespace(value string) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Namespace = &value return b @@ -89,7 +89,7 @@ func (b *K8sAttributesApplyConfiguration) WithNamespace(value string) *K8sAttrib // WithUID sets the UID field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the UID field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithUID(value types.UID) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithUID(value types.UID) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.UID = &value return b @@ -98,7 +98,7 @@ func (b *K8sAttributesApplyConfiguration) WithUID(value types.UID) *K8sAttribute // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithResourceVersion(value string) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithResourceVersion(value string) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.ResourceVersion = &value return b @@ -107,7 +107,7 @@ func (b *K8sAttributesApplyConfiguration) WithResourceVersion(value string) *K8s // WithGeneration sets the Generation field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Generation field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithGeneration(value int64) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithGeneration(value int64) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Generation = &value return b @@ -116,7 +116,7 @@ func (b *K8sAttributesApplyConfiguration) WithGeneration(value int64) *K8sAttrib // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithCreationTimestamp(value metav1.Time) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithCreationTimestamp(value metav1.Time) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.CreationTimestamp = &value return b @@ -125,7 +125,7 @@ func (b *K8sAttributesApplyConfiguration) WithCreationTimestamp(value metav1.Tim // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value return b @@ -134,7 +134,7 @@ func (b *K8sAttributesApplyConfiguration) WithDeletionTimestamp(value metav1.Tim // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value return b @@ -144,7 +144,7 @@ func (b *K8sAttributesApplyConfiguration) WithDeletionGracePeriodSeconds(value i // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Labels field, // overwriting an existing map entries in Labels field with the same key. -func (b *K8sAttributesApplyConfiguration) WithLabels(entries map[string]string) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithLabels(entries map[string]string) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) @@ -159,7 +159,7 @@ func (b *K8sAttributesApplyConfiguration) WithLabels(entries map[string]string) // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Annotations field, // overwriting an existing map entries in Annotations field with the same key. -func (b *K8sAttributesApplyConfiguration) WithAnnotations(entries map[string]string) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithAnnotations(entries map[string]string) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) @@ -173,7 +173,7 @@ func (b *K8sAttributesApplyConfiguration) WithAnnotations(entries map[string]str // WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field. -func (b *K8sAttributesApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() for i := range values { if values[i] == nil { @@ -187,7 +187,7 @@ func (b *K8sAttributesApplyConfiguration) WithOwnerReferences(values ...*v1.Owne // WithFinalizers adds the given value to the Finalizers 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 Finalizers field. -func (b *K8sAttributesApplyConfiguration) WithFinalizers(values ...string) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithFinalizers(values ...string) *K8sAttributesResolverApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() for i := range values { b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) @@ -195,7 +195,7 @@ func (b *K8sAttributesApplyConfiguration) WithFinalizers(values ...string) *K8sA return b } -func (b *K8sAttributesApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { +func (b *K8sAttributesResolverApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { if b.ObjectMetaApplyConfiguration == nil { b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} } @@ -204,7 +204,7 @@ func (b *K8sAttributesApplyConfiguration) ensureObjectMetaApplyConfigurationExis // WithSpec sets the Spec field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Spec field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithSpec(value *K8sAttributesSpecApplyConfiguration) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithSpec(value *K8sAttributesSpecApplyConfiguration) *K8sAttributesResolverApplyConfiguration { b.Spec = value return b } @@ -212,13 +212,13 @@ func (b *K8sAttributesApplyConfiguration) WithSpec(value *K8sAttributesSpecApply // WithStatus sets the Status field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Status field is set to the value of the last call. -func (b *K8sAttributesApplyConfiguration) WithStatus(value *K8sAttributesStatusApplyConfiguration) *K8sAttributesApplyConfiguration { +func (b *K8sAttributesResolverApplyConfiguration) WithStatus(value *K8sAttributesStatusApplyConfiguration) *K8sAttributesResolverApplyConfiguration { b.Status = value return b } // GetName retrieves the value of the Name field in the declarative configuration. -func (b *K8sAttributesApplyConfiguration) GetName() *string { +func (b *K8sAttributesResolverApplyConfiguration) GetName() *string { b.ensureObjectMetaApplyConfigurationExists() return b.ObjectMetaApplyConfiguration.Name } diff --git a/api/generated/actions/applyconfiguration/utils.go b/api/generated/actions/applyconfiguration/utils.go index 5c9b0a32df..9abef4bbcc 100644 --- a/api/generated/actions/applyconfiguration/utils.go +++ b/api/generated/actions/applyconfiguration/utils.go @@ -53,8 +53,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &actionsv1alpha1.HttpRouteFilterApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("K8sAnnotationAttribute"): return &actionsv1alpha1.K8sAnnotationAttributeApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("K8sAttributes"): - return &actionsv1alpha1.K8sAttributesApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("K8sAttributesResolver"): + return &actionsv1alpha1.K8sAttributesResolverApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("K8sAttributesSpec"): return &actionsv1alpha1.K8sAttributesSpecApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("K8sAttributesStatus"): diff --git a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/actions_client.go b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/actions_client.go index 143d7b0d29..79160fae96 100644 --- a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/actions_client.go +++ b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/actions_client.go @@ -30,7 +30,7 @@ type ActionsV1alpha1Interface interface { AddClusterInfosGetter DeleteAttributesGetter ErrorSamplersGetter - K8sAttributesesGetter + K8sAttributesResolversGetter LatencySamplersGetter PiiMaskingsGetter ProbabilisticSamplersGetter @@ -54,8 +54,8 @@ func (c *ActionsV1alpha1Client) ErrorSamplers(namespace string) ErrorSamplerInte return newErrorSamplers(c, namespace) } -func (c *ActionsV1alpha1Client) K8sAttributeses(namespace string) K8sAttributesInterface { - return newK8sAttributeses(c, namespace) +func (c *ActionsV1alpha1Client) K8sAttributesResolvers(namespace string) K8sAttributesResolverInterface { + return newK8sAttributesResolvers(c, namespace) } func (c *ActionsV1alpha1Client) LatencySamplers(namespace string) LatencySamplerInterface { diff --git a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/fake/fake_actions_client.go b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/fake/fake_actions_client.go index f55e4d9895..4906e5496d 100644 --- a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/fake/fake_actions_client.go +++ b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/fake/fake_actions_client.go @@ -39,8 +39,8 @@ func (c *FakeActionsV1alpha1) ErrorSamplers(namespace string) v1alpha1.ErrorSamp return newFakeErrorSamplers(c, namespace) } -func (c *FakeActionsV1alpha1) K8sAttributeses(namespace string) v1alpha1.K8sAttributesInterface { - return newFakeK8sAttributeses(c, namespace) +func (c *FakeActionsV1alpha1) K8sAttributesResolvers(namespace string) v1alpha1.K8sAttributesResolverInterface { + return newFakeK8sAttributesResolvers(c, namespace) } func (c *FakeActionsV1alpha1) LatencySamplers(namespace string) v1alpha1.LatencySamplerInterface { diff --git a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/fake/fake_k8sattributes.go b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/fake/fake_k8sattributes.go deleted file mode 100644 index d4b56ecbe4..0000000000 --- a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/fake/fake_k8sattributes.go +++ /dev/null @@ -1,52 +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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha1 "github.com/odigos-io/odigos/api/actions/v1alpha1" - actionsv1alpha1 "github.com/odigos-io/odigos/api/generated/actions/applyconfiguration/actions/v1alpha1" - typedactionsv1alpha1 "github.com/odigos-io/odigos/api/generated/actions/clientset/versioned/typed/actions/v1alpha1" - gentype "k8s.io/client-go/gentype" -) - -// fakeK8sAttributeses implements K8sAttributesInterface -type fakeK8sAttributeses struct { - *gentype.FakeClientWithListAndApply[*v1alpha1.K8sAttributes, *v1alpha1.K8sAttributesList, *actionsv1alpha1.K8sAttributesApplyConfiguration] - Fake *FakeActionsV1alpha1 -} - -func newFakeK8sAttributeses(fake *FakeActionsV1alpha1, namespace string) typedactionsv1alpha1.K8sAttributesInterface { - return &fakeK8sAttributeses{ - gentype.NewFakeClientWithListAndApply[*v1alpha1.K8sAttributes, *v1alpha1.K8sAttributesList, *actionsv1alpha1.K8sAttributesApplyConfiguration]( - fake.Fake, - namespace, - v1alpha1.SchemeGroupVersion.WithResource("k8sattributeses"), - v1alpha1.SchemeGroupVersion.WithKind("K8sAttributes"), - func() *v1alpha1.K8sAttributes { return &v1alpha1.K8sAttributes{} }, - func() *v1alpha1.K8sAttributesList { return &v1alpha1.K8sAttributesList{} }, - func(dst, src *v1alpha1.K8sAttributesList) { dst.ListMeta = src.ListMeta }, - func(list *v1alpha1.K8sAttributesList) []*v1alpha1.K8sAttributes { - return gentype.ToPointerSlice(list.Items) - }, - func(list *v1alpha1.K8sAttributesList, items []*v1alpha1.K8sAttributes) { - list.Items = gentype.FromPointerSlice(items) - }, - ), - fake, - } -} diff --git a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/fake/fake_k8sattributesresolver.go b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/fake/fake_k8sattributesresolver.go new file mode 100644 index 0000000000..579fed30c1 --- /dev/null +++ b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/fake/fake_k8sattributesresolver.go @@ -0,0 +1,52 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/odigos-io/odigos/api/actions/v1alpha1" + actionsv1alpha1 "github.com/odigos-io/odigos/api/generated/actions/applyconfiguration/actions/v1alpha1" + typedactionsv1alpha1 "github.com/odigos-io/odigos/api/generated/actions/clientset/versioned/typed/actions/v1alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeK8sAttributesResolvers implements K8sAttributesResolverInterface +type fakeK8sAttributesResolvers struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.K8sAttributesResolver, *v1alpha1.K8sAttributesResolverList, *actionsv1alpha1.K8sAttributesResolverApplyConfiguration] + Fake *FakeActionsV1alpha1 +} + +func newFakeK8sAttributesResolvers(fake *FakeActionsV1alpha1, namespace string) typedactionsv1alpha1.K8sAttributesResolverInterface { + return &fakeK8sAttributesResolvers{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.K8sAttributesResolver, *v1alpha1.K8sAttributesResolverList, *actionsv1alpha1.K8sAttributesResolverApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("k8sattributesresolvers"), + v1alpha1.SchemeGroupVersion.WithKind("K8sAttributesResolver"), + func() *v1alpha1.K8sAttributesResolver { return &v1alpha1.K8sAttributesResolver{} }, + func() *v1alpha1.K8sAttributesResolverList { return &v1alpha1.K8sAttributesResolverList{} }, + func(dst, src *v1alpha1.K8sAttributesResolverList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.K8sAttributesResolverList) []*v1alpha1.K8sAttributesResolver { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.K8sAttributesResolverList, items []*v1alpha1.K8sAttributesResolver) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/generated_expansion.go b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/generated_expansion.go index 6a85a67059..ede72c28cd 100644 --- a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/generated_expansion.go +++ b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/generated_expansion.go @@ -23,7 +23,7 @@ type DeleteAttributeExpansion interface{} type ErrorSamplerExpansion interface{} -type K8sAttributesExpansion interface{} +type K8sAttributesResolverExpansion interface{} type LatencySamplerExpansion interface{} diff --git a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/k8sattributes.go b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/k8sattributes.go deleted file mode 100644 index cc2b53a610..0000000000 --- a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/k8sattributes.go +++ /dev/null @@ -1,73 +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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - context "context" - - actionsv1alpha1 "github.com/odigos-io/odigos/api/actions/v1alpha1" - applyconfigurationactionsv1alpha1 "github.com/odigos-io/odigos/api/generated/actions/applyconfiguration/actions/v1alpha1" - scheme "github.com/odigos-io/odigos/api/generated/actions/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - gentype "k8s.io/client-go/gentype" -) - -// K8sAttributesesGetter has a method to return a K8sAttributesInterface. -// A group's client should implement this interface. -type K8sAttributesesGetter interface { - K8sAttributeses(namespace string) K8sAttributesInterface -} - -// K8sAttributesInterface has methods to work with K8sAttributes resources. -type K8sAttributesInterface interface { - Create(ctx context.Context, k8sAttributes *actionsv1alpha1.K8sAttributes, opts v1.CreateOptions) (*actionsv1alpha1.K8sAttributes, error) - Update(ctx context.Context, k8sAttributes *actionsv1alpha1.K8sAttributes, opts v1.UpdateOptions) (*actionsv1alpha1.K8sAttributes, error) - // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, k8sAttributes *actionsv1alpha1.K8sAttributes, opts v1.UpdateOptions) (*actionsv1alpha1.K8sAttributes, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*actionsv1alpha1.K8sAttributes, error) - List(ctx context.Context, opts v1.ListOptions) (*actionsv1alpha1.K8sAttributesList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *actionsv1alpha1.K8sAttributes, err error) - Apply(ctx context.Context, k8sAttributes *applyconfigurationactionsv1alpha1.K8sAttributesApplyConfiguration, opts v1.ApplyOptions) (result *actionsv1alpha1.K8sAttributes, err error) - // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). - ApplyStatus(ctx context.Context, k8sAttributes *applyconfigurationactionsv1alpha1.K8sAttributesApplyConfiguration, opts v1.ApplyOptions) (result *actionsv1alpha1.K8sAttributes, err error) - K8sAttributesExpansion -} - -// k8sAttributeses implements K8sAttributesInterface -type k8sAttributeses struct { - *gentype.ClientWithListAndApply[*actionsv1alpha1.K8sAttributes, *actionsv1alpha1.K8sAttributesList, *applyconfigurationactionsv1alpha1.K8sAttributesApplyConfiguration] -} - -// newK8sAttributeses returns a K8sAttributeses -func newK8sAttributeses(c *ActionsV1alpha1Client, namespace string) *k8sAttributeses { - return &k8sAttributeses{ - gentype.NewClientWithListAndApply[*actionsv1alpha1.K8sAttributes, *actionsv1alpha1.K8sAttributesList, *applyconfigurationactionsv1alpha1.K8sAttributesApplyConfiguration]( - "k8sattributeses", - c.RESTClient(), - scheme.ParameterCodec, - namespace, - func() *actionsv1alpha1.K8sAttributes { return &actionsv1alpha1.K8sAttributes{} }, - func() *actionsv1alpha1.K8sAttributesList { return &actionsv1alpha1.K8sAttributesList{} }, - ), - } -} diff --git a/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/k8sattributesresolver.go b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/k8sattributesresolver.go new file mode 100644 index 0000000000..18416032af --- /dev/null +++ b/api/generated/actions/clientset/versioned/typed/actions/v1alpha1/k8sattributesresolver.go @@ -0,0 +1,73 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + actionsv1alpha1 "github.com/odigos-io/odigos/api/actions/v1alpha1" + applyconfigurationactionsv1alpha1 "github.com/odigos-io/odigos/api/generated/actions/applyconfiguration/actions/v1alpha1" + scheme "github.com/odigos-io/odigos/api/generated/actions/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// K8sAttributesResolversGetter has a method to return a K8sAttributesResolverInterface. +// A group's client should implement this interface. +type K8sAttributesResolversGetter interface { + K8sAttributesResolvers(namespace string) K8sAttributesResolverInterface +} + +// K8sAttributesResolverInterface has methods to work with K8sAttributesResolver resources. +type K8sAttributesResolverInterface interface { + Create(ctx context.Context, k8sAttributesResolver *actionsv1alpha1.K8sAttributesResolver, opts v1.CreateOptions) (*actionsv1alpha1.K8sAttributesResolver, error) + Update(ctx context.Context, k8sAttributesResolver *actionsv1alpha1.K8sAttributesResolver, opts v1.UpdateOptions) (*actionsv1alpha1.K8sAttributesResolver, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, k8sAttributesResolver *actionsv1alpha1.K8sAttributesResolver, opts v1.UpdateOptions) (*actionsv1alpha1.K8sAttributesResolver, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*actionsv1alpha1.K8sAttributesResolver, error) + List(ctx context.Context, opts v1.ListOptions) (*actionsv1alpha1.K8sAttributesResolverList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *actionsv1alpha1.K8sAttributesResolver, err error) + Apply(ctx context.Context, k8sAttributesResolver *applyconfigurationactionsv1alpha1.K8sAttributesResolverApplyConfiguration, opts v1.ApplyOptions) (result *actionsv1alpha1.K8sAttributesResolver, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, k8sAttributesResolver *applyconfigurationactionsv1alpha1.K8sAttributesResolverApplyConfiguration, opts v1.ApplyOptions) (result *actionsv1alpha1.K8sAttributesResolver, err error) + K8sAttributesResolverExpansion +} + +// k8sAttributesResolvers implements K8sAttributesResolverInterface +type k8sAttributesResolvers struct { + *gentype.ClientWithListAndApply[*actionsv1alpha1.K8sAttributesResolver, *actionsv1alpha1.K8sAttributesResolverList, *applyconfigurationactionsv1alpha1.K8sAttributesResolverApplyConfiguration] +} + +// newK8sAttributesResolvers returns a K8sAttributesResolvers +func newK8sAttributesResolvers(c *ActionsV1alpha1Client, namespace string) *k8sAttributesResolvers { + return &k8sAttributesResolvers{ + gentype.NewClientWithListAndApply[*actionsv1alpha1.K8sAttributesResolver, *actionsv1alpha1.K8sAttributesResolverList, *applyconfigurationactionsv1alpha1.K8sAttributesResolverApplyConfiguration]( + "k8sattributesresolvers", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *actionsv1alpha1.K8sAttributesResolver { return &actionsv1alpha1.K8sAttributesResolver{} }, + func() *actionsv1alpha1.K8sAttributesResolverList { return &actionsv1alpha1.K8sAttributesResolverList{} }, + ), + } +} diff --git a/api/generated/actions/informers/externalversions/actions/v1alpha1/interface.go b/api/generated/actions/informers/externalversions/actions/v1alpha1/interface.go index 003a060809..bd79e47b76 100644 --- a/api/generated/actions/informers/externalversions/actions/v1alpha1/interface.go +++ b/api/generated/actions/informers/externalversions/actions/v1alpha1/interface.go @@ -29,8 +29,8 @@ type Interface interface { DeleteAttributes() DeleteAttributeInformer // ErrorSamplers returns a ErrorSamplerInformer. ErrorSamplers() ErrorSamplerInformer - // K8sAttributeses returns a K8sAttributesInformer. - K8sAttributeses() K8sAttributesInformer + // K8sAttributesResolvers returns a K8sAttributesResolverInformer. + K8sAttributesResolvers() K8sAttributesResolverInformer // LatencySamplers returns a LatencySamplerInformer. LatencySamplers() LatencySamplerInformer // PiiMaskings returns a PiiMaskingInformer. @@ -67,9 +67,9 @@ func (v *version) ErrorSamplers() ErrorSamplerInformer { return &errorSamplerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// K8sAttributeses returns a K8sAttributesInformer. -func (v *version) K8sAttributeses() K8sAttributesInformer { - return &k8sAttributesInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +// K8sAttributesResolvers returns a K8sAttributesResolverInformer. +func (v *version) K8sAttributesResolvers() K8sAttributesResolverInformer { + return &k8sAttributesResolverInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // LatencySamplers returns a LatencySamplerInformer. diff --git a/api/generated/actions/informers/externalversions/actions/v1alpha1/k8sattributes.go b/api/generated/actions/informers/externalversions/actions/v1alpha1/k8sattributesresolver.go similarity index 55% rename from api/generated/actions/informers/externalversions/actions/v1alpha1/k8sattributes.go rename to api/generated/actions/informers/externalversions/actions/v1alpha1/k8sattributesresolver.go index b8742fe3f5..5226393805 100644 --- a/api/generated/actions/informers/externalversions/actions/v1alpha1/k8sattributes.go +++ b/api/generated/actions/informers/externalversions/actions/v1alpha1/k8sattributesresolver.go @@ -31,59 +31,59 @@ import ( cache "k8s.io/client-go/tools/cache" ) -// K8sAttributesInformer provides access to a shared informer and lister for -// K8sAttributeses. -type K8sAttributesInformer interface { +// K8sAttributesResolverInformer provides access to a shared informer and lister for +// K8sAttributesResolvers. +type K8sAttributesResolverInformer interface { Informer() cache.SharedIndexInformer - Lister() actionsv1alpha1.K8sAttributesLister + Lister() actionsv1alpha1.K8sAttributesResolverLister } -type k8sAttributesInformer struct { +type k8sAttributesResolverInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } -// NewK8sAttributesInformer constructs a new informer for K8sAttributes type. +// NewK8sAttributesResolverInformer constructs a new informer for K8sAttributesResolver type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewK8sAttributesInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredK8sAttributesInformer(client, namespace, resyncPeriod, indexers, nil) +func NewK8sAttributesResolverInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredK8sAttributesResolverInformer(client, namespace, resyncPeriod, indexers, nil) } -// NewFilteredK8sAttributesInformer constructs a new informer for K8sAttributes type. +// NewFilteredK8sAttributesResolverInformer constructs a new informer for K8sAttributesResolver type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewFilteredK8sAttributesInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredK8sAttributesResolverInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.ActionsV1alpha1().K8sAttributeses(namespace).List(context.TODO(), options) + return client.ActionsV1alpha1().K8sAttributesResolvers(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.ActionsV1alpha1().K8sAttributeses(namespace).Watch(context.TODO(), options) + return client.ActionsV1alpha1().K8sAttributesResolvers(namespace).Watch(context.TODO(), options) }, }, - &apiactionsv1alpha1.K8sAttributes{}, + &apiactionsv1alpha1.K8sAttributesResolver{}, resyncPeriod, indexers, ) } -func (f *k8sAttributesInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredK8sAttributesInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +func (f *k8sAttributesResolverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredK8sAttributesResolverInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } -func (f *k8sAttributesInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiactionsv1alpha1.K8sAttributes{}, f.defaultInformer) +func (f *k8sAttributesResolverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiactionsv1alpha1.K8sAttributesResolver{}, f.defaultInformer) } -func (f *k8sAttributesInformer) Lister() actionsv1alpha1.K8sAttributesLister { - return actionsv1alpha1.NewK8sAttributesLister(f.Informer().GetIndexer()) +func (f *k8sAttributesResolverInformer) Lister() actionsv1alpha1.K8sAttributesResolverLister { + return actionsv1alpha1.NewK8sAttributesResolverLister(f.Informer().GetIndexer()) } diff --git a/api/generated/actions/informers/externalversions/generic.go b/api/generated/actions/informers/externalversions/generic.go index b980c24c29..30b35fa5f3 100644 --- a/api/generated/actions/informers/externalversions/generic.go +++ b/api/generated/actions/informers/externalversions/generic.go @@ -58,8 +58,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Actions().V1alpha1().DeleteAttributes().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("errorsamplers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Actions().V1alpha1().ErrorSamplers().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("k8sattributeses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Actions().V1alpha1().K8sAttributeses().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("k8sattributesresolvers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Actions().V1alpha1().K8sAttributesResolvers().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("latencysamplers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Actions().V1alpha1().LatencySamplers().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("piimaskings"): diff --git a/api/generated/actions/listers/actions/v1alpha1/expansion_generated.go b/api/generated/actions/listers/actions/v1alpha1/expansion_generated.go index f8f10f2ae8..6fb3968b15 100644 --- a/api/generated/actions/listers/actions/v1alpha1/expansion_generated.go +++ b/api/generated/actions/listers/actions/v1alpha1/expansion_generated.go @@ -41,13 +41,13 @@ type ErrorSamplerListerExpansion interface{} // ErrorSamplerNamespaceLister. type ErrorSamplerNamespaceListerExpansion interface{} -// K8sAttributesListerExpansion allows custom methods to be added to -// K8sAttributesLister. -type K8sAttributesListerExpansion interface{} +// K8sAttributesResolverListerExpansion allows custom methods to be added to +// K8sAttributesResolverLister. +type K8sAttributesResolverListerExpansion interface{} -// K8sAttributesNamespaceListerExpansion allows custom methods to be added to -// K8sAttributesNamespaceLister. -type K8sAttributesNamespaceListerExpansion interface{} +// K8sAttributesResolverNamespaceListerExpansion allows custom methods to be added to +// K8sAttributesResolverNamespaceLister. +type K8sAttributesResolverNamespaceListerExpansion interface{} // LatencySamplerListerExpansion allows custom methods to be added to // LatencySamplerLister. diff --git a/api/generated/actions/listers/actions/v1alpha1/k8sattributes.go b/api/generated/actions/listers/actions/v1alpha1/k8sattributes.go deleted file mode 100644 index 6b8c8c9057..0000000000 --- a/api/generated/actions/listers/actions/v1alpha1/k8sattributes.go +++ /dev/null @@ -1,69 +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. -*/ -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - actionsv1alpha1 "github.com/odigos-io/odigos/api/actions/v1alpha1" - labels "k8s.io/apimachinery/pkg/labels" - listers "k8s.io/client-go/listers" - cache "k8s.io/client-go/tools/cache" -) - -// K8sAttributesLister helps list K8sAttributeses. -// All objects returned here must be treated as read-only. -type K8sAttributesLister interface { - // List lists all K8sAttributeses in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*actionsv1alpha1.K8sAttributes, err error) - // K8sAttributeses returns an object that can list and get K8sAttributeses. - K8sAttributeses(namespace string) K8sAttributesNamespaceLister - K8sAttributesListerExpansion -} - -// k8sAttributesLister implements the K8sAttributesLister interface. -type k8sAttributesLister struct { - listers.ResourceIndexer[*actionsv1alpha1.K8sAttributes] -} - -// NewK8sAttributesLister returns a new K8sAttributesLister. -func NewK8sAttributesLister(indexer cache.Indexer) K8sAttributesLister { - return &k8sAttributesLister{listers.New[*actionsv1alpha1.K8sAttributes](indexer, actionsv1alpha1.Resource("k8sattributes"))} -} - -// K8sAttributeses returns an object that can list and get K8sAttributeses. -func (s *k8sAttributesLister) K8sAttributeses(namespace string) K8sAttributesNamespaceLister { - return k8sAttributesNamespaceLister{listers.NewNamespaced[*actionsv1alpha1.K8sAttributes](s.ResourceIndexer, namespace)} -} - -// K8sAttributesNamespaceLister helps list and get K8sAttributeses. -// All objects returned here must be treated as read-only. -type K8sAttributesNamespaceLister interface { - // List lists all K8sAttributeses in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*actionsv1alpha1.K8sAttributes, err error) - // Get retrieves the K8sAttributes from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*actionsv1alpha1.K8sAttributes, error) - K8sAttributesNamespaceListerExpansion -} - -// k8sAttributesNamespaceLister implements the K8sAttributesNamespaceLister -// interface. -type k8sAttributesNamespaceLister struct { - listers.ResourceIndexer[*actionsv1alpha1.K8sAttributes] -} diff --git a/api/generated/actions/listers/actions/v1alpha1/k8sattributesresolver.go b/api/generated/actions/listers/actions/v1alpha1/k8sattributesresolver.go new file mode 100644 index 0000000000..b67bc753cf --- /dev/null +++ b/api/generated/actions/listers/actions/v1alpha1/k8sattributesresolver.go @@ -0,0 +1,69 @@ +/* +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. +*/ +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + actionsv1alpha1 "github.com/odigos-io/odigos/api/actions/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// K8sAttributesResolverLister helps list K8sAttributesResolvers. +// All objects returned here must be treated as read-only. +type K8sAttributesResolverLister interface { + // List lists all K8sAttributesResolvers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*actionsv1alpha1.K8sAttributesResolver, err error) + // K8sAttributesResolvers returns an object that can list and get K8sAttributesResolvers. + K8sAttributesResolvers(namespace string) K8sAttributesResolverNamespaceLister + K8sAttributesResolverListerExpansion +} + +// k8sAttributesResolverLister implements the K8sAttributesResolverLister interface. +type k8sAttributesResolverLister struct { + listers.ResourceIndexer[*actionsv1alpha1.K8sAttributesResolver] +} + +// NewK8sAttributesResolverLister returns a new K8sAttributesResolverLister. +func NewK8sAttributesResolverLister(indexer cache.Indexer) K8sAttributesResolverLister { + return &k8sAttributesResolverLister{listers.New[*actionsv1alpha1.K8sAttributesResolver](indexer, actionsv1alpha1.Resource("k8sattributesresolver"))} +} + +// K8sAttributesResolvers returns an object that can list and get K8sAttributesResolvers. +func (s *k8sAttributesResolverLister) K8sAttributesResolvers(namespace string) K8sAttributesResolverNamespaceLister { + return k8sAttributesResolverNamespaceLister{listers.NewNamespaced[*actionsv1alpha1.K8sAttributesResolver](s.ResourceIndexer, namespace)} +} + +// K8sAttributesResolverNamespaceLister helps list and get K8sAttributesResolvers. +// All objects returned here must be treated as read-only. +type K8sAttributesResolverNamespaceLister interface { + // List lists all K8sAttributesResolvers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*actionsv1alpha1.K8sAttributesResolver, err error) + // Get retrieves the K8sAttributesResolver from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*actionsv1alpha1.K8sAttributesResolver, error) + K8sAttributesResolverNamespaceListerExpansion +} + +// k8sAttributesResolverNamespaceLister implements the K8sAttributesResolverNamespaceLister +// interface. +type k8sAttributesResolverNamespaceLister struct { + listers.ResourceIndexer[*actionsv1alpha1.K8sAttributesResolver] +} diff --git a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigspec.go b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigspec.go index 7a5c828cb3..f44a5a5127 100644 --- a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigspec.go +++ b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/instrumentationconfigspec.go @@ -23,6 +23,7 @@ type InstrumentationConfigSpecApplyConfiguration struct { ServiceName *string `json:"serviceName,omitempty"` AgentInjectionEnabled *bool `json:"agentInjectionEnabled,omitempty"` Containers []ContainerAgentConfigApplyConfiguration `json:"containers,omitempty"` + AgentsMetaHash *string `json:"agentsMetaHash,omitempty"` SdkConfigs []SdkConfigApplyConfiguration `json:"sdkConfigs,omitempty"` } @@ -61,6 +62,14 @@ func (b *InstrumentationConfigSpecApplyConfiguration) WithContainers(values ...* return b } +// WithAgentsMetaHash sets the AgentsMetaHash field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AgentsMetaHash field is set to the value of the last call. +func (b *InstrumentationConfigSpecApplyConfiguration) WithAgentsMetaHash(value string) *InstrumentationConfigSpecApplyConfiguration { + b.AgentsMetaHash = &value + return b +} + // WithSdkConfigs adds the given value to the SdkConfigs 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 SdkConfigs field. diff --git a/api/k8sconsts/resources.go b/api/k8sconsts/resources.go index 8cfe6b2aa8..f5b846efe3 100644 --- a/api/k8sconsts/resources.go +++ b/api/k8sconsts/resources.go @@ -1,6 +1,11 @@ package k8sconsts const ( + // OdigosAgentsMetaHashLabel is used to label pods being instrumented. + // It can be used to count the number of instrumented pods for a workload and whether they are up to date + // with the expected agents. + OdigosAgentsMetaHashLabel = "odigos.io/agents-meta-hash" + // OdigosCollectorRoleLabel is the label used to identify the role of the Odigos collector. OdigosCollectorRoleLabel = "odigos.io/collector-role" diff --git a/api/odigos/v1alpha1/instrumentationconfig_types.go b/api/odigos/v1alpha1/instrumentationconfig_types.go index 23291e3ea4..7e3afa709c 100644 --- a/api/odigos/v1alpha1/instrumentationconfig_types.go +++ b/api/odigos/v1alpha1/instrumentationconfig_types.go @@ -179,9 +179,9 @@ type InstrumentationConfigStatus struct { // Represents the observations of a InstrumentationConfig's current state. Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" protobuf:"bytes,1,rep,name=conditions"` - // The hash used to determine whether the associated workload needs to be rolled out. - // This hash is calculated based on the containers config array and takes into account the - // container name, Instrumented flag and the OTel distro name. + // This hash is recorded only after the rollout took place. + // it allows us to determine if the workload needs to be rollout based on previous rollout and the current config. + // if this field is different than the spec.AgentsDeploymentHash it means rollout is needed or not yet updated. WorkloadRolloutHash string `json:"workloadRolloutHash,omitempty"` } @@ -230,6 +230,12 @@ type InstrumentationConfigSpec struct { // configuration for each instrumented container in the workload Containers []ContainerAgentConfig `json:"containers,omitempty"` + // this hash is used to determine the deployment of the agents. + // e.g. when the distro for container changes, or it's compatibility version, + // or something else that requires rollout, the hash change will indicate that. + // if the hash is empty, it means that no agent should be enabled in any pod container. + AgentsMetaHash string `json:"agentsMetaHash,omitempty"` + // Configuration for the OpenTelemetry SDKs that this workload should use. // The SDKs are identified by the programming language they are written in. // TODO: consider adding more granular control over the SDKs, such as community/enterprise, native/ebpf. diff --git a/autoscaler/controllers/actions/k8sattributes_controller.go b/autoscaler/controllers/actions/k8sattributesresolver_controller.go similarity index 83% rename from autoscaler/controllers/actions/k8sattributes_controller.go rename to autoscaler/controllers/actions/k8sattributesresolver_controller.go index 852563e521..a0be8d082b 100644 --- a/autoscaler/controllers/actions/k8sattributes_controller.go +++ b/autoscaler/controllers/actions/k8sattributesresolver_controller.go @@ -3,13 +3,16 @@ package actions import ( "context" "encoding/json" + "errors" + "fmt" actionv1 "github.com/odigos-io/odigos/api/actions/v1alpha1" "github.com/odigos-io/odigos/api/k8sconsts" odigosv1alpha1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" "github.com/odigos-io/odigos/common" - semconv "go.opentelemetry.io/otel/semconv/v1.26.0" semconv1_21 "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.26.0" + "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" @@ -17,7 +20,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" ) -type K8sAttributesReconciler struct { +type K8sAttributesResolverReconciler struct { client.Client Scheme *runtime.Scheme } @@ -110,11 +113,11 @@ type k8sAttributesConfig struct { PodAssociation k8sAttributesPodsAssociation `json:"pod_association"` } -func (r *K8sAttributesReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { +func (r *K8sAttributesResolverReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { logger := log.FromContext(ctx) logger.V(0).Info("Reconciling K8sAttributes action") - actions := actionv1.K8sAttributesList{} + actions := actionv1.K8sAttributesResolverList{} err := r.List(ctx, &actions, client.InNamespace(req.Namespace)) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -125,11 +128,12 @@ func (r *K8sAttributesReconciler) Reconcile(ctx context.Context, req ctrl.Reques return ctrl.Result{}, err } - err = r.Patch(ctx, processor, client.Apply, client.FieldOwner("odigos-k8sattributes"), client.ForceOwnership) - return ctrl.Result{}, err + err = r.Patch(ctx, processor, client.Apply, client.FieldOwner("odigos-k8sattributesresolver"), client.ForceOwnership) + reportErr := r.reportActionsStatuses(ctx, &actions, err) + return ctrl.Result{}, errors.Join(err, reportErr) } -func (r *K8sAttributesReconciler) convertToUnifiedProcessor(actions *actionv1.K8sAttributesList, ns string) (*odigosv1alpha1.Processor, error) { +func (r *K8sAttributesResolverReconciler) convertToUnifiedProcessor(actions *actionv1.K8sAttributesResolverList, ns string) (*odigosv1alpha1.Processor, error) { processor := odigosv1alpha1.Processor{ TypeMeta: metav1.TypeMeta{ APIVersion: "odigos.io/v1alpha1", @@ -257,3 +261,34 @@ func (r *K8sAttributesReconciler) convertToUnifiedProcessor(actions *actionv1.K8 return &processor, nil } + +func (r *K8sAttributesResolverReconciler) reportActionsStatuses(ctx context.Context, actions *actionv1.K8sAttributesResolverList, processorErr error) error { + var updateErr error + status := metav1.ConditionTrue + message := "The action successfully transformed to a unified processor" + reason := "ProcessorCreated" + + if processorErr != nil { + status = metav1.ConditionFalse + message = fmt.Sprintf("Failed to transform the action to a unified processor: %s", processorErr.Error()) + reason = "ProcessorCreationFailed" + } + + for actionIndex := range actions.Items { + action := &actions.Items[actionIndex] + changed := meta.SetStatusCondition(&action.Status.Conditions, metav1.Condition{ + Type: "ActionTransformedToProcessorType", + Status: status, + Reason: reason, + Message: message, + }) + + if changed { + err := r.Status().Update(ctx, action) + updateErr = errors.Join(updateErr, err) + } + } + + + return updateErr +} diff --git a/autoscaler/controllers/actions/root.go b/autoscaler/controllers/actions/root.go index 22ac87e340..f56bff017f 100644 --- a/autoscaler/controllers/actions/root.go +++ b/autoscaler/controllers/actions/root.go @@ -77,8 +77,8 @@ func SetupWithManager(mgr ctrl.Manager) error { } err = ctrl.NewControllerManagedBy(mgr). - For(&v1.K8sAttributes{}). - Complete(&K8sAttributesReconciler{ + For(&v1.K8sAttributesResolver{}). + Complete(&K8sAttributesResolverReconciler{ Client: mgr.GetClient(), }) if err != nil { diff --git a/autoscaler/main.go b/autoscaler/main.go index 097482f5ae..ae6a8c320a 100644 --- a/autoscaler/main.go +++ b/autoscaler/main.go @@ -188,7 +188,7 @@ func main() { &apiactions.RenameAttribute{}: { Field: nsSelector, }, - &apiactions.K8sAttributes{}: { + &apiactions.K8sAttributesResolver{}: { Field: nsSelector, }, }, diff --git a/cli/cmd/resources/instrumentor.go b/cli/cmd/resources/instrumentor.go index 81e6eb966f..4d500a5cf0 100644 --- a/cli/cmd/resources/instrumentor.go +++ b/cli/cmd/resources/instrumentor.go @@ -157,6 +157,11 @@ func NewInstrumentorClusterRole(ownerPermissionEnforcement bool) *rbacv1.Cluster Resources: []string{"namespaces"}, Verbs: []string{"list", "watch", "get"}, }, + { // reconcile rollouts and instrumentation delpoyment status by actual odigos pods + APIGroups: []string{""}, + Resources: []string{"pods"}, + Verbs: []string{"get", "list", "watch"}, + }, { // Read instrumentation labels from daemonsets and apply pod spec changes APIGroups: []string{"apps"}, Resources: []string{"daemonsets"}, diff --git a/docs/api-reference/actions.odigos.io.v1alpha1.mdx b/docs/api-reference/actions.odigos.io.v1alpha1.mdx index fb493db77e..93f7f2d955 100644 --- a/docs/api-reference/actions.odigos.io.v1alpha1.mdx +++ b/docs/api-reference/actions.odigos.io.v1alpha1.mdx @@ -6,7 +6,7 @@ - [AddClusterInfo](#AddClusterInfo) - [DeleteAttribute](#DeleteAttribute) - [ErrorSampler](#ErrorSampler) -- [K8sAttributes](#K8sAttributes) +- [K8sAttributesResolver](#K8sAttributesResolver) - [LatencySampler](#LatencySampler) - [PiiMasking](#PiiMasking) - [ProbabilisticSampler](#ProbabilisticSampler) @@ -162,16 +162,16 @@ -## `K8sAttributes` +## `K8sAttributesResolver` -

K8sAttributes allows adding an action to collect k8s attributes.

+

K8sAttributesResolver allows adding an action to collect k8s attributes.

- + @@ -813,7 +813,7 @@ e.g. "kubectl.kubernetes.restartedAte"

**Appears in:** -- [K8sAttributes](#K8sAttributes) +- [K8sAttributesResolver](#K8sAttributesResolver)
FieldTypeDescription
apiVersionstring/v1alpha1
kindstringK8sAttributes
kindstringK8sAttributesResolver
@@ -934,7 +934,7 @@ k8s.statefulset.uid

**Appears in:** -- [K8sAttributes](#K8sAttributes) +- [K8sAttributesResolver](#K8sAttributesResolver)

K8sAttributesStatus defines the observed state of K8sAttributes action

diff --git a/docs/api-reference/odigos.io.v1alpha1.mdx b/docs/api-reference/odigos.io.v1alpha1.mdx index 684c59aa37..b33ea5b78c 100644 --- a/docs/api-reference/odigos.io.v1alpha1.mdx +++ b/docs/api-reference/odigos.io.v1alpha1.mdx @@ -1297,6 +1297,20 @@ The workload is identified by the owner reference

+ + + + + diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index fd4fd876d9..f975906525 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -138,10 +138,6 @@ type ComplexityRoot struct { MaxPayloadLength func(childComplexity int) int } - DeleteAttribute struct { - AttributeName func(childComplexity int) int - } - DeleteAttributeAction struct { Details func(childComplexity int) int Disable func(childComplexity int) int @@ -282,6 +278,34 @@ type ComplexityRoot struct { Selected func(childComplexity int) int } + K8sAnnotationAttribute struct { + AnnotationKey func(childComplexity int) int + AttributeKey func(childComplexity int) int + } + + K8sAttributes struct { + AnnotationsAttributes func(childComplexity int) int + CollectClusterID func(childComplexity int) int + CollectContainerAttributes func(childComplexity int) int + CollectWorkloadID func(childComplexity int) int + LabelsAttributes func(childComplexity int) int + } + + K8sAttributesAction struct { + Details func(childComplexity int) int + Disable func(childComplexity int) int + ID func(childComplexity int) int + Name func(childComplexity int) int + Notes func(childComplexity int) int + Signals func(childComplexity int) int + Type func(childComplexity int) int + } + + K8sLabelAttribute struct { + AttributeKey func(childComplexity int) int + LabelKey func(childComplexity int) int + } + LatencySamplerAction struct { Details func(childComplexity int) int Disable func(childComplexity int) int @@ -947,13 +971,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.DbQueryPayloadCollection.MaxPayloadLength(childComplexity), true - case "DeleteAttribute.attributeName": - if e.complexity.DeleteAttribute.AttributeName == nil { - break - } - - return e.complexity.DeleteAttribute.AttributeName(childComplexity), true - case "DeleteAttributeAction.details": if e.complexity.DeleteAttributeAction.Details == nil { break @@ -1556,6 +1573,118 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.K8sActualSource.Selected(childComplexity), true + case "K8sAnnotationAttribute.annotationKey": + if e.complexity.K8sAnnotationAttribute.AnnotationKey == nil { + break + } + + return e.complexity.K8sAnnotationAttribute.AnnotationKey(childComplexity), true + + case "K8sAnnotationAttribute.attributeKey": + if e.complexity.K8sAnnotationAttribute.AttributeKey == nil { + break + } + + return e.complexity.K8sAnnotationAttribute.AttributeKey(childComplexity), true + + case "K8sAttributes.annotationsAttributes": + if e.complexity.K8sAttributes.AnnotationsAttributes == nil { + break + } + + return e.complexity.K8sAttributes.AnnotationsAttributes(childComplexity), true + + case "K8sAttributes.collectClusterId": + if e.complexity.K8sAttributes.CollectClusterID == nil { + break + } + + return e.complexity.K8sAttributes.CollectClusterID(childComplexity), true + + case "K8sAttributes.collectContainerAttributes": + if e.complexity.K8sAttributes.CollectContainerAttributes == nil { + break + } + + return e.complexity.K8sAttributes.CollectContainerAttributes(childComplexity), true + + case "K8sAttributes.collectWorkloadId": + if e.complexity.K8sAttributes.CollectWorkloadID == nil { + break + } + + return e.complexity.K8sAttributes.CollectWorkloadID(childComplexity), true + + case "K8sAttributes.labelsAttributes": + if e.complexity.K8sAttributes.LabelsAttributes == nil { + break + } + + return e.complexity.K8sAttributes.LabelsAttributes(childComplexity), true + + case "K8sAttributesAction.details": + if e.complexity.K8sAttributesAction.Details == nil { + break + } + + return e.complexity.K8sAttributesAction.Details(childComplexity), true + + case "K8sAttributesAction.disable": + if e.complexity.K8sAttributesAction.Disable == nil { + break + } + + return e.complexity.K8sAttributesAction.Disable(childComplexity), true + + case "K8sAttributesAction.id": + if e.complexity.K8sAttributesAction.ID == nil { + break + } + + return e.complexity.K8sAttributesAction.ID(childComplexity), true + + case "K8sAttributesAction.name": + if e.complexity.K8sAttributesAction.Name == nil { + break + } + + return e.complexity.K8sAttributesAction.Name(childComplexity), true + + case "K8sAttributesAction.notes": + if e.complexity.K8sAttributesAction.Notes == nil { + break + } + + return e.complexity.K8sAttributesAction.Notes(childComplexity), true + + case "K8sAttributesAction.signals": + if e.complexity.K8sAttributesAction.Signals == nil { + break + } + + return e.complexity.K8sAttributesAction.Signals(childComplexity), true + + case "K8sAttributesAction.type": + if e.complexity.K8sAttributesAction.Type == nil { + break + } + + return e.complexity.K8sAttributesAction.Type(childComplexity), true + + case "K8sLabelAttribute.attributeKey": + if e.complexity.K8sLabelAttribute.AttributeKey == nil { + break + } + + return e.complexity.K8sLabelAttribute.AttributeKey(childComplexity), true + + case "K8sLabelAttribute.labelKey": + if e.complexity.K8sLabelAttribute.LabelKey == nil { + break + } + + return e.complexity.K8sLabelAttribute.LabelKey(childComplexity), true + case "LatencySamplerAction.details": if e.complexity.LatencySamplerAction.Details == nil { break @@ -5751,50 +5880,6 @@ func (ec *executionContext) fieldContext_DbQueryPayloadCollection_dropPartialPay return fc, nil } -func (ec *executionContext) _DeleteAttribute_attributeName(ctx context.Context, field graphql.CollectedField, obj *model.DeleteAttribute) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DeleteAttribute_attributeName(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.AttributeName, 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_DeleteAttribute_attributeName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "DeleteAttribute", - 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) _DeleteAttributeAction_id(ctx context.Context, field graphql.CollectedField, obj *model.DeleteAttributeAction) (ret graphql.Marshaler) { fc, err := ec.fieldContext_DeleteAttributeAction_id(ctx, field) if err != nil { @@ -9741,8 +9826,8 @@ func (ec *executionContext) fieldContext_K8sActualSource_conditions(_ context.Co return fc, nil } -func (ec *executionContext) _LatencySamplerAction_id(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LatencySamplerAction_id(ctx, field) +func (ec *executionContext) _K8sAnnotationAttribute_annotationKey(ctx context.Context, field graphql.CollectedField, obj *model.K8sAnnotationAttribute) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAnnotationAttribute_annotationKey(ctx, field) if err != nil { return graphql.Null } @@ -9755,7 +9840,7 @@ func (ec *executionContext) _LatencySamplerAction_id(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ID, nil + return obj.AnnotationKey, nil }) if err != nil { ec.Error(ctx, err) @@ -9769,24 +9854,24 @@ func (ec *executionContext) _LatencySamplerAction_id(ctx context.Context, field } res := resTmp.(string) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LatencySamplerAction_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sAnnotationAttribute_annotationKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LatencySamplerAction", + Object: "K8sAnnotationAttribute", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LatencySamplerAction_type(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LatencySamplerAction_type(ctx, field) +func (ec *executionContext) _K8sAnnotationAttribute_attributeKey(ctx context.Context, field graphql.CollectedField, obj *model.K8sAnnotationAttribute) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAnnotationAttribute_attributeKey(ctx, field) if err != nil { return graphql.Null } @@ -9799,7 +9884,7 @@ func (ec *executionContext) _LatencySamplerAction_type(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Type, nil + return obj.AttributeKey, nil }) if err != nil { ec.Error(ctx, err) @@ -9816,9 +9901,9 @@ func (ec *executionContext) _LatencySamplerAction_type(ctx context.Context, fiel return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LatencySamplerAction_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sAnnotationAttribute_attributeKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LatencySamplerAction", + Object: "K8sAnnotationAttribute", Field: field, IsMethod: false, IsResolver: false, @@ -9829,8 +9914,8 @@ func (ec *executionContext) fieldContext_LatencySamplerAction_type(_ context.Con return fc, nil } -func (ec *executionContext) _LatencySamplerAction_name(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LatencySamplerAction_name(ctx, field) +func (ec *executionContext) _K8sAttributes_collectContainerAttributes(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributes) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributes_collectContainerAttributes(ctx, field) if err != nil { return graphql.Null } @@ -9843,35 +9928,38 @@ func (ec *executionContext) _LatencySamplerAction_name(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.CollectContainerAttributes, 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) + res := resTmp.(bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LatencySamplerAction_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sAttributes_collectContainerAttributes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LatencySamplerAction", + Object: "K8sAttributes", 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 nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LatencySamplerAction_notes(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LatencySamplerAction_notes(ctx, field) +func (ec *executionContext) _K8sAttributes_collectWorkloadId(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributes) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributes_collectWorkloadId(ctx, field) if err != nil { return graphql.Null } @@ -9884,35 +9972,38 @@ func (ec *executionContext) _LatencySamplerAction_notes(ctx context.Context, fie }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Notes, nil + return obj.CollectWorkloadID, 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) + res := resTmp.(bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LatencySamplerAction_notes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sAttributes_collectWorkloadId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LatencySamplerAction", + Object: "K8sAttributes", 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 nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LatencySamplerAction_disable(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LatencySamplerAction_disable(ctx, field) +func (ec *executionContext) _K8sAttributes_collectClusterId(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributes) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributes_collectClusterId(ctx, field) if err != nil { return graphql.Null } @@ -9925,7 +10016,7 @@ func (ec *executionContext) _LatencySamplerAction_disable(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Disable, nil + return obj.CollectClusterID, nil }) if err != nil { ec.Error(ctx, err) @@ -9942,9 +10033,9 @@ func (ec *executionContext) _LatencySamplerAction_disable(ctx context.Context, f return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LatencySamplerAction_disable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sAttributes_collectClusterId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LatencySamplerAction", + Object: "K8sAttributes", Field: field, IsMethod: false, IsResolver: false, @@ -9955,8 +10046,8 @@ func (ec *executionContext) fieldContext_LatencySamplerAction_disable(_ context. return fc, nil } -func (ec *executionContext) _LatencySamplerAction_signals(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LatencySamplerAction_signals(ctx, field) +func (ec *executionContext) _K8sAttributes_labelsAttributes(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributes) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributes_labelsAttributes(ctx, field) if err != nil { return graphql.Null } @@ -9969,7 +10060,7 @@ func (ec *executionContext) _LatencySamplerAction_signals(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Signals, nil + return obj.LabelsAttributes, nil }) if err != nil { ec.Error(ctx, err) @@ -9981,26 +10072,32 @@ func (ec *executionContext) _LatencySamplerAction_signals(ctx context.Context, f } return graphql.Null } - res := resTmp.([]model.SignalType) + res := resTmp.([]*model.K8sLabelAttribute) fc.Result = res - return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) + return ec.marshalNK8sLabelAttribute2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sLabelAttributeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LatencySamplerAction_signals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sAttributes_labelsAttributes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LatencySamplerAction", + Object: "K8sAttributes", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type SignalType does not have child fields") + switch field.Name { + case "labelKey": + return ec.fieldContext_K8sLabelAttribute_labelKey(ctx, field) + case "attributeKey": + return ec.fieldContext_K8sLabelAttribute_attributeKey(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sLabelAttribute", field.Name) }, } return fc, nil } -func (ec *executionContext) _LatencySamplerAction_details(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LatencySamplerAction_details(ctx, field) +func (ec *executionContext) _K8sAttributes_annotationsAttributes(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributes) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributes_annotationsAttributes(ctx, field) if err != nil { return graphql.Null } @@ -10013,7 +10110,7 @@ func (ec *executionContext) _LatencySamplerAction_details(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Details, nil + return obj.AnnotationsAttributes, nil }) if err != nil { ec.Error(ctx, err) @@ -10025,26 +10122,32 @@ func (ec *executionContext) _LatencySamplerAction_details(ctx context.Context, f } return graphql.Null } - res := resTmp.([]*string) + res := resTmp.([]*model.K8sAnnotationAttribute) fc.Result = res - return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res) + return ec.marshalNK8sAnnotationAttribute2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sAnnotationAttributeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LatencySamplerAction_details(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sAttributes_annotationsAttributes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LatencySamplerAction", + Object: "K8sAttributes", 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") + switch field.Name { + case "annotationKey": + return ec.fieldContext_K8sAnnotationAttribute_annotationKey(ctx, field) + case "attributeKey": + return ec.fieldContext_K8sAnnotationAttribute_attributeKey(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sAnnotationAttribute", field.Name) }, } return fc, nil } -func (ec *executionContext) _MessagingPayloadCollection_maxPayloadLength(ctx context.Context, field graphql.CollectedField, obj *model.MessagingPayloadCollection) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_MessagingPayloadCollection_maxPayloadLength(ctx, field) +func (ec *executionContext) _K8sAttributesAction_id(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributesAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributesAction_id(ctx, field) if err != nil { return graphql.Null } @@ -10057,35 +10160,38 @@ func (ec *executionContext) _MessagingPayloadCollection_maxPayloadLength(ctx con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.MaxPayloadLength, nil + return obj.ID, 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.(*int) + res := resTmp.(string) fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MessagingPayloadCollection_maxPayloadLength(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sAttributesAction_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "MessagingPayloadCollection", + Object: "K8sAttributesAction", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _MessagingPayloadCollection_dropPartialPayloads(ctx context.Context, field graphql.CollectedField, obj *model.MessagingPayloadCollection) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_MessagingPayloadCollection_dropPartialPayloads(ctx, field) +func (ec *executionContext) _K8sAttributesAction_type(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributesAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributesAction_type(ctx, field) if err != nil { return graphql.Null } @@ -10098,35 +10204,38 @@ func (ec *executionContext) _MessagingPayloadCollection_dropPartialPayloads(ctx }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DropPartialPayloads, nil + return obj.Type, 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) + res := resTmp.(string) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MessagingPayloadCollection_dropPartialPayloads(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sAttributesAction_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "MessagingPayloadCollection", + Object: "K8sAttributesAction", 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Mutation_updateApiToken(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_updateApiToken(ctx, field) +func (ec *executionContext) _K8sAttributesAction_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributesAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributesAction_name(ctx, field) if err != nil { return graphql.Null } @@ -10139,49 +10248,35 @@ func (ec *executionContext) _Mutation_updateApiToken(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateAPIToken(rctx, fc.Args["token"].(string)) + return obj.Name, 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) + res := resTmp.(*string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_updateApiToken(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sAttributesAction_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "K8sAttributesAction", Field: field, - IsMethod: true, - IsResolver: true, + 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 nil, errors.New("field of type String does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_updateApiToken_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_persistK8sNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_persistK8sNamespace(ctx, field) +func (ec *executionContext) _K8sAttributesAction_notes(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributesAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributesAction_notes(ctx, field) if err != nil { return graphql.Null } @@ -10194,7 +10289,719 @@ func (ec *executionContext) _Mutation_persistK8sNamespace(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().PersistK8sNamespace(rctx, fc.Args["namespace"].(model.PersistNamespaceItemInput)) + return obj.Notes, 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_K8sAttributesAction_notes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sAttributesAction", + 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) _K8sAttributesAction_disable(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributesAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributesAction_disable(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.Disable, 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_K8sAttributesAction_disable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sAttributesAction", + 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) _K8sAttributesAction_signals(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributesAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributesAction_signals(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.Signals, 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.SignalType) + fc.Result = res + return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sAttributesAction_signals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sAttributesAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type SignalType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sAttributesAction_details(ctx context.Context, field graphql.CollectedField, obj *model.K8sAttributesAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sAttributesAction_details(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.Details, 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.K8sAttributes) + fc.Result = res + return ec.marshalNK8sAttributes2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sAttributes(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sAttributesAction_details(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sAttributesAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "collectContainerAttributes": + return ec.fieldContext_K8sAttributes_collectContainerAttributes(ctx, field) + case "collectWorkloadId": + return ec.fieldContext_K8sAttributes_collectWorkloadId(ctx, field) + case "collectClusterId": + return ec.fieldContext_K8sAttributes_collectClusterId(ctx, field) + case "labelsAttributes": + return ec.fieldContext_K8sAttributes_labelsAttributes(ctx, field) + case "annotationsAttributes": + return ec.fieldContext_K8sAttributes_annotationsAttributes(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sAttributes", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sLabelAttribute_labelKey(ctx context.Context, field graphql.CollectedField, obj *model.K8sLabelAttribute) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sLabelAttribute_labelKey(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.LabelKey, 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_K8sLabelAttribute_labelKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sLabelAttribute", + 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) _K8sLabelAttribute_attributeKey(ctx context.Context, field graphql.CollectedField, obj *model.K8sLabelAttribute) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sLabelAttribute_attributeKey(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.AttributeKey, 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_K8sLabelAttribute_attributeKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sLabelAttribute", + 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) _LatencySamplerAction_id(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LatencySamplerAction_id(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.ID, 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.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LatencySamplerAction_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LatencySamplerAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _LatencySamplerAction_type(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LatencySamplerAction_type(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.Type, 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_LatencySamplerAction_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LatencySamplerAction", + 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) _LatencySamplerAction_name(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LatencySamplerAction_name(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.Name, 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_LatencySamplerAction_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LatencySamplerAction", + 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) _LatencySamplerAction_notes(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LatencySamplerAction_notes(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.Notes, 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_LatencySamplerAction_notes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LatencySamplerAction", + 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) _LatencySamplerAction_disable(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LatencySamplerAction_disable(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.Disable, 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_LatencySamplerAction_disable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LatencySamplerAction", + 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) _LatencySamplerAction_signals(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LatencySamplerAction_signals(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.Signals, 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.SignalType) + fc.Result = res + return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LatencySamplerAction_signals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LatencySamplerAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type SignalType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _LatencySamplerAction_details(ctx context.Context, field graphql.CollectedField, obj *model.LatencySamplerAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LatencySamplerAction_details(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.Details, 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.marshalNString2ᚕᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LatencySamplerAction_details(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LatencySamplerAction", + 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) _MessagingPayloadCollection_maxPayloadLength(ctx context.Context, field graphql.CollectedField, obj *model.MessagingPayloadCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MessagingPayloadCollection_maxPayloadLength(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.MaxPayloadLength, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int) + fc.Result = res + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_MessagingPayloadCollection_maxPayloadLength(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MessagingPayloadCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _MessagingPayloadCollection_dropPartialPayloads(ctx context.Context, field graphql.CollectedField, obj *model.MessagingPayloadCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MessagingPayloadCollection_dropPartialPayloads(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.DropPartialPayloads, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_MessagingPayloadCollection_dropPartialPayloads(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MessagingPayloadCollection", + 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) _Mutation_updateApiToken(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateApiToken(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 ec.resolvers.Mutation().UpdateAPIToken(rctx, fc.Args["token"].(string)) + }) + 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_Mutation_updateApiToken(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateApiToken_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_persistK8sNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_persistK8sNamespace(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 ec.resolvers.Mutation().PersistK8sNamespace(rctx, fc.Args["namespace"].(model.PersistNamespaceItemInput)) }) if err != nil { ec.Error(ctx, err) @@ -18857,6 +19664,13 @@ func (ec *executionContext) _Action(ctx context.Context, sel ast.SelectionSet, o switch obj := (obj).(type) { case nil: return graphql.Null + case model.K8sAttributesAction: + return ec._K8sAttributesAction(ctx, sel, &obj) + case *model.K8sAttributesAction: + if obj == nil { + return graphql.Null + } + return ec._K8sAttributesAction(ctx, sel, obj) case model.AddClusterInfoAction: return ec._AddClusterInfoAction(ctx, sel, &obj) case *model.AddClusterInfoAction: @@ -19647,47 +20461,9 @@ func (ec *executionContext) _CustomReadDataLabel(ctx context.Context, sel ast.Se } case "value": out.Values[i] = ec._CustomReadDataLabel_value(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 dbQueryPayloadCollectionImplementors = []string{"DbQueryPayloadCollection"} - -func (ec *executionContext) _DbQueryPayloadCollection(ctx context.Context, sel ast.SelectionSet, obj *model.DbQueryPayloadCollection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, dbQueryPayloadCollectionImplementors) - - 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("DbQueryPayloadCollection") - case "maxPayloadLength": - out.Values[i] = ec._DbQueryPayloadCollection_maxPayloadLength(ctx, field, obj) - case "dropPartialPayloads": - out.Values[i] = ec._DbQueryPayloadCollection_dropPartialPayloads(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -19711,22 +20487,21 @@ func (ec *executionContext) _DbQueryPayloadCollection(ctx context.Context, sel a return out } -var deleteAttributeImplementors = []string{"DeleteAttribute"} +var dbQueryPayloadCollectionImplementors = []string{"DbQueryPayloadCollection"} -func (ec *executionContext) _DeleteAttribute(ctx context.Context, sel ast.SelectionSet, obj *model.DeleteAttribute) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, deleteAttributeImplementors) +func (ec *executionContext) _DbQueryPayloadCollection(ctx context.Context, sel ast.SelectionSet, obj *model.DbQueryPayloadCollection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, dbQueryPayloadCollectionImplementors) 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("DeleteAttribute") - case "attributeName": - out.Values[i] = ec._DeleteAttribute_attributeName(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } + out.Values[i] = graphql.MarshalString("DbQueryPayloadCollection") + case "maxPayloadLength": + out.Values[i] = ec._DbQueryPayloadCollection_maxPayloadLength(ctx, field, obj) + case "dropPartialPayloads": + out.Values[i] = ec._DbQueryPayloadCollection_dropPartialPayloads(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -20465,10 +21240,257 @@ func (ec *executionContext) _InstrumentationLibraryGlobalId(ctx context.Context, if out.Values[i] == graphql.Null { out.Invalids++ } - case "spanKind": - out.Values[i] = ec._InstrumentationLibraryGlobalId_spanKind(ctx, field, obj) - case "language": - out.Values[i] = ec._InstrumentationLibraryGlobalId_language(ctx, field, obj) + case "spanKind": + out.Values[i] = ec._InstrumentationLibraryGlobalId_spanKind(ctx, field, obj) + case "language": + out.Values[i] = ec._InstrumentationLibraryGlobalId_language(ctx, field, obj) + 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 { + fields := graphql.CollectFields(ec.OperationContext, sel, instrumentationRuleImplementors) + + 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("InstrumentationRule") + case "ruleId": + out.Values[i] = ec._InstrumentationRule_ruleId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "ruleName": + out.Values[i] = ec._InstrumentationRule_ruleName(ctx, field, obj) + case "notes": + out.Values[i] = ec._InstrumentationRule_notes(ctx, field, obj) + case "disabled": + out.Values[i] = ec._InstrumentationRule_disabled(ctx, field, obj) + case "mutable": + out.Values[i] = ec._InstrumentationRule_mutable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "profileName": + out.Values[i] = ec._InstrumentationRule_profileName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "workloads": + out.Values[i] = ec._InstrumentationRule_workloads(ctx, field, obj) + case "instrumentationLibraries": + out.Values[i] = ec._InstrumentationRule_instrumentationLibraries(ctx, field, obj) + case "payloadCollection": + out.Values[i] = ec._InstrumentationRule_payloadCollection(ctx, field, obj) + case "codeAttributes": + out.Values[i] = ec._InstrumentationRule_codeAttributes(ctx, field, obj) + 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 instrumentationSourcesAnalyzeImplementors = []string{"InstrumentationSourcesAnalyze"} + +func (ec *executionContext) _InstrumentationSourcesAnalyze(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentationSourcesAnalyze) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, instrumentationSourcesAnalyzeImplementors) + + 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("InstrumentationSourcesAnalyze") + case "instrumented": + out.Values[i] = ec._InstrumentationSourcesAnalyze_instrumented(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "workload": + out.Values[i] = ec._InstrumentationSourcesAnalyze_workload(ctx, field, obj) + case "namespace": + out.Values[i] = ec._InstrumentationSourcesAnalyze_namespace(ctx, field, obj) + case "instrumentedText": + out.Values[i] = ec._InstrumentationSourcesAnalyze_instrumentedText(ctx, field, obj) + 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 k8sActualNamespaceImplementors = []string{"K8sActualNamespace"} + +func (ec *executionContext) _K8sActualNamespace(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualNamespace) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualNamespaceImplementors) + + 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("K8sActualNamespace") + case "name": + out.Values[i] = ec._K8sActualNamespace_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "selected": + out.Values[i] = ec._K8sActualNamespace_selected(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "k8sActualSources": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._K8sActualNamespace_k8sActualSources(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + 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 k8sActualSourceImplementors = []string{"K8sActualSource"} + +func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSource) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceImplementors) + + 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("K8sActualSource") + case "namespace": + out.Values[i] = ec._K8sActualSource_namespace(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._K8sActualSource_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "kind": + out.Values[i] = ec._K8sActualSource_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "numberOfInstances": + out.Values[i] = ec._K8sActualSource_numberOfInstances(ctx, field, obj) + case "selected": + out.Values[i] = ec._K8sActualSource_selected(ctx, field, obj) + case "otelServiceName": + out.Values[i] = ec._K8sActualSource_otelServiceName(ctx, field, obj) + case "containers": + out.Values[i] = ec._K8sActualSource_containers(ctx, field, obj) + case "conditions": + out.Values[i] = ec._K8sActualSource_conditions(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -20492,46 +21514,27 @@ func (ec *executionContext) _InstrumentationLibraryGlobalId(ctx context.Context, return out } -var instrumentationRuleImplementors = []string{"InstrumentationRule"} +var k8sAnnotationAttributeImplementors = []string{"K8sAnnotationAttribute"} -func (ec *executionContext) _InstrumentationRule(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentationRule) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, instrumentationRuleImplementors) +func (ec *executionContext) _K8sAnnotationAttribute(ctx context.Context, sel ast.SelectionSet, obj *model.K8sAnnotationAttribute) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sAnnotationAttributeImplementors) 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("InstrumentationRule") - case "ruleId": - out.Values[i] = ec._InstrumentationRule_ruleId(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "ruleName": - out.Values[i] = ec._InstrumentationRule_ruleName(ctx, field, obj) - case "notes": - out.Values[i] = ec._InstrumentationRule_notes(ctx, field, obj) - case "disabled": - out.Values[i] = ec._InstrumentationRule_disabled(ctx, field, obj) - case "mutable": - out.Values[i] = ec._InstrumentationRule_mutable(ctx, field, obj) + out.Values[i] = graphql.MarshalString("K8sAnnotationAttribute") + case "annotationKey": + out.Values[i] = ec._K8sAnnotationAttribute_annotationKey(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "profileName": - out.Values[i] = ec._InstrumentationRule_profileName(ctx, field, obj) + case "attributeKey": + out.Values[i] = ec._K8sAnnotationAttribute_attributeKey(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "workloads": - out.Values[i] = ec._InstrumentationRule_workloads(ctx, field, obj) - case "instrumentationLibraries": - out.Values[i] = ec._InstrumentationRule_instrumentationLibraries(ctx, field, obj) - case "payloadCollection": - out.Values[i] = ec._InstrumentationRule_payloadCollection(ctx, field, obj) - case "codeAttributes": - out.Values[i] = ec._InstrumentationRule_codeAttributes(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -20555,28 +21558,42 @@ func (ec *executionContext) _InstrumentationRule(ctx context.Context, sel ast.Se return out } -var instrumentationSourcesAnalyzeImplementors = []string{"InstrumentationSourcesAnalyze"} +var k8sAttributesImplementors = []string{"K8sAttributes"} -func (ec *executionContext) _InstrumentationSourcesAnalyze(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentationSourcesAnalyze) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, instrumentationSourcesAnalyzeImplementors) +func (ec *executionContext) _K8sAttributes(ctx context.Context, sel ast.SelectionSet, obj *model.K8sAttributes) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sAttributesImplementors) 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("InstrumentationSourcesAnalyze") - case "instrumented": - out.Values[i] = ec._InstrumentationSourcesAnalyze_instrumented(ctx, field, obj) + out.Values[i] = graphql.MarshalString("K8sAttributes") + case "collectContainerAttributes": + out.Values[i] = ec._K8sAttributes_collectContainerAttributes(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "collectWorkloadId": + out.Values[i] = ec._K8sAttributes_collectWorkloadId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "collectClusterId": + out.Values[i] = ec._K8sAttributes_collectClusterId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "labelsAttributes": + out.Values[i] = ec._K8sAttributes_labelsAttributes(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "annotationsAttributes": + out.Values[i] = ec._K8sAttributes_annotationsAttributes(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "workload": - out.Values[i] = ec._InstrumentationSourcesAnalyze_workload(ctx, field, obj) - case "namespace": - out.Values[i] = ec._InstrumentationSourcesAnalyze_namespace(ctx, field, obj) - case "instrumentedText": - out.Values[i] = ec._InstrumentationSourcesAnalyze_instrumentedText(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -20600,63 +21617,46 @@ func (ec *executionContext) _InstrumentationSourcesAnalyze(ctx context.Context, return out } -var k8sActualNamespaceImplementors = []string{"K8sActualNamespace"} +var k8sAttributesActionImplementors = []string{"K8sAttributesAction", "Action"} -func (ec *executionContext) _K8sActualNamespace(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualNamespace) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualNamespaceImplementors) +func (ec *executionContext) _K8sAttributesAction(ctx context.Context, sel ast.SelectionSet, obj *model.K8sAttributesAction) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sAttributesActionImplementors) 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("K8sActualNamespace") - case "name": - out.Values[i] = ec._K8sActualNamespace_name(ctx, field, obj) + out.Values[i] = graphql.MarshalString("K8sAttributesAction") + case "id": + out.Values[i] = ec._K8sAttributesAction_id(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } - case "selected": - out.Values[i] = ec._K8sActualNamespace_selected(ctx, field, obj) + case "type": + out.Values[i] = ec._K8sAttributesAction_type(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } - case "k8sActualSources": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._K8sActualNamespace_k8sActualSources(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res + case "name": + out.Values[i] = ec._K8sAttributesAction_name(ctx, field, obj) + case "notes": + out.Values[i] = ec._K8sAttributesAction_notes(ctx, field, obj) + case "disable": + out.Values[i] = ec._K8sAttributesAction_disable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue + case "signals": + out.Values[i] = ec._K8sAttributesAction_signals(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "details": + out.Values[i] = ec._K8sAttributesAction_details(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -20680,42 +21680,27 @@ func (ec *executionContext) _K8sActualNamespace(ctx context.Context, sel ast.Sel return out } -var k8sActualSourceImplementors = []string{"K8sActualSource"} +var k8sLabelAttributeImplementors = []string{"K8sLabelAttribute"} -func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSource) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceImplementors) +func (ec *executionContext) _K8sLabelAttribute(ctx context.Context, sel ast.SelectionSet, obj *model.K8sLabelAttribute) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sLabelAttributeImplementors) 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("K8sActualSource") - case "namespace": - out.Values[i] = ec._K8sActualSource_namespace(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "name": - out.Values[i] = ec._K8sActualSource_name(ctx, field, obj) + out.Values[i] = graphql.MarshalString("K8sLabelAttribute") + case "labelKey": + out.Values[i] = ec._K8sLabelAttribute_labelKey(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "kind": - out.Values[i] = ec._K8sActualSource_kind(ctx, field, obj) + case "attributeKey": + out.Values[i] = ec._K8sLabelAttribute_attributeKey(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "numberOfInstances": - out.Values[i] = ec._K8sActualSource_numberOfInstances(ctx, field, obj) - case "selected": - out.Values[i] = ec._K8sActualSource_selected(ctx, field, obj) - case "otelServiceName": - out.Values[i] = ec._K8sActualSource_otelServiceName(ctx, field, obj) - case "containers": - out.Values[i] = ec._K8sActualSource_containers(ctx, field, obj) - case "conditions": - out.Values[i] = ec._K8sActualSource_conditions(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -23595,6 +24580,124 @@ func (ec *executionContext) marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigos return ret } +func (ec *executionContext) marshalNK8sAnnotationAttribute2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sAnnotationAttributeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.K8sAnnotationAttribute) 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.marshalNK8sAnnotationAttribute2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sAnnotationAttribute(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) marshalNK8sAnnotationAttribute2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sAnnotationAttribute(ctx context.Context, sel ast.SelectionSet, v *model.K8sAnnotationAttribute) 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._K8sAnnotationAttribute(ctx, sel, v) +} + +func (ec *executionContext) marshalNK8sAttributes2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sAttributes(ctx context.Context, sel ast.SelectionSet, v *model.K8sAttributes) 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._K8sAttributes(ctx, sel, v) +} + +func (ec *executionContext) marshalNK8sLabelAttribute2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sLabelAttributeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.K8sLabelAttribute) 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.marshalNK8sLabelAttribute2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sLabelAttribute(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) marshalNK8sLabelAttribute2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sLabelAttribute(ctx context.Context, sel ast.SelectionSet, v *model.K8sLabelAttribute) 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._K8sLabelAttribute(ctx, sel, v) +} + func (ec *executionContext) unmarshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx context.Context, v interface{}) (model.K8sResourceKind, error) { var res model.K8sResourceKind err := res.UnmarshalGQL(v) diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index 4c35d489ae..887f09abfb 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -147,10 +147,6 @@ type DbQueryPayloadCollectionInput struct { DropPartialPayloads *bool `json:"dropPartialPayloads,omitempty"` } -type DeleteAttribute struct { - AttributeName string `json:"attributeName"` -} - type DeleteAttributeAction struct { ID string `json:"id"` Type string `json:"type"` @@ -365,6 +361,46 @@ type K8sActualSource struct { Conditions []*Condition `json:"conditions,omitempty"` } +type K8sAnnotationAttribute struct { + AnnotationKey string `json:"annotationKey"` + AttributeKey string `json:"attributeKey"` +} + +type K8sAttributes struct { + CollectContainerAttributes bool `json:"collectContainerAttributes"` + CollectWorkloadID bool `json:"collectWorkloadId"` + CollectClusterID bool `json:"collectClusterId"` + LabelsAttributes []*K8sLabelAttribute `json:"labelsAttributes"` + AnnotationsAttributes []*K8sAnnotationAttribute `json:"annotationsAttributes"` +} + +type K8sAttributesAction struct { + ID string `json:"id"` + Type string `json:"type"` + Name *string `json:"name,omitempty"` + Notes *string `json:"notes,omitempty"` + Disable bool `json:"disable"` + Signals []SignalType `json:"signals"` + Details *K8sAttributes `json:"details"` +} + +func (K8sAttributesAction) IsAction() {} +func (this K8sAttributesAction) GetID() string { return this.ID } +func (this K8sAttributesAction) GetType() string { return this.Type } +func (this K8sAttributesAction) GetName() *string { return this.Name } +func (this K8sAttributesAction) GetNotes() *string { return this.Notes } +func (this K8sAttributesAction) GetDisable() bool { return this.Disable } +func (this K8sAttributesAction) GetSignals() []SignalType { + if this.Signals == nil { + return nil + } + interfaceSlice := make([]SignalType, 0, len(this.Signals)) + for _, concrete := range this.Signals { + interfaceSlice = append(interfaceSlice, concrete) + } + return interfaceSlice +} + type K8sDesiredNamespaceInput struct { AutoInstrument *bool `json:"autoInstrument,omitempty"` } @@ -374,6 +410,11 @@ type K8sDesiredSourceInput struct { AutoInstrument *bool `json:"autoInstrument,omitempty"` } +type K8sLabelAttribute struct { + LabelKey string `json:"labelKey"` + AttributeKey string `json:"attributeKey"` +} + type K8sNamespaceID struct { Name string `json:"name"` } diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 27bf4799b1..38ede1950e 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -362,6 +362,34 @@ interface Action { signals: [SignalType!]! } +type K8sLabelAttribute { + labelKey: String! + attributeKey: String! +} + +type K8sAnnotationAttribute { + annotationKey: String! + attributeKey: String! +} + +type K8sAttributes { + collectContainerAttributes: Boolean! + collectWorkloadId: Boolean! + collectClusterId: Boolean! + labelsAttributes: [K8sLabelAttribute!]! + annotationsAttributes: [K8sAnnotationAttribute!]! +} + +type K8sAttributesAction implements Action { + id: ID! + type: String! + name: String + notes: String + disable: Boolean! + signals: [SignalType!]! + details: K8sAttributes! +} + type ClusterInfo { attributeName: String! attributeStringValue: String @@ -377,10 +405,6 @@ type AddClusterInfoAction implements Action { details: [ClusterInfo!]! } -type DeleteAttribute { - attributeName: String! -} - type DeleteAttributeAction implements Action { id: ID! type: String! diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 32e4511c36..e30e964b61 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -179,6 +179,24 @@ func (r *computePlatformResolver) Actions(ctx context.Context, obj *model.Comput var response []*model.PipelineAction ns := env.GetCurrentNamespace() + // K8sAttributes actions + kaActions, err := kube.DefaultClient.ActionsClient.K8sAttributesResolvers(ns).List(ctx, metav1.ListOptions{}) + if err != nil { + return nil, err + } + for _, action := range kaActions.Items { + specStr, err := json.Marshal(action.Spec) + if err != nil { + return nil, err + } + response = append(response, &model.PipelineAction{ + ID: action.Name, + Type: action.Kind, + Spec: string(specStr), + Conditions: convertConditions(action.Status.Conditions), + }) + } + // AddClusterInfos actions icaActions, err := kube.DefaultClient.ActionsClient.AddClusterInfos(ns).List(ctx, metav1.ListOptions{}) if err != nil { @@ -689,6 +707,8 @@ func (r *mutationResolver) CreateAction(ctx context.Context, action model.Action } switch action.Type { + case actionservices.ActionTypeK8sAttributes: + return actionservices.CreateK8sAttributes(ctx, action) case actionservices.ActionTypeAddClusterInfo: return actionservices.CreateAddClusterInfo(ctx, action) case actionservices.ActionTypeDeleteAttribute: @@ -716,6 +736,8 @@ func (r *mutationResolver) UpdateAction(ctx context.Context, id string, action m } switch action.Type { + case actionservices.ActionTypeK8sAttributes: + return actionservices.UpdateK8sAttributes(ctx, id, action) case actionservices.ActionTypeAddClusterInfo: return actionservices.UpdateAddClusterInfo(ctx, id, action) case actionservices.ActionTypeDeleteAttribute: @@ -743,6 +765,12 @@ func (r *mutationResolver) DeleteAction(ctx context.Context, id string, actionTy } switch actionType { + case actionservices.ActionTypeK8sAttributes: + err := actionservices.DeleteK8sAttributes(ctx, id) + if err != nil { + return false, fmt.Errorf("failed to delete K8sAttributes: %v", err) + } + case actionservices.ActionTypeAddClusterInfo: err := actionservices.DeleteAddClusterInfo(ctx, id) if err != nil { diff --git a/frontend/services/actions/addclusterinfo.go b/frontend/services/actions/addclusterinfo.go index 002168dfb4..773bf08ce6 100644 --- a/frontend/services/actions/addclusterinfo.go +++ b/frontend/services/actions/addclusterinfo.go @@ -15,7 +15,7 @@ import ( ) type AddClusterInfoDetails struct { - ClusterAttributes []model.ClusterInfo `json:"clusterAttributes"` + ClusterAttributes []v1alpha1.OtelAttributeWithValue `json:"clusterAttributes"` } func CreateAddClusterInfo(ctx context.Context, action model.ActionInput) (model.Action, error) { diff --git a/frontend/services/actions/constants.go b/frontend/services/actions/constants.go index aed6dc0fa1..b4ca97fe5d 100644 --- a/frontend/services/actions/constants.go +++ b/frontend/services/actions/constants.go @@ -1,6 +1,7 @@ package services const ( + ActionTypeK8sAttributes = "K8sAttributesResolver" ActionTypeAddClusterInfo = "AddClusterInfo" ActionTypeDeleteAttribute = "DeleteAttribute" ActionTypeRenameAttribute = "RenameAttribute" diff --git a/frontend/services/actions/k8sattributes.go b/frontend/services/actions/k8sattributes.go new file mode 100644 index 0000000000..a923093e95 --- /dev/null +++ b/frontend/services/actions/k8sattributes.go @@ -0,0 +1,184 @@ +package services + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/odigos-io/odigos/api/actions/v1alpha1" + "github.com/odigos-io/odigos/frontend/graph/model" + "github.com/odigos-io/odigos/frontend/kube" + "github.com/odigos-io/odigos/frontend/services" + "github.com/odigos-io/odigos/k8sutils/pkg/env" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type K8sAttributesDetails struct { + CollectContainerAttributes bool `json:"collectContainerAttributes"` + CollectWorkloadUID bool `json:"collectWorkloadId"` + CollectClusterUID bool `json:"collectClusterId"` + LabelsAttributes []v1alpha1.K8sLabelAttribute `json:"labelsAttributes,omitempty"` + AnnotationsAttributes []v1alpha1.K8sAnnotationAttribute `json:"annotationsAttributes,omitempty"` +} + +func CreateK8sAttributes(ctx context.Context, action model.ActionInput) (model.Action, error) { + var details K8sAttributesDetails + err := json.Unmarshal([]byte(action.Details), &details) + if err != nil { + return nil, fmt.Errorf("invalid details for K8sAttributes: %v", err) + } + + signals, err := services.ConvertSignals(action.Signals) + if err != nil { + return nil, fmt.Errorf("failed to convert signals: %v", err) + } + + k8sAttributesAction := &v1alpha1.K8sAttributesResolver{ + ObjectMeta: metav1.ObjectMeta{ + GenerateName: "ka-", + }, + Spec: v1alpha1.K8sAttributesSpec{ + ActionName: services.DerefString(action.Name), + Notes: services.DerefString(action.Notes), + Disabled: action.Disable, + Signals: signals, + CollectContainerAttributes: details.CollectContainerAttributes, + CollectWorkloadUID: details.CollectWorkloadUID, + CollectClusterUID: details.CollectClusterUID, + LabelsAttributes: details.LabelsAttributes, + AnnotationsAttributes: details.AnnotationsAttributes, + }, + } + + ns := env.GetCurrentNamespace() + + generatedAction, err := kube.DefaultClient.ActionsClient.K8sAttributesResolvers(ns).Create(ctx, k8sAttributesAction, metav1.CreateOptions{}) + if err != nil { + return nil, fmt.Errorf("failed to create K8sAttributes: %v", err) + } + + labelAttrs := make([]*model.K8sLabelAttribute, len(details.LabelsAttributes)) + for i, attr := range details.LabelsAttributes { + labelAttrs[i] = &model.K8sLabelAttribute{ + LabelKey: attr.LabelKey, + AttributeKey: attr.AttributeKey, + } + } + + annotAttrs := make([]*model.K8sAnnotationAttribute, len(details.AnnotationsAttributes)) + for i, attr := range details.AnnotationsAttributes { + annotAttrs[i] = &model.K8sAnnotationAttribute{ + AnnotationKey: attr.AnnotationKey, + AttributeKey: attr.AttributeKey, + } + } + + response := &model.K8sAttributesAction{ + ID: generatedAction.Name, + Type: ActionTypeAddClusterInfo, + Name: action.Name, + Notes: action.Notes, + Disable: action.Disable, + Signals: action.Signals, + Details: &model.K8sAttributes{ + CollectContainerAttributes: details.CollectContainerAttributes, + CollectWorkloadID: details.CollectWorkloadUID, + CollectClusterID: details.CollectClusterUID, + LabelsAttributes: labelAttrs, + AnnotationsAttributes: annotAttrs, + }, + } + + return response, nil +} + +func UpdateK8sAttributes(ctx context.Context, id string, action model.ActionInput) (model.Action, error) { + ns := env.GetCurrentNamespace() + + // Fetch the existing action + existingAction, err := kube.DefaultClient.ActionsClient.K8sAttributesResolvers(ns).Get(ctx, id, metav1.GetOptions{}) + if err != nil { + return nil, fmt.Errorf("failed to fetch K8sAttributes: %v", err) + } + + // Parse the details from action.Details + var details K8sAttributesDetails + err = json.Unmarshal([]byte(action.Details), &details) + if err != nil { + return nil, fmt.Errorf("invalid details for K8sAttributes: %v", err) + } + + // Convert signals from action input + signals, err := services.ConvertSignals(action.Signals) + if err != nil { + return nil, fmt.Errorf("failed to convert signals: %v", err) + } + + // Update the existing action with new values + existingAction.Spec.ActionName = services.DerefString(action.Name) + existingAction.Spec.Notes = services.DerefString(action.Notes) + existingAction.Spec.Disabled = action.Disable + existingAction.Spec.Signals = signals + existingAction.Spec.CollectContainerAttributes = details.CollectContainerAttributes + existingAction.Spec.CollectWorkloadUID = details.CollectWorkloadUID + existingAction.Spec.CollectClusterUID = details.CollectClusterUID + existingAction.Spec.LabelsAttributes = details.LabelsAttributes + existingAction.Spec.AnnotationsAttributes = details.AnnotationsAttributes + + // Update the action in Kubernetes + updatedAction, err := kube.DefaultClient.ActionsClient.K8sAttributesResolvers(ns).Update(ctx, existingAction, metav1.UpdateOptions{}) + if err != nil { + return nil, fmt.Errorf("failed to update K8sAttributes: %v", err) + } + + // Prepare the response model + labelAttrs := make([]*model.K8sLabelAttribute, len(details.LabelsAttributes)) + for i, attr := range details.LabelsAttributes { + labelAttrs[i] = &model.K8sLabelAttribute{ + LabelKey: attr.LabelKey, + AttributeKey: attr.AttributeKey, + } + } + + annotAttrs := make([]*model.K8sAnnotationAttribute, len(details.AnnotationsAttributes)) + for i, attr := range details.AnnotationsAttributes { + annotAttrs[i] = &model.K8sAnnotationAttribute{ + AnnotationKey: attr.AnnotationKey, + AttributeKey: attr.AttributeKey, + } + } + + response := &model.K8sAttributesAction{ + ID: updatedAction.Name, + Type: ActionTypeAddClusterInfo, + Name: action.Name, + Notes: action.Notes, + Disable: action.Disable, + Signals: action.Signals, + Details: &model.K8sAttributes{ + CollectContainerAttributes: details.CollectContainerAttributes, + CollectWorkloadID: details.CollectWorkloadUID, + CollectClusterID: details.CollectClusterUID, + LabelsAttributes: labelAttrs, + AnnotationsAttributes: annotAttrs, + }, + } + + return response, nil +} + +func DeleteK8sAttributes(ctx context.Context, id string) error { + ns := env.GetCurrentNamespace() + + // Delete the action by its ID from Kubernetes + err := kube.DefaultClient.ActionsClient.K8sAttributesResolvers(ns).Delete(ctx, id, metav1.DeleteOptions{}) + if err != nil { + if apierrors.IsNotFound(err) { + return fmt.Errorf("K8sAttributes action with ID %s not found", id) + } + return fmt.Errorf("failed to delete K8sAttributes action: %v", err) + } + + return nil +} diff --git a/frontend/webapp/@types/actions.ts b/frontend/webapp/@types/actions.ts index 6b0bfd039e..446a4ecebd 100644 --- a/frontend/webapp/@types/actions.ts +++ b/frontend/webapp/@types/actions.ts @@ -14,10 +14,14 @@ export interface ParsedActionSpec { signals: string[]; disabled?: boolean; + collectContainerAttributes?: boolean | null; + collectWorkloadUID?: boolean | null; + collectClusterUID?: boolean | null; + labelsAttributes?: { labelKey: string; attributeKey: string }[] | null; + annotationsAttributes?: { annotationKey: string; attributeKey: string }[] | null; clusterAttributes?: { attributeName: string; attributeStringValue: string }[] | null; attributeNamesToDelete?: string[] | null; renames?: { [oldKey: string]: string } | null; - piiCategories?: string[] | null; fallback_sampling_ratio?: number | null; sampling_percentage?: string | null; diff --git a/frontend/webapp/app/(setup)/choose-sources/page.tsx b/frontend/webapp/app/(setup)/choose-sources/page.tsx index da312e3737..0644f03e33 100644 --- a/frontend/webapp/app/(setup)/choose-sources/page.tsx +++ b/frontend/webapp/app/(setup)/choose-sources/page.tsx @@ -6,7 +6,7 @@ import { ENTITY_TYPES } from '@odigos/ui-utils'; import { Stepper } from '@odigos/ui-components'; import { OnboardingStepperWrapper } from '@/components'; import SetupHeader from '@/components/lib-imports/setup-header'; -import { FormRef, SourceSelectionForm } from '@odigos/ui-containers'; +import { SourceSelectionForm, type SourceSelectionFormRef } from '@odigos/ui-containers'; export default function Page() { // call important hooks that should run on page-mount @@ -16,7 +16,7 @@ export default function Page() { const onSelectNamespace = (ns: string) => setSelectedNamespace((prev) => (prev === ns ? '' : ns)); const { allNamespaces, data: namespace, loading: nsLoad } = useNamespace(selectedNamespace); - const formRef = useRef(null); + const formRef = useRef(null); return ( <> diff --git a/frontend/webapp/components/lib-imports/setup-header.tsx b/frontend/webapp/components/lib-imports/setup-header.tsx index b27445e344..60dc193e8b 100644 --- a/frontend/webapp/components/lib-imports/setup-header.tsx +++ b/frontend/webapp/components/lib-imports/setup-header.tsx @@ -5,12 +5,12 @@ import Theme from '@odigos/ui-theme'; import { ENTITY_TYPES } from '@odigos/ui-utils'; import { useDestinationCRUD, useSourceCRUD } from '@/hooks'; import { ArrowIcon, OdigosLogoText } from '@odigos/ui-icons'; -import { type FormRef, useSetupStore } from '@odigos/ui-containers'; +import { type SourceSelectionFormRef, useSetupStore } from '@odigos/ui-containers'; import { Header, NavigationButtons, NavigationButtonsProps, Text } from '@odigos/ui-components'; interface SetupHeaderProps { entityType: ENTITY_TYPES; - formRef?: RefObject; // in sources + formRef?: RefObject; // in sources isLoading?: boolean; // in destinations setIsLoading?: Dispatch>; // in destinations } diff --git a/frontend/webapp/graphql/queries/compute-platform.ts b/frontend/webapp/graphql/queries/compute-platform.ts index b8492cb994..efb3a410cc 100644 --- a/frontend/webapp/graphql/queries/compute-platform.ts +++ b/frontend/webapp/graphql/queries/compute-platform.ts @@ -56,6 +56,8 @@ export const GET_SOURCES = gql` } conditions { status + type + reason message lastTransitionTime } @@ -94,9 +96,11 @@ export const GET_DESTINATIONS = gql` } } conditions { - type status + type + reason message + lastTransitionTime } } } diff --git a/frontend/webapp/hooks/actions/useActionCRUD.ts b/frontend/webapp/hooks/actions/useActionCRUD.ts index 617e5e7597..0ab225957d 100644 --- a/frontend/webapp/hooks/actions/useActionCRUD.ts +++ b/frontend/webapp/hooks/actions/useActionCRUD.ts @@ -67,6 +67,11 @@ export const useActionCRUD = (params?: UseActionCrudParams): UseActionCrudRespon notes: parsedSpec.notes, disabled: parsedSpec.disabled, signals: parsedSpec.signals.map((str) => str.toLowerCase() as SIGNAL_TYPE), + collectContainerAttributes: parsedSpec.collectContainerAttributes || false, + collectWorkloadId: parsedSpec.collectWorkloadUID || false, + collectClusterId: parsedSpec.collectClusterUID || false, + labelsAttributes: parsedSpec.labelsAttributes, + annotationsAttributes: parsedSpec.annotationsAttributes, clusterAttributes: parsedSpec.clusterAttributes, attributeNamesToDelete: parsedSpec.attributeNamesToDelete, renames: parsedSpec.renames, @@ -123,6 +128,11 @@ export const useActionCRUD = (params?: UseActionCrudParams): UseActionCrudRespon notes = '', disabled = false, signals, + collectContainerAttributes, + collectWorkloadId, + collectClusterId, + labelsAttributes, + annotationsAttributes, clusterAttributes, attributeNamesToDelete, renames, @@ -142,6 +152,10 @@ export const useActionCRUD = (params?: UseActionCrudParams): UseActionCrudRespon }; switch (type) { + case ACTION_TYPE.K8S_ATTRIBUTES: + payload['details'] = JSON.stringify({ collectContainerAttributes, collectWorkloadId, collectClusterId, labelsAttributes, annotationsAttributes }); + break; + case ACTION_TYPE.ADD_CLUSTER_INFO: payload['details'] = JSON.stringify({ clusterAttributes }); break; diff --git a/frontend/webapp/package.json b/frontend/webapp/package.json index a71ce13c7f..a0dc954425 100644 --- a/frontend/webapp/package.json +++ b/frontend/webapp/package.json @@ -14,13 +14,13 @@ "dependencies": { "@apollo/client": "^3.12.11", "@apollo/experimental-nextjs-app-support": "^0.11.8", - "@odigos/ui-components": "^0.0.59", - "@odigos/ui-containers": "^0.0.32", + "@odigos/ui-components": "^0.0.60", + "@odigos/ui-containers": "^0.0.37", "@odigos/ui-icons": "^0.0.12", "@odigos/ui-theme": "^0.0.16", - "@odigos/ui-utils": "^0.0.22", + "@odigos/ui-utils": "^0.0.26", "graphql": "^16.10.0", - "next": "15.1.6", + "next": "15.1.7", "react": "19.0.0", "react-dom": "19.0.0", "react-error-boundary": "^5.0.0", @@ -34,8 +34,8 @@ "autoprefixer": "^10.4.20", "cypress": "^14.0.2", "eslint": "9.20.0", - "eslint-config-next": "15.1.6", - "postcss": "^8.5.1", + "eslint-config-next": "15.1.7", + "postcss": "^8.5.2", "typescript": "5.7.3" } } diff --git a/frontend/webapp/yarn.lock b/frontend/webapp/yarn.lock index f15af33639..afc687d36a 100644 --- a/frontend/webapp/yarn.lock +++ b/frontend/webapp/yarn.lock @@ -317,57 +317,57 @@ resolved "https://registry.yarnpkg.com/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz#56f00962ff0c4e0eb93d34a047d29fa995e3e342" integrity sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg== -"@next/env@15.1.6": - version "15.1.6" - resolved "https://registry.yarnpkg.com/@next/env/-/env-15.1.6.tgz#2fa863d8c568a56b1c8328a86e621b8bdd4f2a20" - integrity sha512-d9AFQVPEYNr+aqokIiPLNK/MTyt3DWa/dpKveiAaVccUadFbhFEvY6FXYX2LJO2Hv7PHnLBu2oWwB4uBuHjr/w== +"@next/env@15.1.7": + version "15.1.7" + resolved "https://registry.yarnpkg.com/@next/env/-/env-15.1.7.tgz#14e2678f893aec50ff2dcb7a6665092fb9e1263d" + integrity sha512-d9jnRrkuOH7Mhi+LHav2XW91HOgTAWHxjMPkXMGBc9B2b7614P7kjt8tAplRvJpbSt4nbO1lugcT/kAaWzjlLQ== -"@next/eslint-plugin-next@15.1.6": - version "15.1.6" - resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-15.1.6.tgz#1d6d0fd21f58a650821bafeb3a205b25276ce5e3" - integrity sha512-+slMxhTgILUntZDGNgsKEYHUvpn72WP1YTlkmEhS51vnVd7S9jEEy0n9YAMcI21vUG4akTw9voWH02lrClt/yw== +"@next/eslint-plugin-next@15.1.7": + version "15.1.7" + resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-15.1.7.tgz#f8593c714f51ac6d443fb298584954d5def4392b" + integrity sha512-kRP7RjSxfTO13NE317ek3mSGzoZlI33nc/i5hs1KaWpK+egs85xg0DJ4p32QEiHnR0mVjuUfhRIun7awqfL7pQ== dependencies: fast-glob "3.3.1" -"@next/swc-darwin-arm64@15.1.6": - version "15.1.6" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.6.tgz#92f99badab6cb41f4c5c11a3feffa574bd6a9276" - integrity sha512-u7lg4Mpl9qWpKgy6NzEkz/w0/keEHtOybmIl0ykgItBxEM5mYotS5PmqTpo+Rhg8FiOiWgwr8USxmKQkqLBCrw== - -"@next/swc-darwin-x64@15.1.6": - version "15.1.6" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-15.1.6.tgz#f56f4f8d5f6cb5d3915912ac95590d387f897da5" - integrity sha512-x1jGpbHbZoZ69nRuogGL2MYPLqohlhnT9OCU6E6QFewwup+z+M6r8oU47BTeJcWsF2sdBahp5cKiAcDbwwK/lg== - -"@next/swc-linux-arm64-gnu@15.1.6": - version "15.1.6" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.1.6.tgz#0aaffae519c93d1006419d7b98c34ebfd80ecacd" - integrity sha512-jar9sFw0XewXsBzPf9runGzoivajeWJUc/JkfbLTC4it9EhU8v7tCRLH7l5Y1ReTMN6zKJO0kKAGqDk8YSO2bg== - -"@next/swc-linux-arm64-musl@15.1.6": - version "15.1.6" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.1.6.tgz#e7398d3d31ca60033f708a718cd6c31edcee2e9a" - integrity sha512-+n3u//bfsrIaZch4cgOJ3tXCTbSxz0s6brJtU3SzLOvkJlPQMJ+eHVRi6qM2kKKKLuMY+tcau8XD9CJ1OjeSQQ== - -"@next/swc-linux-x64-gnu@15.1.6": - version "15.1.6" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.1.6.tgz#d76c72508f4d79d6016cab0c52640b93e590cffb" - integrity sha512-SpuDEXixM3PycniL4iVCLyUyvcl6Lt0mtv3am08sucskpG0tYkW1KlRhTgj4LI5ehyxriVVcfdoxuuP8csi3kQ== - -"@next/swc-linux-x64-musl@15.1.6": - version "15.1.6" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.1.6.tgz#0b8ba80a53e65bf8970ed11ea923001e2512c7cb" - integrity sha512-L4druWmdFSZIIRhF+G60API5sFB7suTbDRhYWSjiw0RbE+15igQvE2g2+S973pMGvwN3guw7cJUjA/TmbPWTHQ== - -"@next/swc-win32-arm64-msvc@15.1.6": - version "15.1.6" - resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.1.6.tgz#81b5dbbfdada2c05deef688e799af4a24097b65f" - integrity sha512-s8w6EeqNmi6gdvM19tqKKWbCyOBvXFbndkGHl+c9YrzsLARRdCHsD9S1fMj8gsXm9v8vhC8s3N8rjuC/XrtkEg== - -"@next/swc-win32-x64-msvc@15.1.6": - version "15.1.6" - resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.1.6.tgz#131993c45ffd124fb4b15258e2f3f9669c143e3c" - integrity sha512-6xomMuu54FAFxttYr5PJbEfu96godcxBTRk1OhAvJq0/EnmFU/Ybiax30Snis4vdWZ9LGpf7Roy5fSs7v/5ROQ== +"@next/swc-darwin-arm64@15.1.7": + version "15.1.7" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.7.tgz#ecc6eacf174df36a6c73f7c319ed864ec6e08079" + integrity sha512-hPFwzPJDpA8FGj7IKV3Yf1web3oz2YsR8du4amKw8d+jAOHfYHYFpMkoF6vgSY4W6vB29RtZEklK9ayinGiCmQ== + +"@next/swc-darwin-x64@15.1.7": + version "15.1.7" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-15.1.7.tgz#d25b4c131d13439ea4b263dbcd0fd518a835f31c" + integrity sha512-2qoas+fO3OQKkU0PBUfwTiw/EYpN+kdAx62cePRyY1LqKtP09Vp5UcUntfZYajop5fDFTjSxCHfZVRxzi+9FYQ== + +"@next/swc-linux-arm64-gnu@15.1.7": + version "15.1.7" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.1.7.tgz#b19abc7b56918042b5309f55f7010e7932ee4967" + integrity sha512-sKLLwDX709mPdzxMnRIXLIT9zaX2w0GUlkLYQnKGoXeWUhcvpCrK+yevcwCJPdTdxZEUA0mOXGLdPsGkudGdnA== + +"@next/swc-linux-arm64-musl@15.1.7": + version "15.1.7" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.1.7.tgz#cb2ac35d3024e9d46ce0d4ff03bf491e0773519f" + integrity sha512-zblK1OQbQWdC8fxdX4fpsHDw+VSpBPGEUX4PhSE9hkaWPrWoeIJn+baX53vbsbDRaDKd7bBNcXRovY1hEhFd7w== + +"@next/swc-linux-x64-gnu@15.1.7": + version "15.1.7" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.1.7.tgz#cf6e338a1fbb1c9b019c158a76a7ab4f143929ce" + integrity sha512-GOzXutxuLvLHFDAPsMP2zDBMl1vfUHHpdNpFGhxu90jEzH6nNIgmtw/s1MDwpTOiM+MT5V8+I1hmVFeAUhkbgQ== + +"@next/swc-linux-x64-musl@15.1.7": + version "15.1.7" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.1.7.tgz#94c9117ece8e5851e7e6674f12d6b82b435e3a6f" + integrity sha512-WrZ7jBhR7ATW1z5iEQ0ZJfE2twCNSXbpCSaAunF3BKcVeHFADSI/AW1y5Xt3DzTqPF1FzQlwQTewqetAABhZRQ== + +"@next/swc-win32-arm64-msvc@15.1.7": + version "15.1.7" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.1.7.tgz#4947f3b7f41c7347114985bf3c91e2eacddfe124" + integrity sha512-LDnj1f3OVbou1BqvvXVqouJZKcwq++mV2F+oFHptToZtScIEnhNRJAhJzqAtTE2dB31qDYL45xJwrc+bLeKM2Q== + +"@next/swc-win32-x64-msvc@15.1.7": + version "15.1.7" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.1.7.tgz#0adb399deb15291b61be94909a97e0d6ce1f61fa" + integrity sha512-dC01f1quuf97viOfW05/K8XYv2iuBgAxJZl7mbCKEjMgdQl5JjAKJ0D2qMKZCgPWDeFbFT0Q0nYWwytEW0DWTQ== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -395,29 +395,29 @@ resolved "https://registry.yarnpkg.com/@nolyfill/is-core-module/-/is-core-module-1.0.39.tgz#3dc35ba0f1e66b403c00b39344f870298ebb1c8e" integrity sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA== -"@odigos/ui-components@^0.0.59": - version "0.0.59" - resolved "https://registry.yarnpkg.com/@odigos/ui-components/-/ui-components-0.0.59.tgz#8cca2b713c71c36edeeebf26a1da24870791fe8e" - integrity sha512-N6220LsJW5Q+FCR5veRJwwCQYquWvFQXzItoDHZIc+/p4F8DPA25vnq6qZiHGRMkgPb8mJjRgpuweZxdKxEEgw== +"@odigos/ui-components@^0.0.60": + version "0.0.60" + resolved "https://registry.yarnpkg.com/@odigos/ui-components/-/ui-components-0.0.60.tgz#9e53791d702a65eb25ce138d4def2aedee3e2743" + integrity sha512-GQyl90YwLMJVCF9Re6O1sTIhDjU2KpMMy71aKrtAklwgjXUla480my2RnJINkeiOSuBT6iIPkMmLoA+s4oAktQ== dependencies: "@odigos/ui-icons" "^0.0.12" "@odigos/ui-theme" "^0.0.16" - "@odigos/ui-utils" "^0.0.22" + "@odigos/ui-utils" "^0.0.25" prism-react-renderer "^2.4.1" react "^19.0.0" react-dom "^19.0.0" react-lottie "^1.2.10" styled-components "^6.1.15" -"@odigos/ui-containers@^0.0.32": - version "0.0.32" - resolved "https://registry.yarnpkg.com/@odigos/ui-containers/-/ui-containers-0.0.32.tgz#86a97f7b423368c96ac064c1d2750fb9384c1507" - integrity sha512-Z7jTDU7LyLNS8PZZ6FD7gDzhjwsf+rHCOVsEpYzBnEzVGk3mxl5n/+25tr2w7N6R/uOPyEafz2NHeIVFjGdoSA== +"@odigos/ui-containers@^0.0.37": + version "0.0.37" + resolved "https://registry.yarnpkg.com/@odigos/ui-containers/-/ui-containers-0.0.37.tgz#50a38dcada409d44b6118af566cd16cffc52375e" + integrity sha512-uocMQS2TL3ZttcTQZFcGcKpE/fGzXzYajE0bbGC3p8tn6Qlzwow4bL/Tw6MfazrkJnz/bXe+xhtfL+xpF4t3Fw== dependencies: - "@odigos/ui-components" "^0.0.59" + "@odigos/ui-components" "^0.0.60" "@odigos/ui-icons" "^0.0.12" "@odigos/ui-theme" "^0.0.16" - "@odigos/ui-utils" "^0.0.22" + "@odigos/ui-utils" "^0.0.26" "@xyflow/react" "^12.4.2" react "^19.0.0" react-dom "^19.0.0" @@ -434,33 +434,35 @@ react-dom "^19.0.0" styled-components "^6.1.15" -"@odigos/ui-theme@^0.0.15": - version "0.0.15" - resolved "https://registry.yarnpkg.com/@odigos/ui-theme/-/ui-theme-0.0.15.tgz#6b50485e07c8cf2b94e442d2e0b201426419eb97" - integrity sha512-QIW/O7x/q38mmwf+SvXfEbuX0X+PXRovOwVMSDydrGbH8gafgOoufbGL82+KeLVpm7pvJu8MQYIZn8YaOEpdHw== +"@odigos/ui-theme@^0.0.16": + version "0.0.16" + resolved "https://registry.yarnpkg.com/@odigos/ui-theme/-/ui-theme-0.0.16.tgz#99e1b584877e5482ce3b4fc5217cba9e89cd1400" + integrity sha512-1ov3imeubDKLyXCqJ9gaTp5UxBqT3/A8UzgokywHx3vDuQA0kPUrzVYBl3aO5w5ARAUT4gh5eMDMDIaw9T9vAg== dependencies: react "^19.0.0" react-dom "^19.0.0" styled-components "^6.1.15" zustand "^5.0.3" -"@odigos/ui-theme@^0.0.16": - version "0.0.16" - resolved "https://registry.yarnpkg.com/@odigos/ui-theme/-/ui-theme-0.0.16.tgz#99e1b584877e5482ce3b4fc5217cba9e89cd1400" - integrity sha512-1ov3imeubDKLyXCqJ9gaTp5UxBqT3/A8UzgokywHx3vDuQA0kPUrzVYBl3aO5w5ARAUT4gh5eMDMDIaw9T9vAg== +"@odigos/ui-utils@^0.0.25": + version "0.0.25" + resolved "https://registry.yarnpkg.com/@odigos/ui-utils/-/ui-utils-0.0.25.tgz#37d9e614d9662d54f0a00d14e21e135744a5e83b" + integrity sha512-uyvrVv5Wisek3uJPkaOlPDeXUadR7jaxPaSqQRdpUuTSkC2vSuvGsjr+bmZsCXfNLOSnPRiKvd2Lkv5F+HOtjg== dependencies: + "@odigos/ui-icons" "^0.0.12" + "@odigos/ui-theme" "^0.0.16" + javascript-time-ago "^2.5.11" react "^19.0.0" react-dom "^19.0.0" styled-components "^6.1.15" - zustand "^5.0.3" -"@odigos/ui-utils@^0.0.22": - version "0.0.22" - resolved "https://registry.yarnpkg.com/@odigos/ui-utils/-/ui-utils-0.0.22.tgz#de830a4232955d71ec34371e6cfad303e69726d5" - integrity sha512-NjwXdFF2jM20MtCcMPoltsWWArw0Z6v37nrNqOuM7O3RTprnGBHNmQXbNfaeQJ4GFs6B2Kw4dKnj0dxJxmJ2Sg== +"@odigos/ui-utils@^0.0.26": + version "0.0.26" + resolved "https://registry.yarnpkg.com/@odigos/ui-utils/-/ui-utils-0.0.26.tgz#e8939a9bbfaba8b6866c1bed30776073c389c354" + integrity sha512-SLzx47oJW5VZ0cVByOPor3x1lsDIP0RfmqeVZ+/hRRodAiEsFGtIra5tO6J4UME2sYL45WWlwMmV/v4zPq71cQ== dependencies: "@odigos/ui-icons" "^0.0.12" - "@odigos/ui-theme" "^0.0.15" + "@odigos/ui-theme" "^0.0.16" javascript-time-ago "^2.5.11" react "^19.0.0" react-dom "^19.0.0" @@ -1649,12 +1651,12 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -eslint-config-next@15.1.6: - version "15.1.6" - resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-15.1.6.tgz#c056b7325dc70a247895c7c85515ebaae2bab35d" - integrity sha512-Wd1uy6y7nBbXUSg9QAuQ+xYEKli5CgUhLjz1QHW11jLDis5vK5XB3PemL6jEmy7HrdhaRFDz+GTZ/3FoH+EUjg== +eslint-config-next@15.1.7: + version "15.1.7" + resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-15.1.7.tgz#80d287e6d1c0742304de8fe57cbc45000c455c11" + integrity sha512-zXoMnYUIy3XHaAoOhrcYkT9UQWvXqWju2K7NNsmb5wd/7XESDwof61eUdW4QhERr3eJ9Ko/vnXqIrj8kk/drYw== dependencies: - "@next/eslint-plugin-next" "15.1.6" + "@next/eslint-plugin-next" "15.1.7" "@rushstack/eslint-patch" "^1.10.3" "@typescript-eslint/eslint-plugin" "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0" "@typescript-eslint/parser" "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0" @@ -2799,12 +2801,12 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -next@15.1.6: - version "15.1.6" - resolved "https://registry.yarnpkg.com/next/-/next-15.1.6.tgz#ce22fd0a8f36da1fc4aba86e3ec7e98eb248c555" - integrity sha512-Hch4wzbaX0vKQtalpXvUiw5sYivBy4cm5rzUKrBnUB/y436LGrvOUqYvlSeNVCWFO/770gDlltR9gqZH62ct4Q== +next@15.1.7: + version "15.1.7" + resolved "https://registry.yarnpkg.com/next/-/next-15.1.7.tgz#e814845e7cdb0294aee88ceab0bb962de83e8e6f" + integrity sha512-GNeINPGS9c6OZKCvKypbL8GTsT5GhWPp4DM0fzkXJuXMilOO2EeFxuAY6JZbtk6XIl6Ws10ag3xRINDjSO5+wg== dependencies: - "@next/env" "15.1.6" + "@next/env" "15.1.7" "@swc/counter" "0.1.3" "@swc/helpers" "0.5.15" busboy "1.6.0" @@ -2812,14 +2814,14 @@ next@15.1.6: postcss "8.4.31" styled-jsx "5.1.6" optionalDependencies: - "@next/swc-darwin-arm64" "15.1.6" - "@next/swc-darwin-x64" "15.1.6" - "@next/swc-linux-arm64-gnu" "15.1.6" - "@next/swc-linux-arm64-musl" "15.1.6" - "@next/swc-linux-x64-gnu" "15.1.6" - "@next/swc-linux-x64-musl" "15.1.6" - "@next/swc-win32-arm64-msvc" "15.1.6" - "@next/swc-win32-x64-msvc" "15.1.6" + "@next/swc-darwin-arm64" "15.1.7" + "@next/swc-darwin-x64" "15.1.7" + "@next/swc-linux-arm64-gnu" "15.1.7" + "@next/swc-linux-arm64-musl" "15.1.7" + "@next/swc-linux-x64-gnu" "15.1.7" + "@next/swc-linux-x64-musl" "15.1.7" + "@next/swc-win32-arm64-msvc" "15.1.7" + "@next/swc-win32-x64-msvc" "15.1.7" sharp "^0.33.5" node-releases@^2.0.19: @@ -3050,10 +3052,10 @@ postcss@8.4.49: picocolors "^1.1.1" source-map-js "^1.2.1" -postcss@^8.5.1: - version "8.5.1" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.1.tgz#e2272a1f8a807fafa413218245630b5db10a3214" - integrity sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ== +postcss@^8.5.2: + version "8.5.2" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.2.tgz#e7b99cb9d2ec3e8dd424002e7c16517cb2b846bd" + integrity sha512-MjOadfU3Ys9KYoX0AdkBlFEF1Vx37uCCeN4ZHnmwm9FfpbsGWMZeBLMmmpY+6Ocqod7mkdZ0DT31OlbsFrLlkA== dependencies: nanoid "^3.3.8" picocolors "^1.1.1" diff --git a/helm/odigos/templates/crds/actions.odigos.io_k8sattributesresolvers.yaml b/helm/odigos/templates/crds/actions.odigos.io_k8sattributesresolvers.yaml new file mode 100644 index 0000000000..bf9decec8e --- /dev/null +++ b/helm/odigos/templates/crds/actions.odigos.io_k8sattributesresolvers.yaml @@ -0,0 +1,194 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.1 + labels: + metadata.labels.odigos.io/config: "1" + metadata.labels.odigos.io/system-object: "true" + name: k8sattributesresolvers.actions.odigos.io +spec: + group: actions.odigos.io + names: + kind: K8sAttributesResolver + listKind: K8sAttributesResolverList + plural: k8sattributesresolvers + singular: k8sattributesresolver + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: K8sAttributesResolver allows adding an action to collect k8s + attributes. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + properties: + actionName: + type: string + annotationsAttributes: + description: list of annotations to be extracted from the pod, and + the attribute key to be used for the resource attribute created + from each annotation. + items: + properties: + annotationKey: + description: |- + The label name to be extracted from the pod. + e.g. "kubectl.kubernetes.io/restartedAt" + type: string + attributeKey: + description: |- + The attribute key to be used for the resource attribute created from the label. + e.g. "kubectl.kubernetes.restartedAte" + type: string + required: + - annotationKey + - attributeKey + type: object + type: array + collectClusterUID: + description: Collect the k8s.cluster.uid attribute, which is set to + the uid of the namespace "kube-system" + type: boolean + collectContainerAttributes: + description: |- + Collect the following container related attributes: + k8s.container.name + container.id + container.image.name + container.image.tag + type: boolean + collectWorkloadUID: + description: |- + Collect the following workload UID attributes: + k8s.deployment.uid + k8s.daemonset.uid + k8s.statefulset.uid + type: boolean + disabled: + type: boolean + labelsAttributes: + description: list of labels to be extracted from the pod, and the + attribute key to be used for the resource attribute created from + each label. + items: + properties: + attributeKey: + description: |- + The attribute key to be used for the resource attribute created from the label. + e.g. "app.kubernetes.name" + type: string + labelKey: + description: |- + The label name to be extracted from the pod. + e.g. "app.kubernetes.io/name" + type: string + required: + - attributeKey + - labelKey + type: object + type: array + notes: + type: string + signals: + items: + enum: + - LOGS + - TRACES + - METRICS + type: string + type: array + required: + - signals + type: object + status: + description: K8sAttributesStatus defines the observed state of K8sAttributes + action + properties: + conditions: + description: |- + Represents the observations of a k8sattributes' current state. + Known .status.conditions.type are: "Available", "Progressing" + 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 + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml b/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml index a4327066b1..bff82ce4db 100644 --- a/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml +++ b/helm/odigos/templates/crds/odigos.io_instrumentationconfigs.yaml @@ -46,6 +46,13 @@ spec: description: determines if odigos should inject agents to pods of this workload. type: boolean + agentsMetaHash: + description: |- + this hash is used to determine the deployment of the agents. + e.g. when the distro for container changes, or it's compatibility version, + or something else that requires rollout, the hash change will indicate that. + if the hash is empty, it means that no agent should be enabled in any pod container. + type: string containers: description: configuration for each instrumented container in the workload @@ -611,9 +618,9 @@ spec: type: array workloadRolloutHash: description: |- - The hash used to determine whether the associated workload needs to be rolled out. - This hash is calculated based on the containers config array and takes into account the - container name, Instrumented flag and the OTel distro name. + This hash is recorded only after the rollout took place. + it allows us to determine if the workload needs to be rollout based on previous rollout and the current config. + if this field is different than the spec.AgentsDeploymentHash it means rollout is needed or not yet updated. type: string type: object type: object diff --git a/helm/odigos/templates/instrumentor/clusterrole.yaml b/helm/odigos/templates/instrumentor/clusterrole.yaml index 278f51f873..e8610d638c 100644 --- a/helm/odigos/templates/instrumentor/clusterrole.yaml +++ b/helm/odigos/templates/instrumentor/clusterrole.yaml @@ -19,6 +19,14 @@ rules: - list - watch - get + - apiGroups: + - '' + resources: + - pods + verbs: + - list + - watch + - get - apiGroups: - apps resources: diff --git a/instrumentor/controllers/agentenabled/pods_webhook.go b/instrumentor/controllers/agentenabled/pods_webhook.go index bc4cf7f771..3e1b5fb4a7 100644 --- a/instrumentor/controllers/agentenabled/pods_webhook.go +++ b/instrumentor/controllers/agentenabled/pods_webhook.go @@ -113,6 +113,10 @@ func (p *PodsWebhook) Default(ctx context.Context, obj runtime.Object) error { return nil } + // store the agents deployment value so we can later associate each pod with the instrumentation version. + // we can pull only our pods into cache, and follow the lifecycle of the instrumentation process. + pod.Labels[k8sconsts.OdigosAgentsMetaHashLabel] = ic.Spec.AgentsMetaHash + return nil } diff --git a/instrumentor/controllers/agentenabled/rollout/hash.go b/instrumentor/controllers/agentenabled/rollout/hash.go index d40cd4176b..2262fa21f0 100644 --- a/instrumentor/controllers/agentenabled/rollout/hash.go +++ b/instrumentor/controllers/agentenabled/rollout/hash.go @@ -4,21 +4,22 @@ import ( "bytes" "crypto/sha256" "encoding/gob" + "encoding/hex" "slices" "strings" - odigosv1alpha1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" + odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" ) -func hashForContainersConfig(containersConfig []odigosv1alpha1.ContainerAgentConfig) ([]byte, error) { +func HashForContainersConfig(containersConfig []odigosv1.ContainerAgentConfig) (string, error) { if len(containersConfig) == 0 { - return []byte{}, nil + return "", nil } // sort the entries by container name // then hash the body of each entry // this is required to ensure that the hash is consistent - slices.SortFunc(containersConfig, func(i, j odigosv1alpha1.ContainerAgentConfig) int { + slices.SortFunc(containersConfig, func(i, j odigosv1.ContainerAgentConfig) int { return strings.Compare(i.ContainerName, j.ContainerName) }) @@ -42,11 +43,15 @@ func hashForContainersConfig(containersConfig []odigosv1alpha1.ContainerAgentCon } err = enc.Encode(configEntry) if err != nil { - return nil, err + return "", err } hash.Write(buf.Bytes()) buf.Reset() } - return hash.Sum(nil), nil + hashBytes := hash.Sum(nil) + // limit the hash to 16 characters, as it's written into k8s resources and annotations + shortHash := hashBytes[:8] + hashAsHex := hex.EncodeToString(shortHash) + return hashAsHex, nil } diff --git a/instrumentor/controllers/agentenabled/rollout/hash_test.go b/instrumentor/controllers/agentenabled/rollout/hash_test.go index 880c9e928e..1f7fe8a18d 100644 --- a/instrumentor/controllers/agentenabled/rollout/hash_test.go +++ b/instrumentor/controllers/agentenabled/rollout/hash_test.go @@ -1,7 +1,6 @@ package rollout import ( - "encoding/hex" "testing" "github.com/stretchr/testify/assert" @@ -11,9 +10,9 @@ import ( func TestHashForContainersConfig(t *testing.T) { // empty containers config - hash, err := hashForContainersConfig([]odigosv1alpha1.ContainerAgentConfig{}) + hashText, err := HashForContainersConfig([]odigosv1alpha1.ContainerAgentConfig{}) assert.NoError(t, err) - assert.Equal(t, len(hash), 0) + assert.Equal(t, len(hashText), 0) containersConfig := []odigosv1alpha1.ContainerAgentConfig{ { @@ -28,9 +27,9 @@ func TestHashForContainersConfig(t *testing.T) { }, } - hash, err = hashForContainersConfig(containersConfig) + hashText, err = HashForContainersConfig(containersConfig) assert.NoError(t, err) - assert.Greater(t, len(hash), 0) + assert.Greater(t, len(hashText), 0) // flip the order of the containers and check if the hash is the same @@ -47,22 +46,22 @@ func TestHashForContainersConfig(t *testing.T) { }, } - hash2, err := hashForContainersConfig(containersConfig) + hash2, err := HashForContainersConfig(containersConfig) assert.NoError(t, err) assert.Greater(t, len(hash2), 0) - assert.Equal(t, hex.EncodeToString(hash), hex.EncodeToString(hash2)) + assert.Equal(t, hashText, hash2) // flip the false instrumented flag and check if the hash is different containersConfig[1].AgentEnabled = true - hash3, err := hashForContainersConfig(containersConfig) + hash3, err := HashForContainersConfig(containersConfig) assert.NoError(t, err) assert.Greater(t, len(hash3), 0) - assert.NotEqual(t, hex.EncodeToString(hash), hex.EncodeToString(hash3)) + assert.NotEqual(t, hashText, hash3) // change the distro name and check if the hash is different containersConfig[1].OtelDistroName = "otel-distro-3" - hash4, err := hashForContainersConfig(containersConfig) + hash4, err := HashForContainersConfig(containersConfig) assert.NoError(t, err) assert.Greater(t, len(hash4), 0) - assert.NotEqual(t, hex.EncodeToString(hash), hex.EncodeToString(hash4)) + assert.NotEqual(t, hashText, hash4) } diff --git a/instrumentor/controllers/agentenabled/rollout/rollout.go b/instrumentor/controllers/agentenabled/rollout/rollout.go index 5d1b41b437..eedf71e29c 100644 --- a/instrumentor/controllers/agentenabled/rollout/rollout.go +++ b/instrumentor/controllers/agentenabled/rollout/rollout.go @@ -2,7 +2,6 @@ package rollout import ( "context" - "encoding/hex" "errors" "fmt" "time" @@ -49,11 +48,7 @@ func Do(ctx context.Context, c client.Client, ic *odigosv1alpha1.Instrumentation } savedRolloutHash := ic.Status.WorkloadRolloutHash - newRolloutHash, err := configHash(ic) - if err != nil { - logger.Error(err, "error calculating rollout hash") - return false, ctrl.Result{}, nil - } + newRolloutHash := ic.Spec.AgentsMetaHash if savedRolloutHash == newRolloutHash { return false, ctrl.Result{}, nil @@ -181,24 +176,6 @@ func isWorkloadRolloutDone(obj client.Object) bool { } } -// configHash calculates a hash for the instrumentation config, based on the containers configuration -// if agent injection is enabled, the hash is based on the containers configuration -// if agent injection is disabled, the hash is empty -// the reason for this is to avoid unnecessary rollouts when agent injection is disabled -// (e,g the transition from empty config to a disabled one should not trigger a rollout) -func configHash(ic *odigosv1alpha1.InstrumentationConfig) (string, error) { - if !ic.Spec.AgentInjectionEnabled { - return "", nil - } - - newRolloutHashBytes, err := hashForContainersConfig(ic.Spec.Containers) - if err != nil { - return "", err - } - - return hex.EncodeToString(newRolloutHashBytes), nil -} - func rolloutCondition(rolloutErr error) metav1.Condition { cond := metav1.Condition{ Type: odigosv1alpha1.WorkloadRolloutStatusConditionType, diff --git a/instrumentor/controllers/agentenabled/sync.go b/instrumentor/controllers/agentenabled/sync.go index f8a6b4173d..7b5ab1090b 100644 --- a/instrumentor/controllers/agentenabled/sync.go +++ b/instrumentor/controllers/agentenabled/sync.go @@ -130,6 +130,7 @@ func updateInstrumentationConfigSpec(ctx context.Context, c client.Client, pw k8 prerequisiteCompleted, reason, message := isReadyForInstrumentation(cg, ic) if !prerequisiteCompleted { ic.Spec.AgentInjectionEnabled = false + ic.Spec.AgentsMetaHash = "" ic.Spec.Containers = []odigosv1.ContainerAgentConfig{} return &agentInjectedStatusCondition{ Status: metav1.ConditionUnknown, @@ -170,6 +171,11 @@ func updateInstrumentationConfigSpec(ctx context.Context, c client.Client, pw k8 // if any instrumented containers are found, the pods webhook should process pods for this workload. // set the AgentInjectionEnabled to true to signal that. ic.Spec.AgentInjectionEnabled = true + agentsDeploymentHash, err := rollout.HashForContainersConfig(containersConfig) + if err != nil { + return nil, err + } + ic.Spec.AgentsMetaHash = string(agentsDeploymentHash) return &agentInjectedStatusCondition{ Status: metav1.ConditionTrue, Reason: odigosv1.AgentEnabledReasonEnabledSuccessfully, @@ -179,6 +185,7 @@ func updateInstrumentationConfigSpec(ctx context.Context, c client.Client, pw k8 // if none of the containers are instrumented, we can set the status to false // to signal to the webhook that those pods should not be processed. ic.Spec.AgentInjectionEnabled = false + ic.Spec.AgentsMetaHash = "" return aggregatedCondition, nil } } diff --git a/instrumentor/main.go b/instrumentor/main.go index 594eec94de..4ba0304c4a 100644 --- a/instrumentor/main.go +++ b/instrumentor/main.go @@ -18,6 +18,7 @@ package main import ( "flag" + "fmt" "os" "time" @@ -44,6 +45,7 @@ import ( "github.com/go-logr/zapr" bridge "github.com/odigos-io/opentelemetry-zap-bridge" + "github.com/odigos-io/odigos/api/k8sconsts" odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" "github.com/odigos-io/odigos/common" @@ -54,7 +56,9 @@ import ( // to ensure that exec-entrypoint and run can make use of them. "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/selection" utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" _ "k8s.io/client-go/plugin/pkg/client/auth" @@ -107,6 +111,29 @@ func main() { nsSelector := client.InNamespace(odigosNs).AsSelector() odigosEffectiveConfigNameSelector := fields.OneTermEqualSelector("metadata.name", consts.OdigosEffectiveConfigName) odigosEffectiveConfigSelector := fields.AndSelectors(nsSelector, odigosEffectiveConfigNameSelector) + instrumentedPodReq, _ := labels.NewRequirement(k8sconsts.OdigosAgentsMetaHashLabel, selection.Exists, []string{}) + instrumentedPodSelector := labels.NewSelector().Add(*instrumentedPodReq) + + podsTransformFunc := func(obj interface{}) (interface{}, error) { + pod, ok := obj.(*corev1.Pod) + if !ok { + return nil, fmt.Errorf("expected a Pod, got %T", obj) + } + + stripedStatus := corev1.PodStatus{ + Phase: pod.Status.Phase, + ContainerStatuses: pod.Status.ContainerStatuses, // TODO: we don't need all data here + Message: pod.Status.Message, + Reason: pod.Status.Reason, + StartTime: pod.Status.StartTime, + } + strippedPod := corev1.Pod{ + ObjectMeta: pod.ObjectMeta, + Status: stripedStatus, + } + strippedPod.SetManagedFields(nil) // don't store managed fields in the cache + return &strippedPod, nil + } mgrOptions := ctrl.Options{ Scheme: scheme, @@ -143,9 +170,11 @@ func main() { RetryPeriod: durationPointer(1 * time.Second), Cache: cache.Options{ DefaultTransform: cache.TransformStripManagedFields(), - // Store minimum amount of data for every object type. - // Currently, instrumentor only need the labels of the workloads. ByObject: map[client.Object]cache.ByObject{ + &corev1.Pod{}: { + Label: instrumentedPodSelector, + Transform: podsTransformFunc, + }, &corev1.ConfigMap{}: { Field: odigosEffectiveConfigSelector, },
FieldTypeDescription
+agentsMetaHash [Required] + +string + +

this hash is used to determine the deployment of the agents. +e.g. when the distro for container changes, or it's compatibility version, +or something else that requires rollout, the hash change will indicate that. +if the hash is empty, it means that no agent should be enabled in any pod container.

+
sdkConfigs [Required] @@ -1353,9 +1367,9 @@ TODO: consider adding more granular control over the SDKs, such as community/ent string -

The hash used to determine whether the associated workload needs to be rolled out. -This hash is calculated based on the containers config array and takes into account the -container name, Instrumented flag and the OTel distro name.

+

This hash is recorded only after the rollout took place. +it allows us to determine if the workload needs to be rollout based on previous rollout and the current config. +if this field is different than the spec.AgentsDeploymentHash it means rollout is needed or not yet updated.