Skip to content

Commit

Permalink
Expose a single timeout setting in CRDs
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <[email protected]>
  • Loading branch information
pavolloffay committed Oct 7, 2024
1 parent e2ae4c0 commit e3f388f
Show file tree
Hide file tree
Showing 51 changed files with 417 additions and 78 deletions.
18 changes: 18 additions & 0 deletions .chloggen/timeout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. tempostack, tempomonolithic, github action)
component: tempostack, tempomonolithic

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add unified timeout configuration. It changes the default to 30s.

# One or more tracking issues related to the change
issues: [1045]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
Adding `spec.timeout` CRD option to configure timeout on all components and default it to 30s.
Before Tempo server was defaulting to 3m, gateway to 2m, OpenShift route to 30s (for query), oauth-proxy to 30s (for query).
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TEMPO_QUERY_VERSION ?= main-2999520
JAEGER_QUERY_VERSION ?= d6631f5f2370cfc3a49efce312491031fb387600
TEMPO_GATEWAY_VERSION ?= main-2024-08-05-11d0d94
TEMPO_GATEWAY_OPA_VERSION ?= main-2024-04-29-914c13f
OAUTH_PROXY_VERSION=4.12
OAUTH_PROXY_VERSION=4.14

MIN_KUBERNETES_VERSION ?= 1.25.0
MIN_OPENSHIFT_VERSION ?= 4.12
Expand Down
5 changes: 5 additions & 0 deletions apis/tempo/v1alpha1/tempomonolithic_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var (
twoGBQuantity = resource.MustParse("2Gi")
tenGBQuantity = resource.MustParse("10Gi")
defaultServicesDuration = metav1.Duration{Duration: time.Hour * 24 * 3}
defaultTimeout = metav1.Duration{Duration: time.Second * 30}
)

// Default sets all default values in a central place, instead of setting it at every place where the value is accessed.
Expand Down Expand Up @@ -88,4 +89,8 @@ func (r *TempoMonolithic) Default(ctrlConfig configv1alpha1.ProjectConfig) {
r.Spec.JaegerUI.ServicesQueryDuration = &defaultServicesDuration
}
}

if r.Spec.Timeout.Duration == 0 {
r.Spec.Timeout = defaultTimeout
}
}
13 changes: 12 additions & 1 deletion apis/tempo/v1alpha1/tempomonolithic_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

configv1alpha1 "github.com/grafana/tempo-operator/apis/config/v1alpha1"
Expand Down Expand Up @@ -46,6 +47,7 @@ func TestMonolithicDefault(t *testing.T) {
},
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
},
},
},
Expand Down Expand Up @@ -79,6 +81,7 @@ func TestMonolithicDefault(t *testing.T) {
},
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
},
},
},
Expand All @@ -104,6 +107,7 @@ func TestMonolithicDefault(t *testing.T) {
},
},
Management: "Unmanaged",
Timeout: metav1.Duration{Duration: time.Second * 30},
},
},
expected: &TempoMonolithic{
Expand All @@ -125,6 +129,7 @@ func TestMonolithicDefault(t *testing.T) {
},
},
Management: "Unmanaged",
Timeout: metav1.Duration{Duration: time.Second * 30},
},
},
},
Expand Down Expand Up @@ -194,6 +199,7 @@ func TestMonolithicDefault(t *testing.T) {
ServicesQueryDuration: &defaultServicesDuration,
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
},
},
},
Expand Down Expand Up @@ -266,6 +272,7 @@ func TestMonolithicDefault(t *testing.T) {
ServicesQueryDuration: &defaultServicesDuration,
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
},
},
},
Expand Down Expand Up @@ -330,6 +337,7 @@ func TestMonolithicDefault(t *testing.T) {
ServicesQueryDuration: &defaultServicesDuration,
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
},
},
},
Expand Down Expand Up @@ -393,11 +401,12 @@ func TestMonolithicDefault(t *testing.T) {
ServicesQueryDuration: &defaultServicesDuration,
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
},
},
},
{
name: "define custom duration for services list",
name: "define custom duration for services list and timeout",
input: &TempoMonolithic{
ObjectMeta: v1.ObjectMeta{
Name: "test",
Expand All @@ -417,6 +426,7 @@ func TestMonolithicDefault(t *testing.T) {
},
ServicesQueryDuration: &v1.Duration{Duration: time.Duration(100 * 100)},
},
Timeout: metav1.Duration{Duration: time.Hour},
},
},
expected: &TempoMonolithic{
Expand Down Expand Up @@ -454,6 +464,7 @@ func TestMonolithicDefault(t *testing.T) {
ServicesQueryDuration: &v1.Duration{Duration: time.Duration(100 * 100)},
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Hour},
},
},
},
Expand Down
5 changes: 5 additions & 0 deletions apis/tempo/v1alpha1/tempomonolithic_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ type TempoMonolithicSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resources",order=5,xDescriptors="urn:alm:descriptor:com.tectonic.ui:resourceRequirements"
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`

// Timeout configures the same timeout on all components starting at ingress down to the ingestor/querier.
// Timeout configuration on a specific component has a higher precedence.
// Default is 30 seconds.
Timeout metav1.Duration `json:"timeout,omitempty"`

// ServiceAccount defines the Service Account to use for all Tempo components.
//
// +kubebuilder:validation:Optional
Expand Down
5 changes: 5 additions & 0 deletions apis/tempo/v1alpha1/tempostack_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ type TempoStackSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Ingestion and Querying Ratelimiting"
LimitSpec LimitSpec `json:"limits,omitempty"`

// Timeout configures the same timeout on all components starting at ingress down to the ingestor/querier.
// Timeout configuration on a specific component has a higher precedence.
// Defaults to 30 seconds.
Timeout metav1.Duration `json:"timeout,omitempty"`

// StorageClassName for PVCs used by ingester. Defaults to nil (default storage class in the cluster).
//
// +optional
Expand Down
2 changes: 2 additions & 0 deletions apis/tempo/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ metadata:
capabilities: Deep Insights
categories: Logging & Tracing,Monitoring
containerImage: ghcr.io/grafana/tempo-operator/tempo-operator:v0.13.0
createdAt: "2024-10-04T12:51:28Z"
createdAt: "2024-10-07T07:11:28Z"
description: Create and manage deployments of Tempo, a high-scale distributed
tracing backend.
operatorframework.io/cluster-monitoring: "true"
Expand Down Expand Up @@ -1433,7 +1433,7 @@ spec:
- name: RELATED_IMAGE_TEMPO_GATEWAY_OPA
value: quay.io/observatorium/opa-openshift:main-2024-04-29-914c13f
- name: RELATED_IMAGE_OAUTH_PROXY
value: quay.io/openshift/origin-oauth-proxy:4.12
value: quay.io/openshift/origin-oauth-proxy:4.14
image: ghcr.io/grafana/tempo-operator/tempo-operator:v0.13.0
livenessProbe:
httpGet:
Expand Down Expand Up @@ -1582,7 +1582,7 @@ spec:
name: tempo-gateway
- image: quay.io/observatorium/opa-openshift:main-2024-04-29-914c13f
name: tempo-gateway-opa
- image: quay.io/openshift/origin-oauth-proxy:4.12
- image: quay.io/openshift/origin-oauth-proxy:4.14
name: oauth-proxy
version: 0.13.0
webhookdefinitions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,12 @@ spec:
required:
- traces
type: object
timeout:
description: |-
Timeout configures the same timeout on all components starting at ingress down to the ingestor/querier.
Timeout configuration on a specific component has a higher precedence.
Default is 30 seconds.
type: string
tolerations:
description: Tolerations defines the tolerations of a node to schedule
the pod onto it.
Expand Down
6 changes: 6 additions & 0 deletions bundle/community/manifests/tempo.grafana.com_tempostacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,12 @@ spec:
required:
- mode
type: object
timeout:
description: |-
Timeout configures the same timeout on all components starting at ingress down to the ingestor/querier.
Timeout configuration on a specific component has a higher precedence.
Defaults to 30 seconds.
type: string
required:
- storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ metadata:
capabilities: Deep Insights
categories: Logging & Tracing,Monitoring
containerImage: ghcr.io/grafana/tempo-operator/tempo-operator:v0.13.0
createdAt: "2024-10-04T12:51:27Z"
createdAt: "2024-10-07T07:11:27Z"
description: Create and manage deployments of Tempo, a high-scale distributed
tracing backend.
operatorframework.io/cluster-monitoring: "true"
Expand Down Expand Up @@ -1443,7 +1443,7 @@ spec:
- name: RELATED_IMAGE_TEMPO_GATEWAY_OPA
value: quay.io/observatorium/opa-openshift:main-2024-04-29-914c13f
- name: RELATED_IMAGE_OAUTH_PROXY
value: quay.io/openshift/origin-oauth-proxy:4.12
value: quay.io/openshift/origin-oauth-proxy:4.14
image: ghcr.io/grafana/tempo-operator/tempo-operator:v0.13.0
livenessProbe:
httpGet:
Expand Down Expand Up @@ -1603,7 +1603,7 @@ spec:
name: tempo-gateway
- image: quay.io/observatorium/opa-openshift:main-2024-04-29-914c13f
name: tempo-gateway-opa
- image: quay.io/openshift/origin-oauth-proxy:4.12
- image: quay.io/openshift/origin-oauth-proxy:4.14
name: oauth-proxy
version: 0.13.0
webhookdefinitions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,12 @@ spec:
required:
- traces
type: object
timeout:
description: |-
Timeout configures the same timeout on all components starting at ingress down to the ingestor/querier.
Timeout configuration on a specific component has a higher precedence.
Default is 30 seconds.
type: string
tolerations:
description: Tolerations defines the tolerations of a node to schedule
the pod onto it.
Expand Down
6 changes: 6 additions & 0 deletions bundle/openshift/manifests/tempo.grafana.com_tempostacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,12 @@ spec:
required:
- mode
type: object
timeout:
description: |-
Timeout configures the same timeout on all components starting at ingress down to the ingestor/querier.
Timeout configuration on a specific component has a higher precedence.
Defaults to 30 seconds.
type: string
required:
- storage
type: object
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/tempo.grafana.com_tempomonolithics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,12 @@ spec:
required:
- traces
type: object
timeout:
description: |-
Timeout configures the same timeout on all components starting at ingress down to the ingestor/querier.
Timeout configuration on a specific component has a higher precedence.
Default is 30 seconds.
type: string
tolerations:
description: Tolerations defines the tolerations of a node to schedule
the pod onto it.
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/tempo.grafana.com_tempostacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2711,6 +2711,12 @@ spec:
required:
- mode
type: object
timeout:
description: |-
Timeout configures the same timeout on all components starting at ingress down to the ingestor/querier.
Timeout configuration on a specific component has a higher precedence.
Defaults to 30 seconds.
type: string
required:
- storage
type: object
Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
- name: RELATED_IMAGE_TEMPO_GATEWAY_OPA
value: quay.io/observatorium/opa-openshift:main-2024-04-29-914c13f
- name: RELATED_IMAGE_OAUTH_PROXY
value: quay.io/openshift/origin-oauth-proxy:4.12
value: quay.io/openshift/origin-oauth-proxy:4.14
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down
1 change: 1 addition & 0 deletions docs/spec/tempo.grafana.com_tempomonolithics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ spec: # TempoMonolithicSpec defines the desir
certName: "" # Cert is the name of a Secret containing a certificate (tls.crt) and private key (tls.key). It needs to be in the same namespace as the Tempo custom resource.
minVersion: "" # MinVersion defines the minimum acceptable TLS version.
size: 0Gi # Size defines the size of the volume where traces are stored. For in-memory storage, this defines the size of the tmpfs volume. For persistent volume storage, this defines the size of the persistent volume. For object storage, this defines the size of the persistent volume containing the Write-Ahead Log (WAL) of Tempo. Default: 2Gi for memory, 10Gi for all other backends.
timeout: "" # Timeout configures the same timeout on all components starting at ingress down to the ingestor/querier. Timeout configuration on a specific component has a higher precedence. Default is 30 seconds.
affinity: # Affinity defines the Affinity rules for scheduling pods.
nodeAffinity: {} # Describes node affinity scheduling rules for the pod.
podAffinity: {} # Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).
Expand Down
1 change: 1 addition & 0 deletions docs/spec/tempo.grafana.com_tempostacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ spec: # TempoStackSpec defines the desired st
resources:
- ""
mode: "static" # Mode defines the multitenancy mode.
timeout: "" # Timeout configures the same timeout on all components starting at ingress down to the ingestor/querier. Timeout configuration on a specific component has a higher precedence. Defaults to 30 seconds.
resources: # Resources defines resources configuration.
total: # The total amount of resources for Tempo instance. The operator autonomously splits resources between deployed Tempo components. Only limits are supported, the operator calculates requests automatically. See http://github.com/grafana/tempo/issues/1540.
claims: # Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. This field is immutable. It can only be set for containers.
Expand Down
1 change: 1 addition & 0 deletions internal/manifests/config/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func buildConfiguration(params manifestutils.Params) ([]byte, error) {
TLS: tlsopts,
ReceiverTLS: buildReceiverTLSConfig(tempo),
S3StorageTLS: buildS3StorageTLSConfig(params),
Timeout: params.Tempo.Spec.Timeout.Duration,
}

if isTenantOverridesConfigRequired(tempo.Spec.LimitSpec) {
Expand Down
Loading

0 comments on commit e3f388f

Please sign in to comment.