Skip to content

Commit

Permalink
feat: enable vector API
Browse files Browse the repository at this point in the history
  • Loading branch information
JBOClara committed Oct 17, 2024
1 parent f3111e7 commit f66b817
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.22 as builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
5 changes: 5 additions & 0 deletions apis/telemetry/v1alpha1/telemetry_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ type VectorSpec struct {
ScrapeInterval *metav1.Duration `json:"scrapeInterval,omitempty"`

Components *VectorComponentsSpec `json:"components,omitempty"`
Api *ApiConfig `json:"api,omitempty"`
}

type ApiConfig struct {
Enabled *bool `json:"enabled,omitempty"`
}

type VectorComponentsSpec struct {
Expand Down
25 changes: 25 additions & 0 deletions apis/telemetry/v1alpha1/zz_generated.deepcopy.go

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

45 changes: 45 additions & 0 deletions charts/k8ssandra-operator/crds/k8ssandra-operator-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13599,6 +13599,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -14144,6 +14149,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -16630,6 +16640,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -25536,6 +25551,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -29040,6 +29060,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -30803,6 +30828,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -35137,6 +35167,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -38523,6 +38558,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -39053,6 +39093,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down
30 changes: 30 additions & 0 deletions config/crd/bases/k8ssandra.io_k8ssandraclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13537,6 +13537,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -14082,6 +14087,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -16568,6 +16578,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -25474,6 +25489,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -28978,6 +28998,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -30741,6 +30766,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/reaper.k8ssandra.io_reapers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2565,6 +2565,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/stargate.k8ssandra.io_stargates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2995,6 +2995,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down Expand Up @@ -3525,6 +3530,11 @@ spec:
type: object
vector:
properties:
api:
properties:
enabled:
type: boolean
type: object
components:
properties:
sinks:
Expand Down
6 changes: 6 additions & 0 deletions pkg/telemetry/vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ Clean:

func BuildCustomVectorToml(telemetrySpec *telemetry.TelemetrySpec) string {
vectorConfigToml := ""

if telemetrySpec.Vector.Api != nil && telemetrySpec.Vector.Api.Enabled != nil && *telemetrySpec.Vector.Api.Enabled {
vectorConfigToml += "[api]\n"
vectorConfigToml += "enabled = true\n"
}

for _, source := range telemetrySpec.Vector.Components.Sources {
vectorConfigToml += fmt.Sprintf("\n[sources.%s]\n", source.Name)
vectorConfigToml += fmt.Sprintf("type = \"%s\"\n", source.Type)
Expand Down

0 comments on commit f66b817

Please sign in to comment.