-
Notifications
You must be signed in to change notification settings - Fork 185
/
processor.go
115 lines (113 loc) 路 3.25 KB
/
processor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package crds
import (
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func NewProcessor() *apiextensionsv1.CustomResourceDefinition {
xPreserveUnknownFields := true
return &apiextensionsv1.CustomResourceDefinition{
TypeMeta: metav1.TypeMeta{
Kind: "CustomResourceDefinition",
APIVersion: "apiextensions.k8s.io/v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "processors.odigos.io",
},
Spec: apiextensionsv1.CustomResourceDefinitionSpec{
Group: "odigos.io",
Names: apiextensionsv1.CustomResourceDefinitionNames{
Plural: "processors",
Singular: "processor",
Kind: "Processor",
ListKind: "ProcessorList",
},
Scope: apiextensionsv1.NamespaceScoped,
Versions: []apiextensionsv1.CustomResourceDefinitionVersion{
{
Name: "v1alpha1",
Served: true,
Storage: true,
Schema: &apiextensionsv1.CustomResourceValidation{
OpenAPIV3Schema: &apiextensionsv1.JSONSchemaProps{
Description: "Processor is the Schema for an Opentelemetry Collector Processor that is added to Odigos pipeline",
Type: "object",
Properties: map[string]apiextensionsv1.JSONSchemaProps{
"apiVersion": {
Type: "string",
},
"kind": {
Type: "string",
},
"metadata": {
Type: "object",
},
"spec": {
Description: "ProcessorSpec defines the OpenTelemetry Collector processor in odigos telemetry pipeline",
Type: "object",
Required: []string{
"collectorRoles",
"processorConfig",
"signals",
"type",
},
Properties: map[string]apiextensionsv1.JSONSchemaProps{
"collectorRoles": {
Type: "array",
Items: &apiextensionsv1.JSONSchemaPropsOrArray{
Schema: &apiextensionsv1.JSONSchemaProps{
Type: "string",
Enum: []apiextensionsv1.JSON{
{Raw: []byte(`"CLUSTER_GATEWAY"`)},
{Raw: []byte(`"NODE_COLLECTOR"`)},
},
},
},
},
"processorConfig": {
XPreserveUnknownFields: &xPreserveUnknownFields,
Type: "object",
},
"disabled": {
Type: "boolean",
},
"notes": {
Type: "string",
},
"orderHint": {
Type: "integer",
},
"processorName": {
Type: "string",
},
"signals": {
Type: "array",
Items: &apiextensionsv1.JSONSchemaPropsOrArray{
Schema: &apiextensionsv1.JSONSchemaProps{
Type: "string",
Enum: []apiextensionsv1.JSON{
{Raw: []byte(`"LOGS"`)},
{Raw: []byte(`"TRACES"`)},
{Raw: []byte(`"METRICS"`)},
},
},
},
},
"type": {
Type: "string",
},
},
},
"status": {
Type: "object",
},
},
},
},
Subresources: &apiextensionsv1.CustomResourceSubresources{
Status: &apiextensionsv1.CustomResourceSubresourceStatus{},
},
},
},
},
}
}