diff --git a/api/v1alpha1/wavefront_types.go b/api/v1alpha1/wavefront_types.go index aa379839..88072d9d 100644 --- a/api/v1alpha1/wavefront_types.go +++ b/api/v1alpha1/wavefront_types.go @@ -145,6 +145,9 @@ type WavefrontProxy struct { // Distributed tracing configuration Tracing Tracing `json:"tracing,omitempty"` + // OpenTelemetry Protocol configuration + OLTP OLTP `json:"oltp,omitempty"` + // Histogram distribution configuration Histogram Histogram `json:"histogram,omitempty"` @@ -250,6 +253,17 @@ type HttpProxy struct { UseHttpProxyCAcert bool `json:"-"` } +type OLTP struct { + // GrpcPort for OLTP GRPC format data (usually 4317) + GrpcPort int `json:"grpcPort,omitempty"` + + // HttpPort for OLTP format data (usually 4318) + HttpPort int `json:"httpPort,omitempty"` + + // Enable resource attributes on metrics to be included. Defaults to false. + ResourceAttrsOnMetricsIncluded bool `json:"resourceAttrsOnMetricsIncluded,omitempty"` +} + type Resource struct { // CPU is for specifying CPU requirements // +kubebuilder:validation:Pattern:=`^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$` diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 978ab4af..34005b5d 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -284,6 +284,21 @@ func (in *Metrics) DeepCopy() *Metrics { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OLTP) DeepCopyInto(out *OLTP) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OLTP. +func (in *OLTP) DeepCopy() *OLTP { + if in == nil { + return nil + } + out := new(OLTP) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Resource) DeepCopyInto(out *Resource) { *out = *in @@ -412,6 +427,7 @@ func (in *WavefrontList) DeepCopyObject() runtime.Object { func (in *WavefrontProxy) DeepCopyInto(out *WavefrontProxy) { *out = *in out.Tracing = in.Tracing + out.OLTP = in.OLTP out.Histogram = in.Histogram out.Resources = in.Resources out.HttpProxy = in.HttpProxy diff --git a/config/crd/bases/wavefront.com_wavefronts.yaml b/config/crd/bases/wavefront.com_wavefronts.yaml index d14f6e2f..dfecb740 100644 --- a/config/crd/bases/wavefront.com_wavefronts.yaml +++ b/config/crd/bases/wavefront.com_wavefronts.yaml @@ -398,6 +398,21 @@ spec: description: MetricPort is the primary port for Wavefront data format metrics. Defaults to 2878. type: integer + oltp: + description: OpenTelemetry Protocol configuration + properties: + grpcPort: + description: GrpcPort for OLTP GRPC format data (usually + 4317) + type: integer + httpPort: + description: HttpPort for OLTP format data (usually 4318) + type: integer + resourceAttrsOnMetricsIncluded: + description: Enable resource attributes on metrics to + be included. Defaults to false. + type: boolean + type: object preprocessor: description: Preprocessor is the name of the configmap containing a rules.yaml key with proxy preprocessing rules diff --git a/controllers/wavefront_controller_test.go b/controllers/wavefront_controller_test.go index 12b41d6d..4a254d2c 100644 --- a/controllers/wavefront_controller_test.go +++ b/controllers/wavefront_controller_test.go @@ -552,6 +552,27 @@ func TestReconcileProxy(t *testing.T) { containsProxyArg(t, "--traceZipkinApplicationName zipkin", *mockKM) }) + t.Run("can create proxy with OLTP enabled", func(t *testing.T) { + r, mockKM := emptyScenario(wftest.CR(func(w *wf.Wavefront) { + w.Spec.DataExport.WavefrontProxy.OLTP = wf.OLTP{ + GrpcPort: 4317, + HttpPort: 4318, + ResourceAttrsOnMetricsIncluded: true, + } + })) + + _, err := r.Reconcile(context.Background(), defaultRequest()) + require.NoError(t, err) + + containsPortInContainers(t, "otlpGrpcListenerPorts", *mockKM, 4317) + containsPortInServicePort(t, 4317, *mockKM) + + containsPortInContainers(t, "otlpHttpListenerPorts", *mockKM, 4318) + containsPortInServicePort(t, 4318, *mockKM) + + containsProxyArg(t, "--otlpResourceAttrsOnMetricsIncluded true", *mockKM) + }) + t.Run("can create proxy with histogram ports enabled", func(t *testing.T) { r, mockKM := emptyScenario(wftest.CR(func(w *wf.Wavefront) { w.Spec.DataExport.WavefrontProxy.Histogram.Port = 40000 diff --git a/deploy/internal/proxy/0-wavefront-proxy-service.yaml b/deploy/internal/proxy/0-wavefront-proxy-service.yaml index c734b8b8..fe109d3b 100644 --- a/deploy/internal/proxy/0-wavefront-proxy-service.yaml +++ b/deploy/internal/proxy/0-wavefront-proxy-service.yaml @@ -66,6 +66,16 @@ spec: port: {{ .DataExport.WavefrontProxy.Histogram.DayPort }} protocol: TCP {{end}} + {{if .DataExport.WavefrontProxy.OLTP.GrpcPort}} + - name: oltp-grpc + port: {{ .DataExport.WavefrontProxy.OLTP.GrpcPort }} + protocol: TCP + {{end}} + {{if .DataExport.WavefrontProxy.OLTP.HttpPort}} + - name: oltp-http + port: {{ .DataExport.WavefrontProxy.OLTP.HttpPort }} + protocol: TCP + {{end}} selector: app.kubernetes.io/name : wavefront app.kubernetes.io/component: proxy diff --git a/deploy/internal/proxy/1-wavefront-proxy-deployment.yaml b/deploy/internal/proxy/1-wavefront-proxy-deployment.yaml index c6fb743c..c13ff19b 100644 --- a/deploy/internal/proxy/1-wavefront-proxy-deployment.yaml +++ b/deploy/internal/proxy/1-wavefront-proxy-deployment.yaml @@ -65,6 +65,9 @@ spec: {{- if .DataExport.WavefrontProxy.Histogram.MinutePort }} --histogramMinuteListenerPorts {{ .DataExport.WavefrontProxy.Histogram.MinutePort }} {{- end -}} {{- if .DataExport.WavefrontProxy.Histogram.HourPort }} --histogramHourListenerPorts {{ .DataExport.WavefrontProxy.Histogram.HourPort }} {{- end -}} {{- if .DataExport.WavefrontProxy.Histogram.DayPort }} --histogramDayListenerPorts {{ .DataExport.WavefrontProxy.Histogram.DayPort }} {{- end -}} + {{- if .DataExport.WavefrontProxy.OLTP.GrpcPort}} --otlpGrpcListenerPorts {{ .DataExport.WavefrontProxy.OLTP.GrpcPort }} {{- end -}} + {{- if .DataExport.WavefrontProxy.OLTP.HttpPort}} --otlpHttpListenerPorts {{ .DataExport.WavefrontProxy.OLTP.HttpPort }} {{- end -}} + {{- if .DataExport.WavefrontProxy.OLTP.ResourceAttrsOnMetricsIncluded}} --otlpResourceAttrsOnMetricsIncluded true {{- end -}} {{- if .DataExport.WavefrontProxy.Preprocessor }} --preprocessorConfigFile /etc/wavefront/preprocessor/rules.yaml {{- end -}} {{- if .DataExport.WavefrontProxy.HttpProxy.HttpProxyHost }} --proxyHost {{ .DataExport.WavefrontProxy.HttpProxy.HttpProxyHost }} {{- end -}} {{- if .DataExport.WavefrontProxy.HttpProxy.HttpProxyPort }} --proxyPort {{ .DataExport.WavefrontProxy.HttpProxy.HttpProxyPort }} {{- end -}} @@ -115,6 +118,14 @@ spec: - containerPort: {{ .DataExport.WavefrontProxy.Histogram.DayPort }} protocol: TCP {{- end }} + {{- if .DataExport.WavefrontProxy.OLTP.GrpcPort}} + - containerPort: {{ .DataExport.WavefrontProxy.OLTP.GrpcPort }} + protocol: TCP + {{- end }} + {{- if .DataExport.WavefrontProxy.OLTP.HttpPort}} + - containerPort: {{ .DataExport.WavefrontProxy.OLTP.HttpPort }} + protocol: TCP + {{- end }} readinessProbe: timeoutSeconds: 10 failureThreshold: 10 diff --git a/deploy/kubernetes/scenarios/wavefront-proxy-oltp.yaml b/deploy/kubernetes/scenarios/wavefront-proxy-oltp.yaml new file mode 100644 index 00000000..b89869a3 --- /dev/null +++ b/deploy/kubernetes/scenarios/wavefront-proxy-oltp.yaml @@ -0,0 +1,19 @@ +# Need to change YOUR_CLUSTER_NAME and YOUR_WAVEFRONT_URL accordingly +apiVersion: wavefront.com/v1alpha1 +kind: Wavefront +metadata: + name: wavefront + namespace: observability-system +spec: + clusterName: YOUR_CLUSTER_NAME + wavefrontUrl: YOUR_WAVEFRONT_URL + dataCollection: + metrics: + enable: true + dataExport: + wavefrontProxy: + enable: true + oltp: + grpcPort: 4317 + httpPort: 4318 + resourceAttrsOnMetricsIncluded: true