diff --git a/api/config/crd/bases/odigos.io_sources.yaml b/api/config/crd/bases/odigos.io_sources.yaml new file mode 100644 index 0000000000..c59f98ae29 --- /dev/null +++ b/api/config/crd/bases/odigos.io_sources.yaml @@ -0,0 +1,144 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.1 + name: sources.odigos.io +spec: + group: odigos.io + names: + kind: Source + listKind: SourceList + plural: sources + singular: source + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.workload.name + name: Workload + type: string + - jsonPath: .spec.workload.kind + name: Kind + type: string + - jsonPath: .spec.workload.namespace + name: Namespace + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: Source configures an application for auto-instrumentation. + 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: + workload: + description: |- + Workload represents the workload or namespace to be instrumented. + This field is required upon creation and cannot be modified. + properties: + kind: + description: |- + 1. the pascal case representation of the workload kind + it is used in k8s api objects as the `Kind` field. + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + - namespace + type: object + required: + - workload + type: object + status: + properties: + conditions: + description: |- + Represents the observations of a source's 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 + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/source.go b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/source.go new file mode 100644 index 0000000000..4a706aee61 --- /dev/null +++ b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/source.go @@ -0,0 +1,224 @@ +/* +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 applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// SourceApplyConfiguration represents a declarative configuration of the Source type for use +// with apply. +type SourceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *SourceSpecApplyConfiguration `json:"spec,omitempty"` + Status *SourceStatusApplyConfiguration `json:"status,omitempty"` +} + +// Source constructs a declarative configuration of the Source type for use with +// apply. +func Source(name, namespace string) *SourceApplyConfiguration { + b := &SourceApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Source") + b.WithAPIVersion("odigos.io/v1alpha1") + return b +} + +// 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 *SourceApplyConfiguration) WithKind(value string) *SourceApplyConfiguration { + b.Kind = &value + return b +} + +// 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 *SourceApplyConfiguration) WithAPIVersion(value string) *SourceApplyConfiguration { + b.APIVersion = &value + return b +} + +// 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 *SourceApplyConfiguration) WithName(value string) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// 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 *SourceApplyConfiguration) WithGenerateName(value string) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// 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 *SourceApplyConfiguration) WithNamespace(value string) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// 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 *SourceApplyConfiguration) WithUID(value types.UID) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// 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 *SourceApplyConfiguration) WithResourceVersion(value string) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// 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 *SourceApplyConfiguration) WithGeneration(value int64) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// 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 *SourceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// 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 *SourceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// 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 *SourceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// 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 *SourceApplyConfiguration) WithLabels(entries map[string]string) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// 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 *SourceApplyConfiguration) WithAnnotations(entries map[string]string) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// 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 *SourceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// 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 *SourceApplyConfiguration) WithFinalizers(values ...string) *SourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *SourceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// 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 *SourceApplyConfiguration) WithSpec(value *SourceSpecApplyConfiguration) *SourceApplyConfiguration { + b.Spec = value + return b +} + +// 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 *SourceApplyConfiguration) WithStatus(value *SourceStatusApplyConfiguration) *SourceApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *SourceApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/sourcespec.go b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/sourcespec.go new file mode 100644 index 0000000000..ae7774ba80 --- /dev/null +++ b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/sourcespec.go @@ -0,0 +1,42 @@ +/* +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 applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + workload "github.com/odigos-io/odigos/k8sutils/pkg/workload" +) + +// SourceSpecApplyConfiguration represents a declarative configuration of the SourceSpec type for use +// with apply. +type SourceSpecApplyConfiguration struct { + Workload *workload.PodWorkload `json:"workload,omitempty"` +} + +// SourceSpecApplyConfiguration constructs a declarative configuration of the SourceSpec type for use with +// apply. +func SourceSpec() *SourceSpecApplyConfiguration { + return &SourceSpecApplyConfiguration{} +} + +// WithWorkload sets the Workload 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 Workload field is set to the value of the last call. +func (b *SourceSpecApplyConfiguration) WithWorkload(value workload.PodWorkload) *SourceSpecApplyConfiguration { + b.Workload = &value + return b +} diff --git a/api/generated/odigos/applyconfiguration/odigos/v1alpha1/sourcestatus.go b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/sourcestatus.go new file mode 100644 index 0000000000..c188eb75c8 --- /dev/null +++ b/api/generated/odigos/applyconfiguration/odigos/v1alpha1/sourcestatus.go @@ -0,0 +1,47 @@ +/* +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 applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// SourceStatusApplyConfiguration represents a declarative configuration of the SourceStatus type for use +// with apply. +type SourceStatusApplyConfiguration struct { + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// SourceStatusApplyConfiguration constructs a declarative configuration of the SourceStatus type for use with +// apply. +func SourceStatus() *SourceStatusApplyConfiguration { + return &SourceStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *SourceStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *SourceStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/api/generated/odigos/applyconfiguration/utils.go b/api/generated/odigos/applyconfiguration/utils.go index c4383287bf..4d87e42fc7 100644 --- a/api/generated/odigos/applyconfiguration/utils.go +++ b/api/generated/odigos/applyconfiguration/utils.go @@ -113,6 +113,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &odigosv1alpha1.RuntimeDetailsByContainerApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("SdkConfig"): return &odigosv1alpha1.SdkConfigApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Source"): + return &odigosv1alpha1.SourceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("SourceSpec"): + return &odigosv1alpha1.SourceSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("SourceStatus"): + return &odigosv1alpha1.SourceStatusApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("WorkloadInstrumentationConfig"): return &odigosv1alpha1.WorkloadInstrumentationConfigApplyConfiguration{} diff --git a/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/fake/fake_odigos_client.go b/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/fake/fake_odigos_client.go index 9f70f41c2a..37a6bb0124 100644 --- a/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/fake/fake_odigos_client.go +++ b/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/fake/fake_odigos_client.go @@ -59,6 +59,10 @@ func (c *FakeOdigosV1alpha1) Processors(namespace string) v1alpha1.ProcessorInte return &FakeProcessors{c, namespace} } +func (c *FakeOdigosV1alpha1) Sources(namespace string) v1alpha1.SourceInterface { + return &FakeSources{c, namespace} +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeOdigosV1alpha1) RESTClient() rest.Interface { diff --git a/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/fake/fake_source.go b/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/fake/fake_source.go new file mode 100644 index 0000000000..58451ba260 --- /dev/null +++ b/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/fake/fake_source.go @@ -0,0 +1,196 @@ +/* +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 ( + "context" + json "encoding/json" + "fmt" + + odigosv1alpha1 "github.com/odigos-io/odigos/api/generated/odigos/applyconfiguration/odigos/v1alpha1" + v1alpha1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSources implements SourceInterface +type FakeSources struct { + Fake *FakeOdigosV1alpha1 + ns string +} + +var sourcesResource = v1alpha1.SchemeGroupVersion.WithResource("sources") + +var sourcesKind = v1alpha1.SchemeGroupVersion.WithKind("Source") + +// Get takes name of the source, and returns the corresponding source object, and an error if there is any. +func (c *FakeSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Source, err error) { + emptyResult := &v1alpha1.Source{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(sourcesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Source), err +} + +// List takes label and field selectors, and returns the list of Sources that match those selectors. +func (c *FakeSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SourceList, err error) { + emptyResult := &v1alpha1.SourceList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(sourcesResource, sourcesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.SourceList{ListMeta: obj.(*v1alpha1.SourceList).ListMeta} + for _, item := range obj.(*v1alpha1.SourceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested sources. +func (c *FakeSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(sourcesResource, c.ns, opts)) + +} + +// Create takes the representation of a source and creates it. Returns the server's representation of the source, and an error, if there is any. +func (c *FakeSources) Create(ctx context.Context, source *v1alpha1.Source, opts v1.CreateOptions) (result *v1alpha1.Source, err error) { + emptyResult := &v1alpha1.Source{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(sourcesResource, c.ns, source, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Source), err +} + +// Update takes the representation of a source and updates it. Returns the server's representation of the source, and an error, if there is any. +func (c *FakeSources) Update(ctx context.Context, source *v1alpha1.Source, opts v1.UpdateOptions) (result *v1alpha1.Source, err error) { + emptyResult := &v1alpha1.Source{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(sourcesResource, c.ns, source, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Source), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeSources) UpdateStatus(ctx context.Context, source *v1alpha1.Source, opts v1.UpdateOptions) (result *v1alpha1.Source, err error) { + emptyResult := &v1alpha1.Source{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(sourcesResource, "status", c.ns, source, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Source), err +} + +// Delete takes name of the source and deletes it. Returns an error if one occurs. +func (c *FakeSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(sourcesResource, c.ns, name, opts), &v1alpha1.Source{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(sourcesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.SourceList{}) + return err +} + +// Patch applies the patch and returns the patched source. +func (c *FakeSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Source, err error) { + emptyResult := &v1alpha1.Source{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(sourcesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Source), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied source. +func (c *FakeSources) Apply(ctx context.Context, source *odigosv1alpha1.SourceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Source, err error) { + if source == nil { + return nil, fmt.Errorf("source provided to Apply must not be nil") + } + data, err := json.Marshal(source) + if err != nil { + return nil, err + } + name := source.Name + if name == nil { + return nil, fmt.Errorf("source.Name must be provided to Apply") + } + emptyResult := &v1alpha1.Source{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(sourcesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Source), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeSources) ApplyStatus(ctx context.Context, source *odigosv1alpha1.SourceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Source, err error) { + if source == nil { + return nil, fmt.Errorf("source provided to Apply must not be nil") + } + data, err := json.Marshal(source) + if err != nil { + return nil, err + } + name := source.Name + if name == nil { + return nil, fmt.Errorf("source.Name must be provided to Apply") + } + emptyResult := &v1alpha1.Source{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(sourcesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Source), err +} diff --git a/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/generated_expansion.go b/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/generated_expansion.go index a6b52f8da3..15777d780a 100644 --- a/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/generated_expansion.go +++ b/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/generated_expansion.go @@ -32,3 +32,5 @@ type InstrumentedApplicationExpansion interface{} type OdigosConfigurationExpansion interface{} type ProcessorExpansion interface{} + +type SourceExpansion interface{} diff --git a/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/odigos_client.go b/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/odigos_client.go index 06398b4927..6e7b3013cf 100644 --- a/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/odigos_client.go +++ b/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/odigos_client.go @@ -35,6 +35,7 @@ type OdigosV1alpha1Interface interface { InstrumentedApplicationsGetter OdigosConfigurationsGetter ProcessorsGetter + SourcesGetter } // OdigosV1alpha1Client is used to interact with features provided by the odigos.io group. @@ -74,6 +75,10 @@ func (c *OdigosV1alpha1Client) Processors(namespace string) ProcessorInterface { return newProcessors(c, namespace) } +func (c *OdigosV1alpha1Client) Sources(namespace string) SourceInterface { + return newSources(c, namespace) +} + // NewForConfig creates a new OdigosV1alpha1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). diff --git a/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/source.go b/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/source.go new file mode 100644 index 0000000000..3245a184ee --- /dev/null +++ b/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1/source.go @@ -0,0 +1,72 @@ +/* +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" + + odigosv1alpha1 "github.com/odigos-io/odigos/api/generated/odigos/applyconfiguration/odigos/v1alpha1" + scheme "github.com/odigos-io/odigos/api/generated/odigos/clientset/versioned/scheme" + v1alpha1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" + 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" +) + +// SourcesGetter has a method to return a SourceInterface. +// A group's client should implement this interface. +type SourcesGetter interface { + Sources(namespace string) SourceInterface +} + +// SourceInterface has methods to work with Source resources. +type SourceInterface interface { + Create(ctx context.Context, source *v1alpha1.Source, opts v1.CreateOptions) (*v1alpha1.Source, error) + Update(ctx context.Context, source *v1alpha1.Source, opts v1.UpdateOptions) (*v1alpha1.Source, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, source *v1alpha1.Source, opts v1.UpdateOptions) (*v1alpha1.Source, 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) (*v1alpha1.Source, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.SourceList, 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 *v1alpha1.Source, err error) + Apply(ctx context.Context, source *odigosv1alpha1.SourceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Source, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, source *odigosv1alpha1.SourceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Source, err error) + SourceExpansion +} + +// sources implements SourceInterface +type sources struct { + *gentype.ClientWithListAndApply[*v1alpha1.Source, *v1alpha1.SourceList, *odigosv1alpha1.SourceApplyConfiguration] +} + +// newSources returns a Sources +func newSources(c *OdigosV1alpha1Client, namespace string) *sources { + return &sources{ + gentype.NewClientWithListAndApply[*v1alpha1.Source, *v1alpha1.SourceList, *odigosv1alpha1.SourceApplyConfiguration]( + "sources", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Source { return &v1alpha1.Source{} }, + func() *v1alpha1.SourceList { return &v1alpha1.SourceList{} }), + } +} diff --git a/api/generated/odigos/informers/externalversions/generic.go b/api/generated/odigos/informers/externalversions/generic.go index 4e3bd20813..0ce00ff048 100644 --- a/api/generated/odigos/informers/externalversions/generic.go +++ b/api/generated/odigos/informers/externalversions/generic.go @@ -68,6 +68,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Odigos().V1alpha1().OdigosConfigurations().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("processors"): return &genericInformer{resource: resource.GroupResource(), informer: f.Odigos().V1alpha1().Processors().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("sources"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Odigos().V1alpha1().Sources().Informer()}, nil } diff --git a/api/generated/odigos/informers/externalversions/odigos/v1alpha1/interface.go b/api/generated/odigos/informers/externalversions/odigos/v1alpha1/interface.go index 52778ee8de..1602777363 100644 --- a/api/generated/odigos/informers/externalversions/odigos/v1alpha1/interface.go +++ b/api/generated/odigos/informers/externalversions/odigos/v1alpha1/interface.go @@ -39,6 +39,8 @@ type Interface interface { OdigosConfigurations() OdigosConfigurationInformer // Processors returns a ProcessorInformer. Processors() ProcessorInformer + // Sources returns a SourceInformer. + Sources() SourceInformer } type version struct { @@ -91,3 +93,8 @@ func (v *version) OdigosConfigurations() OdigosConfigurationInformer { func (v *version) Processors() ProcessorInformer { return &processorInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } + +// Sources returns a SourceInformer. +func (v *version) Sources() SourceInformer { + return &sourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/api/generated/odigos/informers/externalversions/odigos/v1alpha1/source.go b/api/generated/odigos/informers/externalversions/odigos/v1alpha1/source.go new file mode 100644 index 0000000000..a74144c7b0 --- /dev/null +++ b/api/generated/odigos/informers/externalversions/odigos/v1alpha1/source.go @@ -0,0 +1,89 @@ +/* +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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + versioned "github.com/odigos-io/odigos/api/generated/odigos/clientset/versioned" + internalinterfaces "github.com/odigos-io/odigos/api/generated/odigos/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/odigos-io/odigos/api/generated/odigos/listers/odigos/v1alpha1" + odigosv1alpha1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// SourceInformer provides access to a shared informer and lister for +// Sources. +type SourceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.SourceLister +} + +type sourceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSourceInformer constructs a new informer for Source 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 NewSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSourceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSourceInformer constructs a new informer for Source 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 NewFilteredSourceInformer(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.OdigosV1alpha1().Sources(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OdigosV1alpha1().Sources(namespace).Watch(context.TODO(), options) + }, + }, + &odigosv1alpha1.Source{}, + resyncPeriod, + indexers, + ) +} + +func (f *sourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *sourceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&odigosv1alpha1.Source{}, f.defaultInformer) +} + +func (f *sourceInformer) Lister() v1alpha1.SourceLister { + return v1alpha1.NewSourceLister(f.Informer().GetIndexer()) +} diff --git a/api/generated/odigos/listers/odigos/v1alpha1/expansion_generated.go b/api/generated/odigos/listers/odigos/v1alpha1/expansion_generated.go index 7adce7617b..fea348a49e 100644 --- a/api/generated/odigos/listers/odigos/v1alpha1/expansion_generated.go +++ b/api/generated/odigos/listers/odigos/v1alpha1/expansion_generated.go @@ -80,3 +80,11 @@ type ProcessorListerExpansion interface{} // ProcessorNamespaceListerExpansion allows custom methods to be added to // ProcessorNamespaceLister. type ProcessorNamespaceListerExpansion interface{} + +// SourceListerExpansion allows custom methods to be added to +// SourceLister. +type SourceListerExpansion interface{} + +// SourceNamespaceListerExpansion allows custom methods to be added to +// SourceNamespaceLister. +type SourceNamespaceListerExpansion interface{} diff --git a/api/generated/odigos/listers/odigos/v1alpha1/source.go b/api/generated/odigos/listers/odigos/v1alpha1/source.go new file mode 100644 index 0000000000..36dd5f7b3d --- /dev/null +++ b/api/generated/odigos/listers/odigos/v1alpha1/source.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 ( + v1alpha1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// SourceLister helps list Sources. +// All objects returned here must be treated as read-only. +type SourceLister interface { + // List lists all Sources in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Source, err error) + // Sources returns an object that can list and get Sources. + Sources(namespace string) SourceNamespaceLister + SourceListerExpansion +} + +// sourceLister implements the SourceLister interface. +type sourceLister struct { + listers.ResourceIndexer[*v1alpha1.Source] +} + +// NewSourceLister returns a new SourceLister. +func NewSourceLister(indexer cache.Indexer) SourceLister { + return &sourceLister{listers.New[*v1alpha1.Source](indexer, v1alpha1.Resource("source"))} +} + +// Sources returns an object that can list and get Sources. +func (s *sourceLister) Sources(namespace string) SourceNamespaceLister { + return sourceNamespaceLister{listers.NewNamespaced[*v1alpha1.Source](s.ResourceIndexer, namespace)} +} + +// SourceNamespaceLister helps list and get Sources. +// All objects returned here must be treated as read-only. +type SourceNamespaceLister interface { + // List lists all Sources in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Source, err error) + // Get retrieves the Source from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Source, error) + SourceNamespaceListerExpansion +} + +// sourceNamespaceLister implements the SourceNamespaceLister +// interface. +type sourceNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Source] +} diff --git a/api/odigos/v1alpha1/source_types.go b/api/odigos/v1alpha1/source_types.go new file mode 100644 index 0000000000..3dd31ef637 --- /dev/null +++ b/api/odigos/v1alpha1/source_types.go @@ -0,0 +1,67 @@ +/* +Copyright 2024. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/odigos-io/odigos/k8sutils/pkg/workload" +) + +// Source configures an application for auto-instrumentation. +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Workload",type=string,JSONPath=`.spec.workload.name` +// +kubebuilder:printcolumn:name="Kind",type=string,JSONPath=`.spec.workload.kind` +// +kubebuilder:printcolumn:name="Namespace",type=string,JSONPath=`.spec.workload.namespace` +type Source struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec SourceSpec `json:"spec"` + Status SourceStatus `json:"status,omitempty"` +} + +type SourceSpec struct { + // Workload represents the workload or namespace to be instrumented. + // This field is required upon creation and cannot be modified. + // +kubebuilder:validation:Required + Workload workload.PodWorkload `json:"workload"` +} + +type SourceStatus struct { + // Represents the observations of a source's current state. + // Known .status.conditions.type are: "Available", "Progressing" + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` +} + +//+kubebuilder:object:root=true + +type SourceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Source `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Source{}, &SourceList{}) +} diff --git a/api/odigos/v1alpha1/zz_generated.deepcopy.go b/api/odigos/v1alpha1/zz_generated.deepcopy.go index bc2dbb747d..96b4a7d747 100644 --- a/api/odigos/v1alpha1/zz_generated.deepcopy.go +++ b/api/odigos/v1alpha1/zz_generated.deepcopy.go @@ -1271,6 +1271,103 @@ func (in *SdkConfig) DeepCopy() *SdkConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Source) DeepCopyInto(out *Source) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Source. +func (in *Source) DeepCopy() *Source { + if in == nil { + return nil + } + out := new(Source) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Source) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SourceList) DeepCopyInto(out *SourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Source, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceList. +func (in *SourceList) DeepCopy() *SourceList { + if in == nil { + return nil + } + out := new(SourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SourceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SourceSpec) DeepCopyInto(out *SourceSpec) { + *out = *in + out.Workload = in.Workload +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceSpec. +func (in *SourceSpec) DeepCopy() *SourceSpec { + if in == nil { + return nil + } + out := new(SourceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SourceStatus) DeepCopyInto(out *SourceStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceStatus. +func (in *SourceStatus) DeepCopy() *SourceStatus { + if in == nil { + return nil + } + out := new(SourceStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkloadInstrumentationConfig) DeepCopyInto(out *WorkloadInstrumentationConfig) { *out = *in diff --git a/helm/odigos/templates/crds/odigos.io_sources.yaml b/helm/odigos/templates/crds/odigos.io_sources.yaml new file mode 100644 index 0000000000..c59f98ae29 --- /dev/null +++ b/helm/odigos/templates/crds/odigos.io_sources.yaml @@ -0,0 +1,144 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.1 + name: sources.odigos.io +spec: + group: odigos.io + names: + kind: Source + listKind: SourceList + plural: sources + singular: source + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.workload.name + name: Workload + type: string + - jsonPath: .spec.workload.kind + name: Kind + type: string + - jsonPath: .spec.workload.namespace + name: Namespace + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: Source configures an application for auto-instrumentation. + 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: + workload: + description: |- + Workload represents the workload or namespace to be instrumented. + This field is required upon creation and cannot be modified. + properties: + kind: + description: |- + 1. the pascal case representation of the workload kind + it is used in k8s api objects as the `Kind` field. + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + - namespace + type: object + required: + - workload + type: object + status: + properties: + conditions: + description: |- + Represents the observations of a source's 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 + required: + - spec + type: object + served: true + storage: true + subresources: + status: {}