Skip to content

Commit 21d00c2

Browse files
authored
feat: add ServiceMonitor and PodLog crds (#183)
Signed-off-by: Ivo Yankov <ivo@devlabs.bg>
1 parent 0820ae6 commit 21d00c2

File tree

6 files changed

+867
-22
lines changed

6 files changed

+867
-22
lines changed
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
{{- if $.Values.crds.podLog.enabled }}
2+
{{- $podLogsCRD := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" "podlogs.monitoring.grafana.com" }}
3+
{{- if not $podLogsCRD }}
4+
apiVersion: apiextensions.k8s.io/v1
5+
kind: CustomResourceDefinition
6+
metadata:
7+
annotations:
8+
controller-gen.kubebuilder.io/version: v0.9.2
9+
creationTimestamp: null
10+
name: podlogs.monitoring.grafana.com
11+
spec:
12+
group: monitoring.grafana.com
13+
names:
14+
categories:
15+
- grafana-alloy
16+
- alloy
17+
kind: PodLogs
18+
listKind: PodLogsList
19+
plural: podlogs
20+
singular: podlogs
21+
scope: Namespaced
22+
versions:
23+
- name: v1alpha2
24+
schema:
25+
openAPIV3Schema:
26+
description: PodLogs defines how to collect logs for a Pod.
27+
properties:
28+
apiVersion:
29+
description: 'APIVersion defines the versioned schema of this representation
30+
of an object. Servers should convert recognized schemas to the latest
31+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
32+
type: string
33+
kind:
34+
description: 'Kind is a string value representing the REST resource this
35+
object represents. Servers may infer this from the endpoint the client
36+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
37+
type: string
38+
metadata:
39+
type: object
40+
spec:
41+
description: PodLogsSpec defines how to collect logs for a Pod.
42+
properties:
43+
namespaceSelector:
44+
description: Selector to select which namespaces the Pod objects are
45+
discovered from.
46+
properties:
47+
matchExpressions:
48+
description: matchExpressions is a list of label selector requirements.
49+
The requirements are ANDed.
50+
items:
51+
description: A label selector requirement is a selector that
52+
contains values, a key, and an operator that relates the key
53+
and values.
54+
properties:
55+
key:
56+
description: key is the label key that the selector applies
57+
to.
58+
type: string
59+
operator:
60+
description: operator represents a key's relationship to
61+
a set of values. Valid operators are In, NotIn, Exists
62+
and DoesNotExist.
63+
type: string
64+
values:
65+
description: values is an array of string values. If the
66+
operator is In or NotIn, the values array must be non-empty.
67+
If the operator is Exists or DoesNotExist, the values
68+
array must be empty. This array is replaced during a strategic
69+
merge patch.
70+
items:
71+
type: string
72+
type: array
73+
required:
74+
- key
75+
- operator
76+
type: object
77+
type: array
78+
matchLabels:
79+
additionalProperties:
80+
type: string
81+
description: matchLabels is a map of {key,value} pairs. A single
82+
{key,value} in the matchLabels map is equivalent to an element
83+
of matchExpressions, whose key field is "key", the operator
84+
is "In", and the values array contains only "value". The requirements
85+
are ANDed.
86+
type: object
87+
type: object
88+
x-kubernetes-map-type: atomic
89+
relabelings:
90+
description: RelabelConfigs to apply to logs before delivering.
91+
items:
92+
description: 'RelabelConfig allows dynamic rewriting of the label
93+
set, being applied to samples before ingestion. It defines `<metric_relabel_configs>`-section
94+
of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
95+
properties:
96+
action:
97+
default: replace
98+
description: Action to perform based on regex matching. Default
99+
is 'replace'. uppercase and lowercase actions require Prometheus
100+
>= 2.36.
101+
enum:
102+
- replace
103+
- Replace
104+
- keep
105+
- Keep
106+
- drop
107+
- Drop
108+
- hashmod
109+
- HashMod
110+
- labelmap
111+
- LabelMap
112+
- labeldrop
113+
- LabelDrop
114+
- labelkeep
115+
- LabelKeep
116+
- lowercase
117+
- Lowercase
118+
- uppercase
119+
- Uppercase
120+
type: string
121+
modulus:
122+
description: Modulus to take of the hash of the source label
123+
values.
124+
format: int64
125+
type: integer
126+
regex:
127+
description: Regular expression against which the extracted
128+
value is matched. Default is '(.*)'
129+
type: string
130+
replacement:
131+
description: Replacement value against which a regex replace
132+
is performed if the regular expression matches. Regex capture
133+
groups are available. Default is '$1'
134+
type: string
135+
separator:
136+
description: Separator placed between concatenated source label
137+
values. default is ';'.
138+
type: string
139+
sourceLabels:
140+
description: The source labels select values from existing labels.
141+
Their content is concatenated using the configured separator
142+
and matched against the configured regular expression for
143+
the replace, keep, and drop actions.
144+
items:
145+
description: LabelName is a valid Prometheus label name which
146+
may only contain ASCII letters, numbers, as well as underscores.
147+
pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
148+
type: string
149+
type: array
150+
targetLabel:
151+
description: Label to which the resulting value is written in
152+
a replace action. It is mandatory for replace actions. Regex
153+
capture groups are available.
154+
type: string
155+
type: object
156+
type: array
157+
selector:
158+
description: Selector to select Pod objects. Required.
159+
properties:
160+
matchExpressions:
161+
description: matchExpressions is a list of label selector requirements.
162+
The requirements are ANDed.
163+
items:
164+
description: A label selector requirement is a selector that
165+
contains values, a key, and an operator that relates the key
166+
and values.
167+
properties:
168+
key:
169+
description: key is the label key that the selector applies
170+
to.
171+
type: string
172+
operator:
173+
description: operator represents a key's relationship to
174+
a set of values. Valid operators are In, NotIn, Exists
175+
and DoesNotExist.
176+
type: string
177+
values:
178+
description: values is an array of string values. If the
179+
operator is In or NotIn, the values array must be non-empty.
180+
If the operator is Exists or DoesNotExist, the values
181+
array must be empty. This array is replaced during a strategic
182+
merge patch.
183+
items:
184+
type: string
185+
type: array
186+
required:
187+
- key
188+
- operator
189+
type: object
190+
type: array
191+
matchLabels:
192+
additionalProperties:
193+
type: string
194+
description: matchLabels is a map of {key,value} pairs. A single
195+
{key,value} in the matchLabels map is equivalent to an element
196+
of matchExpressions, whose key field is "key", the operator
197+
is "In", and the values array contains only "value". The requirements
198+
are ANDed.
199+
type: object
200+
type: object
201+
x-kubernetes-map-type: atomic
202+
required:
203+
- selector
204+
type: object
205+
type: object
206+
served: true
207+
storage: true
208+
{{- end }}
209+
{{- end }}

0 commit comments

Comments
 (0)