-
Notifications
You must be signed in to change notification settings - Fork 185
/
instrumentationconfig.go
91 lines (89 loc) 路 3.13 KB
/
instrumentationconfig.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
package crds
import (
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func NewInstrumentationConfig() *apiextensionsv1.CustomResourceDefinition {
return &apiextensionsv1.CustomResourceDefinition{
TypeMeta: metav1.TypeMeta{
Kind: "CustomResourceDefinition",
APIVersion: "apiextensions.k8s.io/v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "instrumentationconfigs.odigos.io",
},
Spec: apiextensionsv1.CustomResourceDefinitionSpec{
Group: "odigos.io",
Names: apiextensionsv1.CustomResourceDefinitionNames{
Plural: "instrumentationconfigs",
Singular: "instrumentationconfig",
Kind: "InstrumentationConfig",
ListKind: "InstrumentationConfigList",
},
Scope: apiextensionsv1.NamespaceScoped,
Versions: []apiextensionsv1.CustomResourceDefinitionVersion{
{
Name: "v1alpha1",
Served: true,
Storage: true,
Schema: &apiextensionsv1.CustomResourceValidation{
OpenAPIV3Schema: &apiextensionsv1.JSONSchemaProps{
Type: "object",
Description: "InstrumentationConfig is the Schema for the instrumentationconfig API",
Properties: map[string]apiextensionsv1.JSONSchemaProps{
"apiVersion": {Type: "string"},
"kind": {Type: "string"},
"metadata": {Type: "object"},
"spec": {
Type: "object",
Description: "Config for the OpenTelemetry SDKs that should be applied to a workload. The workload is identified by the owner reference",
Properties: map[string]apiextensionsv1.JSONSchemaProps{
"config": {
Type: "array",
Items: &apiextensionsv1.JSONSchemaPropsOrArray{
Schema: &apiextensionsv1.JSONSchemaProps{
Type: "object",
Properties: map[string]apiextensionsv1.JSONSchemaProps{
"instrumentationLibraries": {
Type: "array",
Items: &apiextensionsv1.JSONSchemaPropsOrArray{
Schema: &apiextensionsv1.JSONSchemaProps{
Type: "object",
Properties: map[string]apiextensionsv1.JSONSchemaProps{
"instrumentationLibraryName": {Type: "string"},
"language": {Type: "string"},
},
},
},
},
"optionKey": {Type: "string"},
"spanKind": {
Type: "string",
Enum: []apiextensionsv1.JSON{
{Raw: []byte(`"client"`)},
{Raw: []byte(`"server"`)},
{Raw: []byte(`"producer"`)},
{Raw: []byte(`"consumer"`)},
{Raw: []byte(`"internal"`)},
},
},
"optionValueBoolean": {Type: "boolean"},
},
},
},
},
},
Required: []string{"config"},
},
"status": {Type: "object"},
},
},
},
Subresources: &apiextensionsv1.CustomResourceSubresources{
Status: &apiextensionsv1.CustomResourceSubresourceStatus{},
},
},
},
},
}
}