diff --git a/api/v1alpha1/observatorium_types.go b/api/v1alpha1/observatorium_types.go index e4847b69..af52b194 100644 --- a/api/v1alpha1/observatorium_types.go +++ b/api/v1alpha1/observatorium_types.go @@ -378,6 +378,9 @@ type LokiSpec struct { Version string `json:"version,omitempty"` // VolumeClaimTemplate VolumeClaimTemplate VolumeClaimTemplate `json:"volumeClaimTemplate"` + // Compute Resources required by each component containers. + // +optional + Resources map[string]v1.ResourceRequirements `json:"resources,omitempty"` } // ObservatoriumStatus defines the observed state of Observatorium diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 1c6c71d9..acdff037 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -177,6 +177,13 @@ func (in *LokiSpec) DeepCopyInto(out *LokiSpec) { } } in.VolumeClaimTemplate.DeepCopyInto(&out.VolumeClaimTemplate) + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make(map[string]v1.ResourceRequirements, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LokiSpec. diff --git a/jsonnet/obs-operator.jsonnet b/jsonnet/obs-operator.jsonnet index b9ae7150..f7fac751 100644 --- a/jsonnet/obs-operator.jsonnet +++ b/jsonnet/obs-operator.jsonnet @@ -68,6 +68,7 @@ local operatorObs = obs { image: if std.objectHas(cr.spec.loki, 'image') then cr.spec.loki.image else obs.loki.config.image, replicas: if std.objectHas(cr.spec.loki, 'replicas') then cr.spec.loki.replicas else obs.loki.config.replicas, version: if std.objectHas(cr.spec.loki, 'version') then cr.spec.loki.version else obs.loki.config.version, + resources: if std.objectHas(cr.spec.loki, 'resources') then cr.spec.loki.resources else obs.loki.config.resources, objectStorageConfig: if cr.spec.objectStorageConfig.loki != null then cr.spec.objectStorageConfig.loki else obs.loki.config.objectStorageConfig, }) else {}, diff --git a/manifests/crds/core.observatorium.io_observatoria.yaml b/manifests/crds/core.observatorium.io_observatoria.yaml index c1736d82..3ebd9186 100644 --- a/manifests/crds/core.observatorium.io_observatoria.yaml +++ b/manifests/crds/core.observatorium.io_observatoria.yaml @@ -728,6 +728,31 @@ spec: type: integer description: Loki replicas per component type: object + resources: + additionalProperties: + description: ResourceRequirements describes the compute resource requirements. + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + 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/' + type: object + type: object + description: Compute Resources required by each component containers. + type: object version: description: Version of Loki image to be deployed type: string