master
json 170 lines 6.2 KB
Raw
1 {
2 "jsonSchema": {
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "title": "Kubernetes Service Discovery",
5 "description": "Discovers services running in Kubernetes cluster.",
6 "type": "object",
7 "properties": {
8 "discoverer": {
9 "title": "Discoverer",
10 "type": "object",
11 "properties": {
12 "k8s": {
13 "title": "Kubernetes",
14 "type": "array",
15 "minItems": 1,
16 "items": {
17 "type": "object",
18 "properties": {
19 "role": {
20 "title": "Role",
21 "description": "Kubernetes resource role to discover.",
22 "type": "string",
23 "enum": [
24 "pod",
25 "service"
26 ],
27 "default": "pod"
28 },
29 "namespaces": {
30 "title": "Namespaces",
31 "description": "Namespaces to watch (empty = all namespaces).",
32 "type": "array",
33 "items": {
34 "type": "string"
35 }
36 },
37 "selector": {
38 "title": "Selector",
39 "description": "Label and field selectors for filtering resources.",
40 "type": "object",
41 "properties": {
42 "label": {
43 "title": "Label selector",
44 "description": "Label selector (e.g., 'app=nginx').",
45 "type": "string"
46 },
47 "field": {
48 "title": "Field selector",
49 "description": "Field selector (e.g., 'metadata.name=my-pod').",
50 "type": "string"
51 }
52 }
53 },
54 "pod": {
55 "title": "Pod options",
56 "description": "Pod-specific options.",
57 "type": "object",
58 "properties": {
59 "local_mode": {
60 "title": "Local mode",
61 "description": "Only discover pods on the same node as the agent.",
62 "type": "boolean",
63 "default": false
64 }
65 }
66 }
67 },
68 "required": [
69 "role"
70 ]
71 }
72 }
73 },
74 "required": [
75 "k8s"
76 ]
77 },
78 "services": {
79 "title": "Service rules",
80 "description": "- Match discovered Kubernetes resources and generate collector configurations.\n- Each rule specifies match criteria and a config template.\n- When a pod or service matches, a data collection job is created.",
81 "type": "array",
82 "minItems": 1,
83 "items": {
84 "type": "object",
85 "properties": {
86 "id": {
87 "title": "Rule ID",
88 "description": "Unique identifier for this rule. Used in logs to identify which rule matched a resource.",
89 "type": "string"
90 },
91 "match": {
92 "title": "Match expression",
93 "description": "Go template expression that must evaluate to 'true' for the rule to match the discovered pod or service.",
94 "type": "string"
95 },
96 "config_template": {
97 "title": "Config template",
98 "description": "**Uses the same fields as match expression**. Go template that generates the data collection job configuration in YAML format. **Must include 'module' and 'name' fields**, plus any module-specific settings.",
99 "type": "string"
100 }
101 },
102 "required": [
103 "id",
104 "match"
105 ]
106 }
107 }
108 },
109 "required": [
110 "discoverer",
111 "services"
112 ]
113 },
114 "uiSchema": {
115 "uiOptions": {
116 "fullPage": true
117 },
118 "ui:flavour": "tabs",
119 "ui:options": {
120 "tabs": [
121 {
122 "title": "Base",
123 "fields": [
124 "discoverer"
125 ]
126 },
127 {
128 "title": "Services",
129 "fields": [
130 "services"
131 ]
132 }
133 ]
134 },
135 "discoverer": {
136 "k8s": {
137 "ui:listFlavour": "list",
138 "items": {
139 "selector": {
140 "label": {
141 "ui:placeholder": "app=nginx"
142 },
143 "field": {
144 "ui:placeholder": "metadata.name=my-pod"
145 }
146 }
147 }
148 }
149 },
150 "services": {
151 "ui:descriptionPosition": "top",
152 "ui:listFlavour": "list",
153 "items": {
154 "id": {
155 "ui:placeholder": "nginx-pods",
156 "ui:help": "Use descriptive names like 'nginx-pods', 'mysql-service', 'prometheus-metrics'"
157 },
158 "match": {
159 "ui:widget": "textarea",
160 "ui:placeholder": "{{ eq .Namespace \"default\" }}",
161 "ui:help": "**Pod role fields:**\n| Field | Description |\n|-------|-------------|\n| `.Address` | Pod IP:Port |\n| `.Namespace` | Pod namespace |\n| `.Name` | Pod name |\n| `.Annotations` | Annotations (map) |\n| `.Labels` | Labels (map) |\n| `.NodeName` | Node name |\n| `.PodIP` | Pod IP |\n| `.ControllerName` | Controller name |\n| `.ControllerKind` | Controller kind |\n| `.ContName` | Container name |\n| `.Image` | Container image |\n| `.Env` | Env vars (map) |\n| `.Port` | Container port |\n| `.PortName` | Port name |\n| `.PortProtocol` | Port protocol |\n\n**Service role fields:**\n| Field | Description |\n|-------|-------------|\n| `.Address` | ClusterIP:Port |\n| `.Namespace` | Service namespace |\n| `.Name` | Service name |\n| `.Annotations` | Annotations (map) |\n| `.Labels` | Labels (map) |\n| `.Port` | Service port |\n| `.PortName` | Port name |\n| `.PortProtocol` | Port protocol |\n| `.ClusterIP` | Cluster IP |\n| `.ExternalName` | External name |\n\n**Functions:** eq, ne, glob, regexp, and, or, not\n\n**Map access:** {{ index .Labels \"key\" }}"
162 },
163 "config_template": {
164 "ui:widget": "textarea",
165 "ui:placeholder": "module: nginx\nname: {{.Namespace}}-{{.Name}}\nurl: http://{{.Address}}/stub_status"
166 }
167 }
168 }
169 }
170 }