From e84e68d34cf4f9b91871c24215e4cd7bf65a16ef Mon Sep 17 00:00:00 2001 From: Szilard Parrag Date: Fri, 2 Feb 2024 14:57:28 +0100 Subject: [PATCH] fixup! fix(output): make all OTLPgrpc fields available Signed-off-by: Szilard Parrag --- api/telemetry/v1alpha1/oteloutput_types.go | 14 +++---- .../v1alpha1/zz_generated.deepcopy.go | 1 + ...elemetry.kube-logging.dev_oteloutputs.yaml | 41 +++++++++++++++++++ .../controller/telemetry/otel_conf_gen.go | 1 + 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/api/telemetry/v1alpha1/oteloutput_types.go b/api/telemetry/v1alpha1/oteloutput_types.go index 42f54d47..4a35b98e 100644 --- a/api/telemetry/v1alpha1/oteloutput_types.go +++ b/api/telemetry/v1alpha1/oteloutput_types.go @@ -32,10 +32,10 @@ type OtelOutputSpec struct { // OTLP grpc exporter config ref: https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/otlpexporter/config.go type OTLPgrpc struct { - QueueConfig QueueSettings `json:"sending_queue,omitempty"` - RetryConfig BackOffConfig `json:"retry_on_failure,omitempty"` - TimeoutSettings `json:",inline"` - GRPCClientSettings `json:",inline"` + QueueConfig QueueSettings `json:"sending_queue,omitempty" yaml:"sending_queue,omitempty"` + RetryConfig BackOffConfig `json:"retry_on_failure,omitempty" yaml:"retry_on_failure,omitempty"` + TimeoutSettings `json:",inline" yaml:",inline"` + GRPCClientSettings `json:",inline" yaml:",inline"` } // OtelOutputStatus defines the observed state of OtelOutput @@ -52,15 +52,15 @@ type OtelOutput struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec OtelOutputSpec `json:"spec,omitempty"` - Status OtelOutputStatus `json:"status,omitempty"` + Spec OtelOutputSpec `json:"spec,omitempty" yaml:"spec,omitempty"` + Status OtelOutputStatus `json:"status,omitempty" ` } //+kubebuilder:object:root=true // OtelOutputList contains a list of OtelOutput type OtelOutputList struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []OtelOutput `json:"items"` } diff --git a/api/telemetry/v1alpha1/zz_generated.deepcopy.go b/api/telemetry/v1alpha1/zz_generated.deepcopy.go index 0988f9bb..99597a6a 100644 --- a/api/telemetry/v1alpha1/zz_generated.deepcopy.go +++ b/api/telemetry/v1alpha1/zz_generated.deepcopy.go @@ -427,6 +427,7 @@ func (in *SubscriptionStatus) DeepCopy() *SubscriptionStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TLSClientSetting) DeepCopyInto(out *TLSClientSetting) { *out = *in + out.TLSSetting = in.TLSSetting } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSClientSetting. diff --git a/config/crd/bases/telemetry.kube-logging.dev_oteloutputs.yaml b/config/crd/bases/telemetry.kube-logging.dev_oteloutputs.yaml index c65411d7..5566a2df 100644 --- a/config/crd/bases/telemetry.kube-logging.dev_oteloutputs.yaml +++ b/config/crd/bases/telemetry.kube-logging.dev_oteloutputs.yaml @@ -165,6 +165,23 @@ spec: tls: description: TLSSetting struct exposes TLS client configuration. properties: + ca_file: + description: |- + Path to the CA cert. For a client this verifies the server certificate. + For a server this verifies client certificates. If empty uses system root CA. + (optional) + type: string + ca_pem: + description: In memory PEM encoded cert. (optional) + type: string + cert_file: + description: Path to the TLS cert to use for TLS required + connections. (optional) + type: string + cert_pem: + description: In memory PEM encoded TLS cert to use for TLS + required connections. (optional) + type: string insecure: description: |- In gRPC when set to true, this is used to disable the client transport security. @@ -178,6 +195,30 @@ spec: description: InsecureSkipVerify will enable TLS but not verify the certificate. type: boolean + key_file: + description: Path to the TLS key to use for TLS required connections. + (optional) + type: string + key_pem: + description: In memory PEM encoded TLS key to use for TLS + required connections. (optional) + type: string + max_version: + description: |- + MaxVersion sets the maximum TLS version that is acceptable. + If not set, refer to crypto/tls for defaults. (optional) + type: string + min_version: + description: |- + MinVersion sets the minimum TLS version that is acceptable. + If not set, TLS 1.2 will be used. (optional) + type: string + reload_interval: + description: |- + ReloadInterval specifies the duration after which the certificate will be reloaded + If not set, it will never be reloaded (optional) + format: int64 + type: integer server_name_override: description: |- ServerName requested by client for virtual hosting. diff --git a/internal/controller/telemetry/otel_conf_gen.go b/internal/controller/telemetry/otel_conf_gen.go index 8e76445f..29c472f2 100644 --- a/internal/controller/telemetry/otel_conf_gen.go +++ b/internal/controller/telemetry/otel_conf_gen.go @@ -94,6 +94,7 @@ func (cfgInput *OtelColConfigInput) generateOTLPExporters() map[string]any { var result = make(map[string]any) for _, output := range cfgInput.Outputs { + // TODO: add proper error handling name := fmt.Sprintf("otlp/%s_%s", output.Namespace, output.Name) otlpGrpcValuesMarshaled, err := yaml.Marshal(output.Spec.OTLP) if err != nil {