Skip to content

Commit f9eb849

Browse files
authored
Support configure annotations (observatorium#70)
Signed-off-by: clyang82 <[email protected]>
1 parent 4093e6d commit f9eb849

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

api/v1alpha1/observatorium_types.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ type ReceiversSpec struct {
152152
// How long to retain raw samples on local storage
153153
// +optional
154154
Retention string `json:"retention,omitempty"`
155+
// Annotations is an unstructured key value map stored with a service account
156+
// +optional
157+
ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"`
155158
}
156159

157160
type StoreSpec struct {
@@ -166,6 +169,9 @@ type StoreSpec struct {
166169
// ServiceMonitor enables servicemonitor.
167170
// +optional
168171
ServiceMonitor bool `json:"serviceMonitor,omitempty"`
172+
// Annotations is an unstructured key value map stored with a service account
173+
// +optional
174+
ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"`
169175
}
170176

171177
// MemCacheSpec describes configuration for Store Memcached
@@ -353,6 +359,9 @@ type QuerySpec struct {
353359
// The maximum lookback duration for retrieving metrics during expression evaluations.
354360
// +optional
355361
LookbackDelta string `json:"lookbackDelta,omitempty"`
362+
// Annotations is an unstructured key value map stored with a service account
363+
// +optional
364+
ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"`
356365
}
357366

358367
type RuleConfig struct {
@@ -428,6 +437,9 @@ type RuleSpec struct {
428437
// Evaluation interval
429438
// +optional
430439
EvalInterval string `json:"evalInterval,omitempty"`
440+
// Annotations is an unstructured key value map stored with a service account
441+
// +optional
442+
ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"`
431443
}
432444

433445
type CompactSpec struct {
@@ -452,6 +464,8 @@ type CompactSpec struct {
452464
// Time before a block marked for deletion is deleted from bucket
453465
// +optional
454466
DeleteDelay string `json:"deleteDelay,omitempty"`
467+
// Annotations is an unstructured key value map stored with a service account
468+
ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"`
455469
}
456470

457471
type VolumeClaimTemplate struct {

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonnet/obs-operator.jsonnet

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,26 @@ local operatorObs = obs {
168168
if (v.kind == 'StatefulSet' && std.startsWith(v.metadata.name, cr.metadata.name + '-thanos-query-frontend-memcached')) then {
169169
name: 'observability-thanos-query-frontend-memcached',
170170
} else {}
171+
) + (
172+
if (std.objectHas(cr.spec.thanos.compact, 'serviceAccountAnnotations') && v.kind == 'ServiceAccount' && std.startsWith(v.metadata.name, cr.metadata.name + '-thanos-compact')) then {
173+
annotations+: cr.spec.thanos.compact.serviceAccountAnnotations,
174+
} else {}
175+
) + (
176+
if (std.objectHas(cr.spec.thanos.query, 'serviceAccountAnnotations') && v.kind == 'ServiceAccount' && std.startsWith(v.metadata.name, cr.metadata.name + '-thanos-query')) then {
177+
annotations+: cr.spec.thanos.query.serviceAccountAnnotations,
178+
} else {}
179+
) + (
180+
if (std.objectHas(cr.spec.thanos.store, 'serviceAccountAnnotations') && v.kind == 'ServiceAccount' && std.startsWith(v.metadata.name, cr.metadata.name + '-thanos-store-shard')) then {
181+
annotations+: cr.spec.thanos.store.serviceAccountAnnotations,
182+
} else {}
183+
) + (
184+
if (std.objectHas(cr.spec.thanos.receivers, 'serviceAccountAnnotations') && v.kind == 'ServiceAccount' && std.startsWith(v.metadata.name, cr.metadata.name + '-thanos-receive')) then {
185+
annotations+: cr.spec.thanos.store.serviceAccountAnnotations,
186+
} else {}
187+
) + (
188+
if (std.objectHas(cr.spec.thanos.rule, 'serviceAccountAnnotations') && v.kind == 'ServiceAccount' && std.startsWith(v.metadata.name, cr.metadata.name + '-thanos-rule')) then {
189+
annotations+: cr.spec.thanos.store.serviceAccountAnnotations,
190+
} else {}
171191
),
172192
spec+: (
173193
if (std.objectHas(cr.spec, 'nodeSelector') && (v.kind == 'StatefulSet' || v.kind == 'Deployment')) then {

manifests/crds/core.observatorium.io_observatoria.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,11 @@ spec:
901901
retentionResolutionRaw:
902902
description: RetentionResolutionRaw
903903
type: string
904+
serviceAccountAnnotations:
905+
additionalProperties:
906+
type: string
907+
description: Annotations is an unstructured key value map stored with a service account
908+
type: object
904909
serviceMonitor:
905910
description: ServiceMonitor enables servicemonitor.
906911
type: boolean
@@ -1040,6 +1045,11 @@ spec:
10401045
description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
10411046
type: object
10421047
type: object
1048+
serviceAccountAnnotations:
1049+
additionalProperties:
1050+
type: string
1051+
description: Annotations is an unstructured key value map stored with a service account
1052+
type: object
10431053
serviceMonitor:
10441054
description: ServiceMonitor enables servicemonitor.
10451055
type: boolean
@@ -1235,6 +1245,11 @@ spec:
12351245
retention:
12361246
description: How long to retain raw samples on local storage
12371247
type: string
1248+
serviceAccountAnnotations:
1249+
additionalProperties:
1250+
type: string
1251+
description: Annotations is an unstructured key value map stored with a service account
1252+
type: object
12381253
serviceMonitor:
12391254
description: ServiceMonitor enables servicemonitor.
12401255
type: boolean
@@ -1455,6 +1470,11 @@ spec:
14551470
- name
14561471
type: object
14571472
type: array
1473+
serviceAccountAnnotations:
1474+
additionalProperties:
1475+
type: string
1476+
description: Annotations is an unstructured key value map stored with a service account
1477+
type: object
14581478
serviceMonitor:
14591479
description: ServiceMonitor enables servicemonitor.
14601480
type: boolean
@@ -1662,6 +1682,11 @@ spec:
16621682
description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
16631683
type: object
16641684
type: object
1685+
serviceAccountAnnotations:
1686+
additionalProperties:
1687+
type: string
1688+
description: Annotations is an unstructured key value map stored with a service account
1689+
type: object
16651690
serviceMonitor:
16661691
description: ServiceMonitor enables servicemonitor.
16671692
type: boolean

0 commit comments

Comments
 (0)