Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for query RBAC to tempomonolithic #1131

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .chloggen/rbac-monolithic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add support for query RBAC

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

# (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: |
This feature allows users to apply query RBAC in the multitenancy mode.
The RBAC allows filtering span/resource/scope attributes and events based on the namespaces which a user querying the data can access.
For instance, a user can only see attributes from namespaces it can access.

```yaml
spec:
query:
rbac:
enabled: true
```
3 changes: 3 additions & 0 deletions api/tempo/v1alpha1/tempomonolithic_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,7 @@ func (r *TempoMonolithic) Default(ctrlConfig configv1alpha1.ProjectConfig) {
if r.Spec.Timeout.Duration == 0 {
r.Spec.Timeout = defaultTimeout
}
if r.Spec.Query == nil {
r.Spec.Query = &MonolithicQuerySpec{}
}
}
62 changes: 62 additions & 0 deletions api/tempo/v1alpha1/tempomonolithic_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func TestMonolithicDefault(t *testing.T) {
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
Query: &MonolithicQuerySpec{},
},
},
},
Expand Down Expand Up @@ -83,6 +84,7 @@ func TestMonolithicDefault(t *testing.T) {
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
Query: &MonolithicQuerySpec{},
},
},
},
Expand All @@ -109,6 +111,7 @@ func TestMonolithicDefault(t *testing.T) {
},
Management: "Unmanaged",
Timeout: metav1.Duration{Duration: time.Second * 30},
Query: &MonolithicQuerySpec{},
},
},
expected: &TempoMonolithic{
Expand All @@ -131,6 +134,7 @@ func TestMonolithicDefault(t *testing.T) {
},
Management: "Unmanaged",
Timeout: metav1.Duration{Duration: time.Second * 30},
Query: &MonolithicQuerySpec{},
},
},
},
Expand Down Expand Up @@ -203,6 +207,7 @@ func TestMonolithicDefault(t *testing.T) {
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
Query: &MonolithicQuerySpec{},
},
},
},
Expand Down Expand Up @@ -278,6 +283,7 @@ func TestMonolithicDefault(t *testing.T) {
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
Query: &MonolithicQuerySpec{},
},
},
},
Expand Down Expand Up @@ -345,6 +351,7 @@ func TestMonolithicDefault(t *testing.T) {
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
Query: &MonolithicQuerySpec{},
},
},
},
Expand Down Expand Up @@ -412,6 +419,7 @@ func TestMonolithicDefault(t *testing.T) {
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
Query: &MonolithicQuerySpec{},
},
},
},
Expand Down Expand Up @@ -478,6 +486,60 @@ func TestMonolithicDefault(t *testing.T) {
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Hour},
Query: &MonolithicQuerySpec{},
},
},
},
{
name: "query defined",
input: &TempoMonolithic{
ObjectMeta: v1.ObjectMeta{
Name: "test",
Namespace: "testns",
},
Spec: TempoMonolithicSpec{
Storage: &MonolithicStorageSpec{
Traces: MonolithicTracesStorageSpec{
Backend: "memory",
Size: &twoGBQuantity,
},
},
Query: &MonolithicQuerySpec{
RBAC: RBACSpec{
Enabled: true,
},
},
},
},
expected: &TempoMonolithic{
ObjectMeta: v1.ObjectMeta{
Name: "test",
Namespace: "testns",
},
Spec: TempoMonolithicSpec{
Ingestion: &MonolithicIngestionSpec{
OTLP: &MonolithicIngestionOTLPSpec{
GRPC: &MonolithicIngestionOTLPProtocolsGRPCSpec{
Enabled: true,
},
HTTP: &MonolithicIngestionOTLPProtocolsHTTPSpec{
Enabled: true,
},
},
},
Storage: &MonolithicStorageSpec{
Traces: MonolithicTracesStorageSpec{
Backend: "memory",
Size: &twoGBQuantity,
},
},
Management: "Managed",
Timeout: metav1.Duration{Duration: time.Second * 30},
Query: &MonolithicQuerySpec{
RBAC: RBACSpec{
Enabled: true,
},
},
},
},
},
Expand Down
17 changes: 17 additions & 0 deletions api/tempo/v1alpha1/tempomonolithic_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,26 @@ type TempoMonolithicSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Extra Configuration",xDescriptors="urn:alm:descriptor:com.tectonic.ui:advanced"
ExtraConfig *ExtraConfigSpec `json:"extraConfig,omitempty"`

// Query defines query configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Query Configuration",xDescriptors="urn:alm:descriptor:com.tectonic.ui:advanced"
Query *MonolithicQuerySpec `json:"query,omitempty"`

MonolithicSchedulerSpec `json:",inline"`
}

// MonolithicQuerySpec defines the query configuration.
type MonolithicQuerySpec struct {
// RBAC defines query RBAC options.
// This option can be used only with multi-tenancy.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Query RBAC Settings"
RBAC RBACSpec `json:"rbac,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RBAC RBACSpec `json:"rbac,omitempty"`
RBAC *RBACSpec `json:"rbac,omitempty"`

same as above

}

// MonolithicStorageSpec defines the storage for the Tempo deployment.
type MonolithicStorageSpec struct {
// Traces defines the storage configuration for traces.
Expand Down
2 changes: 1 addition & 1 deletion api/tempo/v1alpha1/tempostack_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ type TempoGatewaySpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Gateway Ingress Settings"
Ingress IngressSpec `json:"ingress,omitempty"`

// RBAC defines RBAC options.
// RBAC defines query RBAC options.
//
// +optional
// +kubebuilder:validation:Optional
Expand Down
21 changes: 21 additions & 0 deletions api/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.15.1
createdAt: "2025-02-20T06:15:35Z"
createdAt: "2025-02-24T14:09:42Z"
description: Create and manage deployments of Tempo, a high-scale distributed
tracing backend.
operatorframework.io/cluster-monitoring: "true"
Expand Down Expand Up @@ -459,6 +459,19 @@ spec:
- description: ServiceMonitors defines the ServiceMonitor configuration.
displayName: Service Monitors
path: observability.metrics.serviceMonitors
- description: Query defines query configuration.
displayName: Query Configuration
path: query
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- description: |-
RBAC defines query RBAC options.
This option can be used only with multi-tenancy.
displayName: Query RBAC Settings
path: query.rbac
- description: Enabled defines if the query RBAC should be enabled.
displayName: Query RBAC Enabled
path: query.rbac.enabled
- description: ServiceAccount defines the Service Account to use for all Tempo
components.
displayName: Service Account
Expand Down Expand Up @@ -995,7 +1008,7 @@ spec:
all pods of this component.
displayName: PodSecurityContext
path: template.gateway.podSecurityContext
- description: RBAC defines RBAC options.
- description: RBAC defines query RBAC options.
displayName: Query RBAC Settings
path: template.gateway.rbac
- description: Enabled defines if the query RBAC should be enabled.
Expand Down
13 changes: 13 additions & 0 deletions bundle/community/manifests/tempo.grafana.com_tempomonolithics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,19 @@ spec:
type: object
type: object
type: object
query:
description: Query defines query configuration.
properties:
rbac:
description: |-
RBAC defines query RBAC options.
This option can be used only with multi-tenancy.
properties:
enabled:
description: Enabled defines if the query RBAC should be enabled.
type: boolean
type: object
type: object
resources:
description: Resources defines the compute resource requirements of
the Tempo container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ spec:
type: string
type: object
rbac:
description: RBAC defines RBAC options.
description: RBAC defines query RBAC options.
properties:
enabled:
description: Enabled defines if the query RBAC should
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.15.1
createdAt: "2025-02-20T06:15:33Z"
createdAt: "2025-02-24T14:09:41Z"
description: Create and manage deployments of Tempo, a high-scale distributed
tracing backend.
operatorframework.io/cluster-monitoring: "true"
Expand Down Expand Up @@ -459,6 +459,19 @@ spec:
- description: ServiceMonitors defines the ServiceMonitor configuration.
displayName: Service Monitors
path: observability.metrics.serviceMonitors
- description: Query defines query configuration.
displayName: Query Configuration
path: query
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- description: |-
RBAC defines query RBAC options.
This option can be used only with multi-tenancy.
displayName: Query RBAC Settings
path: query.rbac
- description: Enabled defines if the query RBAC should be enabled.
displayName: Query RBAC Enabled
path: query.rbac.enabled
- description: ServiceAccount defines the Service Account to use for all Tempo
components.
displayName: Service Account
Expand Down Expand Up @@ -995,7 +1008,7 @@ spec:
all pods of this component.
displayName: PodSecurityContext
path: template.gateway.podSecurityContext
- description: RBAC defines RBAC options.
- description: RBAC defines query RBAC options.
displayName: Query RBAC Settings
path: template.gateway.rbac
- description: Enabled defines if the query RBAC should be enabled.
Expand Down
13 changes: 13 additions & 0 deletions bundle/openshift/manifests/tempo.grafana.com_tempomonolithics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,19 @@ spec:
type: object
type: object
type: object
query:
description: Query defines query configuration.
properties:
rbac:
description: |-
RBAC defines query RBAC options.
This option can be used only with multi-tenancy.
properties:
enabled:
description: Enabled defines if the query RBAC should be enabled.
type: boolean
type: object
type: object
resources:
description: Resources defines the compute resource requirements of
the Tempo container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ spec:
type: string
type: object
rbac:
description: RBAC defines RBAC options.
description: RBAC defines query RBAC options.
properties:
enabled:
description: Enabled defines if the query RBAC should
Expand Down
13 changes: 13 additions & 0 deletions config/crd/bases/tempo.grafana.com_tempomonolithics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,19 @@ spec:
type: object
type: object
type: object
query:
description: Query defines query configuration.
properties:
rbac:
description: |-
RBAC defines query RBAC options.
This option can be used only with multi-tenancy.
properties:
enabled:
description: Enabled defines if the query RBAC should be enabled.
type: boolean
type: object
type: object
resources:
description: Resources defines the compute resource requirements of
the Tempo container.
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/tempo.grafana.com_tempostacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,7 @@ spec:
type: string
type: object
rbac:
description: RBAC defines RBAC options.
description: RBAC defines query RBAC options.
properties:
enabled:
description: Enabled defines if the query RBAC should
Expand Down
Loading