Skip to content

Commit

Permalink
Add limitador tracing-endpoint command
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-cattermole committed Apr 9, 2024
1 parent c4802c5 commit a714adf
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1 deletion.
7 changes: 7 additions & 0 deletions api/v1alpha1/limitador_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ type LimitadorSpec struct {
// +optional
Telemetry *Telemetry `json:"telemetry,omitempty"`

// +optional
Tracing *Tracing `json:"tracing,omitempty"`

// +optional
Limits []RateLimit `json:"limits,omitempty"`

Expand Down Expand Up @@ -324,6 +327,10 @@ type Ports struct {
GRPC int32 `json:"grpc,omitempty"`
}

type Tracing struct {
Endpoint *string `json:"endpoint,omitempty"`
}

type PodDisruptionBudgetType struct {
// An eviction is allowed if at most "maxUnavailable" limitador pods
// are unavailable after the eviction, i.e. even in absence of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ metadata:
capabilities: Basic Install
categories: Integration & Delivery
containerImage: quay.io/kuadrant/limitador-operator:latest
createdAt: "2024-04-04T14:34:19Z"
createdAt: "2024-04-09T11:21:26Z"
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/Kuadrant/limitador-operator
Expand Down
5 changes: 5 additions & 0 deletions bundle/manifests/limitador.kuadrant.io_limitadors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,11 @@ spec:
- basic
- exhaustive
type: string
tracing:
properties:
endpoint:
type: string
type: object
verbosity:
description: Sets the level of verbosity
maximum: 4
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/limitador.kuadrant.io_limitadors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,11 @@ spec:
- basic
- exhaustive
type: string
tracing:
properties:
endpoint:
type: string
type: object
verbosity:
description: Sets the level of verbosity
maximum: 4
Expand Down
4 changes: 4 additions & 0 deletions pkg/limitador/deployment_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func DeploymentCommand(limObj *limitadorv1alpha1.Limitador, storageOptions Deplo
command = append(command, "--limit-name-in-labels")
}

if limObj.Spec.Tracing != nil && limObj.Spec.Tracing.Endpoint != nil {
command = append(command, "--tracing-endpoint", *limObj.Spec.Tracing.Endpoint)
}

if limObj.Spec.Verbosity != nil {
command = append(command, fmt.Sprintf("-%s", strings.Repeat("v", int(*limObj.Spec.Verbosity))))
}
Expand Down
20 changes: 20 additions & 0 deletions pkg/limitador/deployment_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,26 @@ func TestDeploymentCommand(t *testing.T) {
})
}
})

t.Run("command from tracing endpoint appended", func(subT *testing.T) {
testEndpoint := "rpc://tracing-endpoint:4317"
limObj := basicLimitador()
limObj.Spec.Tracing = &limitadorv1alpha1.Tracing{
Endpoint: &testEndpoint,
}
command := DeploymentCommand(limObj, DeploymentStorageOptions{})
assert.DeepEqual(subT, command,
[]string{
"limitador-server",
"--tracing-endpoint",
testEndpoint,
"--http-port",
strconv.Itoa(int(limitadorv1alpha1.DefaultServiceHTTPPort)),
"--rls-port",
strconv.Itoa(int(limitadorv1alpha1.DefaultServiceGRPCPort)),
"/home/limitador/etc/limitador-config.yaml",
})
})
}

func TestDeploymentVolumeMounts(t *testing.T) {
Expand Down

0 comments on commit a714adf

Please sign in to comment.