diff --git a/charts/controller/crds/deployments.plural.sh_deploymentsettings.yaml b/charts/controller/crds/deployments.plural.sh_deploymentsettings.yaml index 7a2dde7ac..986e0cd07 100644 --- a/charts/controller/crds/deployments.plural.sh_deploymentsettings.yaml +++ b/charts/controller/crds/deployments.plural.sh_deploymentsettings.yaml @@ -400,6 +400,52 @@ spec: type: object type: array type: object + logging: + description: Settings for connections to log aggregation datastores + properties: + driver: + description: The type of log aggregation solution you wish to + use + type: string + enabled: + type: boolean + victoria: + description: Configures a connection to victoria metrics + properties: + host: + description: Host ... + type: string + password: + description: Password to connect w/ for basic auth + type: string + passwordSecretRef: + description: PasswordSecretRef selects a key of a password + Secret + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + user: + description: User to connect with basic auth + type: string + required: + - host + type: object + type: object lokiConnection: description: LokiConnection connection details for a loki instance to use diff --git a/go/controller/api/v1alpha1/deploymentsettings_types.go b/go/controller/api/v1alpha1/deploymentsettings_types.go index 6b5b07f23..c28e1f65b 100644 --- a/go/controller/api/v1alpha1/deploymentsettings_types.go +++ b/go/controller/api/v1alpha1/deploymentsettings_types.go @@ -98,6 +98,22 @@ type DeploymentSettingsSpec struct { // // +kubebuilder:validation:Optional AI *AISettings `json:"ai,omitempty"` + + // Settings for connections to log aggregation datastores + // + // +kubebuilder:validation:Optional + Logging *LoggingSettings `json:"logging,omitempty"` +} + +type LoggingSettings struct { + // +kubebuilder:validation:Optional + Enabled *bool `json:"enabled,omitempty"` + // The type of log aggregation solution you wish to use + // +kubebuilder:validation:Optional + Driver *console.LogDriver `json:"driver,omitempty"` + // Configures a connection to victoria metrics + // +kubebuilder:validation:Optional + Victoria *HTTPConnection `json:"victoria,omitempty"` } type HTTPConnection struct { @@ -225,6 +241,22 @@ type AISettings struct { Vertex *VertexSettings `json:"vertex,omitempty"` } +func (in *LoggingSettings) Attributes(ctx context.Context, c client.Client, namespace string) (*console.LoggingSettingsAttributes, error) { + attr := &console.LoggingSettingsAttributes{ + Enabled: in.Enabled, + Driver: in.Driver, + } + if in.Victoria != nil { + connection, err := in.Victoria.Attributes(ctx, c, namespace) + if err != nil { + return nil, err + } + attr.Victoria = connection + } + + return attr, nil +} + func (in *AISettings) Attributes(ctx context.Context, c client.Client, namespace string) (*console.AiSettingsAttributes, error) { attr := &console.AiSettingsAttributes{ Enabled: in.Enabled, diff --git a/go/controller/api/v1alpha1/zz_generated.deepcopy.go b/go/controller/api/v1alpha1/zz_generated.deepcopy.go index 6d7b9b838..dd7b0f6b5 100644 --- a/go/controller/api/v1alpha1/zz_generated.deepcopy.go +++ b/go/controller/api/v1alpha1/zz_generated.deepcopy.go @@ -1405,6 +1405,11 @@ func (in *DeploymentSettingsSpec) DeepCopyInto(out *DeploymentSettingsSpec) { *out = new(AISettings) (*in).DeepCopyInto(*out) } + if in.Logging != nil { + in, out := &in.Logging, &out.Logging + *out = new(LoggingSettings) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentSettingsSpec. @@ -2327,6 +2332,36 @@ func (in *JobSpec) DeepCopy() *JobSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoggingSettings) DeepCopyInto(out *LoggingSettings) { + *out = *in + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.Driver != nil { + in, out := &in.Driver, &out.Driver + *out = new(client.LogDriver) + **out = **in + } + if in.Victoria != nil { + in, out := &in.Victoria, &out.Victoria + *out = new(HTTPConnection) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoggingSettings. +func (in *LoggingSettings) DeepCopy() *LoggingSettings { + if in == nil { + return nil + } + out := new(LoggingSettings) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ManagedNamespace) DeepCopyInto(out *ManagedNamespace) { *out = *in diff --git a/go/controller/config/crd/bases/deployments.plural.sh_deploymentsettings.yaml b/go/controller/config/crd/bases/deployments.plural.sh_deploymentsettings.yaml index 7a2dde7ac..986e0cd07 100644 --- a/go/controller/config/crd/bases/deployments.plural.sh_deploymentsettings.yaml +++ b/go/controller/config/crd/bases/deployments.plural.sh_deploymentsettings.yaml @@ -400,6 +400,52 @@ spec: type: object type: array type: object + logging: + description: Settings for connections to log aggregation datastores + properties: + driver: + description: The type of log aggregation solution you wish to + use + type: string + enabled: + type: boolean + victoria: + description: Configures a connection to victoria metrics + properties: + host: + description: Host ... + type: string + password: + description: Password to connect w/ for basic auth + type: string + passwordSecretRef: + description: PasswordSecretRef selects a key of a password + Secret + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + user: + description: User to connect with basic auth + type: string + required: + - host + type: object + type: object lokiConnection: description: LokiConnection connection details for a loki instance to use diff --git a/go/controller/docs/api.md b/go/controller/docs/api.md index 3dfab3ab4..191c7ba84 100644 --- a/go/controller/docs/api.md +++ b/go/controller/docs/api.md @@ -748,6 +748,7 @@ _Appears in:_ | `prometheusConnection` _[HTTPConnection](#httpconnection)_ | PrometheusConnection connection details for a prometheus instance to use | | Optional: {}
| | `lokiConnection` _[HTTPConnection](#httpconnection)_ | LokiConnection connection details for a loki instance to use | | Optional: {}
| | `ai` _[AISettings](#aisettings)_ | AI settings specifies a configuration for LLM provider clients | | Optional: {}
| +| `logging` _[LoggingSettings](#loggingsettings)_ | Settings for connections to log aggregation datastores | | Optional: {}
| @@ -948,6 +949,7 @@ _Appears in:_ _Appears in:_ - [DeploymentSettingsSpec](#deploymentsettingsspec) +- [LoggingSettings](#loggingsettings) | Field | Description | Default | Validation | | --- | --- | --- | --- | @@ -1182,6 +1184,24 @@ _Appears in:_ | `resources` _[ContainerResources](#containerresources)_ | Resource specification that overrides implicit container resources when containers are not directly configured. | | Optional: {}
| +#### LoggingSettings + + + + + + + +_Appears in:_ +- [DeploymentSettingsSpec](#deploymentsettingsspec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `enabled` _boolean_ | | | Optional: {}
| +| `driver` _[LogDriver](#logdriver)_ | The type of log aggregation solution you wish to use | | Optional: {}
| +| `victoria` _[HTTPConnection](#httpconnection)_ | Configures a connection to victoria metrics | | Optional: {}
| + + #### ManagedNamespace diff --git a/go/controller/internal/controller/deploymentsettings_controller.go b/go/controller/internal/controller/deploymentsettings_controller.go index 2b748dff2..db2bb4590 100644 --- a/go/controller/internal/controller/deploymentsettings_controller.go +++ b/go/controller/internal/controller/deploymentsettings_controller.go @@ -186,6 +186,17 @@ func (r *DeploymentSettingsReconciler) genDeploymentSettingsAttr(ctx context.Con } attr.Ai = ai } + if settings.Spec.Logging != nil { + logging, err := settings.Spec.Logging.Attributes(ctx, r.Client, settings.Namespace) + if errors.IsNotFound(err) { + return nil, operrors.ErrReferenceNotFound + } + + if err != nil { + return nil, err + } + attr.Logging = logging + } if settings.Spec.Stacks != nil { var jobSpec *console.GateJobAttributes var err error diff --git a/plural/helm/console/crds/deployments.plural.sh_deploymentsettings.yaml b/plural/helm/console/crds/deployments.plural.sh_deploymentsettings.yaml index 7a2dde7ac..986e0cd07 100644 --- a/plural/helm/console/crds/deployments.plural.sh_deploymentsettings.yaml +++ b/plural/helm/console/crds/deployments.plural.sh_deploymentsettings.yaml @@ -400,6 +400,52 @@ spec: type: object type: array type: object + logging: + description: Settings for connections to log aggregation datastores + properties: + driver: + description: The type of log aggregation solution you wish to + use + type: string + enabled: + type: boolean + victoria: + description: Configures a connection to victoria metrics + properties: + host: + description: Host ... + type: string + password: + description: Password to connect w/ for basic auth + type: string + passwordSecretRef: + description: PasswordSecretRef selects a key of a password + Secret + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + user: + description: User to connect with basic auth + type: string + required: + - host + type: object + type: object lokiConnection: description: LokiConnection connection details for a loki instance to use