Skip to content

Commit 0c0c2f6

Browse files
author
Anand Sanmukhani
committed
Make Loki Compute resources configurable
1 parent 78fff4b commit 0c0c2f6

File tree

6 files changed

+230
-16
lines changed

6 files changed

+230
-16
lines changed

api/v1alpha1/observatorium_types.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,17 @@ type LokiSpec struct {
378378
Version string `json:"version,omitempty"`
379379
// VolumeClaimTemplate
380380
VolumeClaimTemplate VolumeClaimTemplate `json:"volumeClaimTemplate"`
381+
// Compute Resources required by each component containers.
382+
// +optional
383+
Resources *LokiResourcesSpec `json:"resources,omitempty"`
384+
}
385+
386+
type LokiResourcesSpec struct {
387+
Compactor *v1.ResourceRequirements `json:"compactor,omitempty"`
388+
Distributor *v1.ResourceRequirements `json:"distributor,omitempty"`
389+
Ingester *v1.ResourceRequirements `json:"ingester,omitempty"`
390+
Querier *v1.ResourceRequirements `json:"querier,omitempty"`
391+
QueryFrontend *v1.ResourceRequirements `json:"query_frontend,omitempty"`
381392
}
382393

383394
// ObservatoriumStatus defines the observed state of Observatorium

api/v1alpha1/zz_generated.deepcopy.go

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

example/main.jsonnet

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ local dex = (import 'github.com/observatorium/deployments/components/dex.libsonn
167167
loki: {
168168
image: obs.loki.config.image,
169169
replicas: obs.loki.config.replicas,
170+
resources: obs.loki.config.resources,
170171
version: obs.loki.config.version,
171172
volumeClaimTemplate: obs.loki.config.volumeClaimTemplate,
172173
},

example/manifests/observatorium.yaml

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ spec:
4747
secretName: observatorium-xyz-tls
4848
version: master-2020-11-02-v0.1.1-192-ge324057
4949
apiQuery:
50-
image: quay.io/thanos/thanos:v0.17.1
51-
version: v0.17.1
50+
image: quay.io/thanos/thanos:v0.20.1
51+
version: v0.20.1
5252
compact:
5353
enableDownsampling: false
54-
image: quay.io/thanos/thanos:v0.17.1
54+
image: quay.io/thanos/thanos:v0.20.1
5555
replicas: 1
5656
retentionResolution1h: 1s
5757
retentionResolution5m: 1s
5858
retentionResolutionRaw: 14d
59-
version: v0.17.1
59+
version: v0.20.1
6060
volumeClaimTemplate:
6161
spec:
6262
accessModes:
@@ -68,14 +68,50 @@ spec:
6868
- hashring: default
6969
tenants: []
7070
loki:
71-
image: docker.io/grafana/loki:2.1.0
71+
image: docker.io/grafana/loki:2.2.0
7272
replicas:
7373
compactor: 1
7474
distributor: 1
7575
ingester: 1
7676
querier: 1
7777
query_frontend: 1
78-
version: 2.1.0
78+
resources:
79+
compactor:
80+
limits:
81+
cpu: 2000m
82+
memory: 2000Mi
83+
requests:
84+
cpu: 100m
85+
memory: 100Mi
86+
distributor:
87+
limits:
88+
cpu: 2000m
89+
memory: 2000Mi
90+
requests:
91+
cpu: 100m
92+
memory: 100Mi
93+
ingester:
94+
limits:
95+
cpu: 2000m
96+
memory: 2000Mi
97+
requests:
98+
cpu: 100m
99+
memory: 100Mi
100+
querier:
101+
limits:
102+
cpu: 2000m
103+
memory: 2000Mi
104+
requests:
105+
cpu: 100m
106+
memory: 100Mi
107+
query_frontend:
108+
limits:
109+
cpu: 2000m
110+
memory: 2000Mi
111+
requests:
112+
cpu: 100m
113+
memory: 100Mi
114+
version: 2.2.0
79115
volumeClaimTemplate:
80116
spec:
81117
accessModes:
@@ -95,17 +131,17 @@ spec:
95131
key: thanos.yaml
96132
name: thanos-objectstorage
97133
query:
98-
image: quay.io/thanos/thanos:v0.17.1
134+
image: quay.io/thanos/thanos:v0.20.1
99135
replicas: 1
100-
version: v0.17.1
136+
version: v0.20.1
101137
queryFrontend:
102-
image: quay.io/thanos/thanos:v0.17.1
138+
image: quay.io/thanos/thanos:v0.20.1
103139
replicas: 1
104-
version: v0.17.1
140+
version: v0.20.1
105141
receivers:
106-
image: quay.io/thanos/thanos:v0.17.1
142+
image: quay.io/thanos/thanos:v0.20.1
107143
replicas: 1
108-
version: v0.17.1
144+
version: v0.20.1
109145
volumeClaimTemplate:
110146
spec:
111147
accessModes:
@@ -114,9 +150,9 @@ spec:
114150
requests:
115151
storage: 50Gi
116152
rule:
117-
image: quay.io/thanos/thanos:v0.17.1
153+
image: quay.io/thanos/thanos:v0.20.1
118154
replicas: 1
119-
version: v0.17.1
155+
version: v0.20.1
120156
volumeClaimTemplate:
121157
spec:
122158
accessModes:
@@ -135,9 +171,9 @@ spec:
135171
memoryLimitMb: 1024
136172
replicas: 1
137173
version: 1.6.3-alpine
138-
image: quay.io/thanos/thanos:v0.17.1
174+
image: quay.io/thanos/thanos:v0.20.1
139175
shards: 1
140-
version: v0.17.1
176+
version: v0.20.1
141177
volumeClaimTemplate:
142178
spec:
143179
accessModes:

jsonnet/obs-operator.jsonnet

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ local operatorObs = obs {
6868
image: if std.objectHas(cr.spec.loki, 'image') then cr.spec.loki.image else obs.loki.config.image,
6969
replicas: if std.objectHas(cr.spec.loki, 'replicas') then cr.spec.loki.replicas else obs.loki.config.replicas,
7070
version: if std.objectHas(cr.spec.loki, 'version') then cr.spec.loki.version else obs.loki.config.version,
71+
resources: if std.objectHas(cr.spec.loki, 'resources') then {
72+
compactor: if std.objectHas(cr.spec.loki.resources, 'compactor') then cr.spec.loki.resources.compactor else obs.loki.config.resources.compactor,
73+
distributor: if std.objectHas(cr.spec.loki.resources, 'distributor') then cr.spec.loki.resources.distributor else obs.loki.config.resources.distributor,
74+
ingester: if std.objectHas(cr.spec.loki.resources, 'ingester') then cr.spec.loki.resources.ingester else obs.loki.config.resources.ingester,
75+
querier: if std.objectHas(cr.spec.loki.resources, 'querier') then cr.spec.loki.resources.querier else obs.loki.config.resources.querier,
76+
query_frontend: if std.objectHas(cr.spec.loki.resources, 'query_frontend') then cr.spec.loki.resources.query_frontend else obs.loki.config.resources.query_frontend,
77+
} else {},
7178
objectStorageConfig: if cr.spec.objectStorageConfig.loki != null then cr.spec.objectStorageConfig.loki else obs.loki.config.objectStorageConfig,
7279
}) else {},
7380

manifests/crds/core.observatorium.io_observatoria.yaml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,120 @@ spec:
728728
type: integer
729729
description: Loki replicas per component
730730
type: object
731+
resources:
732+
description: Compute Resources required by each component containers.
733+
properties:
734+
compactor:
735+
description: ResourceRequirements describes the compute resource requirements.
736+
properties:
737+
limits:
738+
additionalProperties:
739+
anyOf:
740+
- type: integer
741+
- type: string
742+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
743+
x-kubernetes-int-or-string: true
744+
description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
745+
type: object
746+
requests:
747+
additionalProperties:
748+
anyOf:
749+
- type: integer
750+
- type: string
751+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
752+
x-kubernetes-int-or-string: true
753+
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/'
754+
type: object
755+
type: object
756+
distributor:
757+
description: ResourceRequirements describes the compute resource requirements.
758+
properties:
759+
limits:
760+
additionalProperties:
761+
anyOf:
762+
- type: integer
763+
- type: string
764+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
765+
x-kubernetes-int-or-string: true
766+
description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
767+
type: object
768+
requests:
769+
additionalProperties:
770+
anyOf:
771+
- type: integer
772+
- type: string
773+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
774+
x-kubernetes-int-or-string: true
775+
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/'
776+
type: object
777+
type: object
778+
ingester:
779+
description: ResourceRequirements describes the compute resource requirements.
780+
properties:
781+
limits:
782+
additionalProperties:
783+
anyOf:
784+
- type: integer
785+
- type: string
786+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
787+
x-kubernetes-int-or-string: true
788+
description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
789+
type: object
790+
requests:
791+
additionalProperties:
792+
anyOf:
793+
- type: integer
794+
- type: string
795+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
796+
x-kubernetes-int-or-string: true
797+
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/'
798+
type: object
799+
type: object
800+
querier:
801+
description: ResourceRequirements describes the compute resource requirements.
802+
properties:
803+
limits:
804+
additionalProperties:
805+
anyOf:
806+
- type: integer
807+
- type: string
808+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
809+
x-kubernetes-int-or-string: true
810+
description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
811+
type: object
812+
requests:
813+
additionalProperties:
814+
anyOf:
815+
- type: integer
816+
- type: string
817+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
818+
x-kubernetes-int-or-string: true
819+
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/'
820+
type: object
821+
type: object
822+
query_frontend:
823+
description: ResourceRequirements describes the compute resource requirements.
824+
properties:
825+
limits:
826+
additionalProperties:
827+
anyOf:
828+
- type: integer
829+
- type: string
830+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
831+
x-kubernetes-int-or-string: true
832+
description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
833+
type: object
834+
requests:
835+
additionalProperties:
836+
anyOf:
837+
- type: integer
838+
- type: string
839+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
840+
x-kubernetes-int-or-string: true
841+
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/'
842+
type: object
843+
type: object
844+
type: object
731845
version:
732846
description: Version of Loki image to be deployed
733847
type: string

0 commit comments

Comments
 (0)