diff --git a/api/observability/v1/clusterlogforwarder_types.go b/api/observability/v1/clusterlogforwarder_types.go index 5f58d7f631..d7a06aa624 100644 --- a/api/observability/v1/clusterlogforwarder_types.go +++ b/api/observability/v1/clusterlogforwarder_types.go @@ -122,6 +122,15 @@ type CollectorSpec struct { // +kubebuilder:validation:Optional // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Tolerations" Tolerations []corev1.Toleration `json:"tolerations,omitempty"` + + // TerminationGracePeriodSeconds defines the termination grace period for collector pods + // in seconds. If not specified, the default is 10 seconds. + // + // +nullable + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum:=1 + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Termination Grace Period Seconds",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:number"} + TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` } // PipelineSpec links a set of inputs and transformations to a set of outputs. diff --git a/api/observability/v1/zz_generated.deepcopy.go b/api/observability/v1/zz_generated.deepcopy.go index 47ee5519f5..27469b0cf9 100644 --- a/api/observability/v1/zz_generated.deepcopy.go +++ b/api/observability/v1/zz_generated.deepcopy.go @@ -458,6 +458,11 @@ func (in *CollectorSpec) DeepCopyInto(out *CollectorSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.TerminationGracePeriodSeconds != nil { + in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorSpec. diff --git a/bundle/manifests/cluster-logging.clusterserviceversion.yaml b/bundle/manifests/cluster-logging.clusterserviceversion.yaml index cc4b75f57b..911911be8c 100644 --- a/bundle/manifests/cluster-logging.clusterserviceversion.yaml +++ b/bundle/manifests/cluster-logging.clusterserviceversion.yaml @@ -82,7 +82,7 @@ metadata: categories: OpenShift Optional, Logging & Tracing certified: "false" containerImage: quay.io/openshift-logging/cluster-logging-operator:latest - createdAt: "2026-02-03T00:15:38Z" + createdAt: "2026-07-07T14:07:55Z" description: The Red Hat OpenShift Logging Operator for OCP provides a means for configuring and managing log collection and forwarding. features.operators.openshift.io/cnf: "false" @@ -128,7 +128,6 @@ spec: - description: |- ClusterLogForwarder is an API to configure forwarding logs. - You configure forwarding by specifying a list of `pipelines`, which forward from a set of named inputs to a set of named outputs. displayName: Cluster Log Forwarder @@ -150,6 +149,13 @@ spec: path: collector.resources x-descriptors: - urn:alm:descriptor:com.tectonic.ui:resourceRequirements + - description: |- + TerminationGracePeriodSeconds defines the termination grace period for collector pods + in seconds. If not specified, the default is 10 seconds. + displayName: Termination Grace Period Seconds + path: collector.terminationGracePeriodSeconds + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:number - description: Define the tolerations the collector pods will accept displayName: Tolerations path: collector.tolerations @@ -205,78 +211,56 @@ spec: - description: |- `In` is an array of dot-delimited field paths. Fields included here are removed from the log record. - Each field path expression must start with a "." - The path can contain alphanumeric characters and underscores (a-zA-Z0-9_). - If segments contain characters outside of this range, the segment must be quoted otherwise paths do NOT need to be quoted. - Examples: - - `.kubernetes.namespace_name` - - `.log_type` - - '.kubernetes.labels.foobar' - - `.kubernetes.labels."foo-bar/baz"` - NOTE1: `In` CANNOT contain `.log_type` or `.message` as those fields are required and cannot be pruned. - NOTE2: If this filter is used in a pipeline with GoogleCloudLogging, `.hostname` CANNOT be added to this list as it is a required field. displayName: Fields to be dropped path: filters[0].prune.in - description: |- `NotIn` is an array of dot-delimited field paths. All fields besides the ones listed here are removed from the log record. - Each field path expression must start with a "." - The path can contain alphanumeric characters and underscores (a-zA-Z0-9_). - If segments contain characters outside of this range, the segment must be quoted otherwise paths do NOT need to be quoted. - Examples: - - `.kubernetes.namespace_name` - - `.log_type` - - '.kubernetes.labels.foobar' - - `.kubernetes.labels."foo-bar/baz"` - NOTE1: `NotIn` MUST contain `.log_type` and `.message` as those fields are required and cannot be pruned. - NOTE2: If this filter is used in a pipeline with GoogleCloudLogging, `.hostname` MUST be added to this list as it is a required field. displayName: Fields to be kept path: filters[0].prune.notIn - description: |- Type of filter. - Possible filter types are: - 1. detectMultilineException - Enables multi-line error detection of container logs. No additional configuration required. 2. drop - Drop whole log records based on the evaluation of a set of regex tests. See field `drop` for configuration. 3. kubeAPIAudit - Remove unwanted audit events and reduce event size to create a manageable audit trail. See field `kubeAPIaudit` for configuration. @@ -288,7 +272,6 @@ spec: - description: |- Inputs are named filters for log messages to be forwarded. - There are three built-in inputs named `application`, `infrastructure` and `audit`. You don't need to define inputs here if those are sufficient for your needs. See `inputRefs` for more. @@ -302,7 +285,6 @@ spec: - description: |- Excludes is the set of namespaces and containers to ignore when collecting logs. - Takes precedence over Includes option. displayName: Exclude path: inputs[0].application.excludes @@ -323,7 +305,6 @@ spec: - description: |- Includes is the set of namespaces and containers to include when collecting logs. - Note: infrastructure namespaces are still excluded for "*" values unless a qualifying glob pattern is specified. displayName: Include path: inputs[0].application.includes @@ -344,10 +325,8 @@ spec: - description: |- Selector for logs from pods with matching labels. - Only messages from pods with these labels are collected. - If absent or empty, logs are collected regardless of labels. displayName: Pod Selector path: inputs[0].application.selector @@ -434,7 +413,6 @@ spec: - description: |- TLS contains settings for controlling options of TLS connections. - The operator will request certificates from the cluster's cert signing service when TLS is not defined. The certificates are injected into a secret named "-" which is mounted into the collector. The collector is configured to use the public and private key provided by the service @@ -610,25 +588,18 @@ spec: - description: |- GroupName defines the strategy for grouping logstreams - The GroupName can be a combination of static and dynamic values consisting of field paths followed by "\|\|" followed by another field path or a static value. - A dynamic value is encased in single curly brackets "{}" and MUST end with a static fallback value separated with "\|\|". - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar\|\|"none"} - 2. {.foo\|\|.bar\|\|"missing"} - 3. foo.{.bar.baz\|\|.qux.quux.corge\|\|.grault\|\|"nil"}-waldo.fred{.plugh\|\|"none"} displayName: Group Name path: outputs[0].cloudwatch.groupName @@ -663,7 +634,6 @@ spec: - description: |- URL to send log records to. - The 'username@password' part of `url` is ignored. displayName: Destination URL path: outputs[0].cloudwatch.url @@ -728,30 +698,22 @@ spec: - description: |- Index is the index for the logs. This supports template syntax to allow dynamic per-event values. - The Index can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - When forwarding logs to the Red Hat Managed Elasticsearch, the index must match the pattern ^(app|infra|audit)-write$ where the prefix depends upon the log_type. This requires defining a distinct output for each log type or distinct pipelines with the openshiftLabels filter. See the product documentation for examples. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} displayName: Log Index path: outputs[0].elasticsearch.index @@ -828,25 +790,18 @@ spec: - description: |- LogId is the log ID to which to publish logs. This identifies log stream. - The LogId can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} displayName: Log Stream ID path: outputs[0].googleCloudLogging.logId @@ -1011,7 +966,6 @@ spec: - description: |- Brokers specifies the list of broker endpoints of a Kafka cluster. - The list represents only the initial set used by the collector's Kafka client for the first connection only. The collector's Kafka client fetches constantly an updated list from Kafka. These updates are not reconciled back to the collector configuration. @@ -1022,25 +976,18 @@ spec: - description: |- Topic specifies the target topic to send logs to. The value when not specified is 'topic' - The Topic can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} displayName: Kafka Topic path: outputs[0].kafka.topic @@ -1125,46 +1072,33 @@ spec: - description: |- LabelKeys can be used to customize which log record keys are mapped to Loki stream labels. - If LabelKeys is not set, the default keys are: - - log_type - - kubernetes.container_name - - kubernetes.namespace_name - - kubernetes.pod_name - One additional label "kubernetes_host" is not part of the label keys configuration. It contains the hostname where the collector is running and is always present. - Note: Loki label names must match the regular expression "[a-zA-Z_:][a-zA-Z0-9_:]*" Log record keys may contain characters like "." and "/" that are not allowed in Loki labels. Log record keys are translated to Loki labels by replacing any illegal characters with '_'. - For example the default log record keys translate to these Loki labels: - - log_type - - kubernetes_container_name - - kubernetes_namespace_name - - kubernetes_pod_name - Note: the set of labels should be small, Loki imposes limits on the size and number of labels allowed. See https://grafana.com/docs/loki/latest/configuration/#limits_config for more. Loki queries can also query based on any log record field (not just labels) using query filters. @@ -1173,25 +1107,18 @@ spec: - description: |- TenantKey is the tenant for the logs. This supports vector's template syntax to allow dynamic per-event values. - The TenantKey can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} displayName: Tenant Key path: outputs[0].loki.tenantKey @@ -1258,41 +1185,31 @@ spec: - description: |- DataModel can be used to customize how log data is stored in LokiStack. - There are two different models to choose from: - - Viaq - Otel - When the data model is not set, it currently defaults to the "Viaq" data model. displayName: Data Model path: outputs[0].lokiStack.dataModel - description: |- LabelKeys can be used to customize which log record keys are mapped to Loki stream labels. - Note: Loki label names must match the regular expression "[a-zA-Z_:][a-zA-Z0-9_:]*" Log record keys may contain characters like "." and "/" that are not allowed in Loki labels. Log record keys are translated to Loki labels by replacing any illegal characters with '_'. - For example the default log record keys translate to these Loki labels: - - log_type - - kubernetes_container_name - - kubernetes_namespace_name - - kubernetes_pod_name - Note: the set of labels should be small, Loki imposes limits on the size and number of labels allowed. See https://grafana.com/docs/loki/latest/configuration/#limits_config for more. Loki queries can also query based on any log record field (not just labels) using query filters. @@ -1312,7 +1229,6 @@ spec: - description: |- LabelKeys contains a list of log record keys that are mapped to Loki stream labels. - By default, this list is combined with the labels specified in the Global configuration. This behavior can be changed by setting IgnoreGlobal to true. displayName: Label Keys @@ -1330,7 +1246,6 @@ spec: - description: |- LabelKeys contains a list of log record keys that are mapped to Loki stream labels. - By default, this list is combined with the labels specified in the Global configuration. This behavior can be changed by setting IgnoreGlobal to true. displayName: Label Keys @@ -1338,22 +1253,16 @@ spec: - description: |- Global contains a list of record keys which are used for all tenants. - If LabelKeys is not set, the default keys are: - - log_type - - kubernetes.container_name - - kubernetes.namespace_name - - kubernetes.pod_name - One additional label "kubernetes_host" is not part of the label keys configuration. It contains the hostname where the collector is running and is always present. displayName: Global Configuration @@ -1372,7 +1281,6 @@ spec: - description: |- LabelKeys contains a list of log record keys that are mapped to Loki stream labels. - By default, this list is combined with the labels specified in the Global configuration. This behavior can be changed by setting IgnoreGlobal to true. displayName: Label Keys @@ -1499,11 +1407,9 @@ spec: - description: |- URL to send log records to. - An absolute URL, with a valid http scheme. The OTLP spec recommends it terminate with `/v1/logs` but that 'Non-default URL paths for requests MAY be configured on the client and server sides.' - Basic TLS is enabled if the URL scheme requires it (for example 'https'). The 'username@password' part of `url` is ignored. displayName: Destination URL @@ -1549,25 +1455,18 @@ spec: - description: |- Index is the index for the logs. This supports template syntax to allow dynamic per-event values. - The Index can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} displayName: Index path: outputs[0].splunk.index @@ -1606,36 +1505,25 @@ spec: syslog protocol displayName: Syslog Output path: outputs[0].syslog - - description: |- + - description: | AppName is APP-NAME part of the syslog-msg header. - AppName needs to be specified if using rfc5424. The maximum length of the final values is truncated to 48 This supports template syntax to allow dynamic per-event values. - The AppName can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} - - - TODO: DETERMIN HOW to default the app name that isnt based on fluentd assumptions of "tag" when this is empty displayName: App Name path: outputs[0].syslog.appName x-descriptors: @@ -1643,7 +1531,6 @@ spec: - description: |- Enrichment is an additional modification to the log message before forwarding it to the receiver. - Supported values are: 1. None - Adds no additional enrichment to the record @@ -1657,30 +1544,23 @@ spec: - description: |- Facility to set on outgoing syslog records. - Facility values are defined in https://tools.ietf.org/html/rfc5424#section-6.2.1. - The value can be a decimal integer. Facility keywords are not standardized, this API recognizes at least the following case-insensitive keywords (defined by https://en.wikipedia.org/wiki/Syslog#Facility_Levels): - kernel user mail daemon auth syslog lpr news uucp cron authpriv ftp ntp security console solaris-cron local0 local1 local2 local3 local4 local5 local6 local7 - The Facility can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. {.foo||"user"} displayName: Facility path: outputs[0].syslog.facility @@ -1689,28 +1569,20 @@ spec: - description: |- MsgId is MSGID part of the syslog-msg header. This supports template syntax to allow dynamic per-event values. - The MsgId can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} - MsgId needs to be specified if using rfc5424. The maximum length of the final values is truncated to 32 displayName: MSGID path: outputs[0].syslog.msgId @@ -1719,25 +1591,18 @@ spec: - description: |- PayloadKey specifies record field to use as payload. This supports template syntax to allow dynamic per-event values. - The PayloadKey must be a single field path encased in single curly brackets `{}`. - Field paths must only contain alphanumeric and underscores. Any field with other characters must be quoted. - If left empty, Syslog will use the whole message as the payload key - Example: - 1. {.bar} - 2. {.foo.bar.baz} - 3. {.foo.bar."baz/with/slashes"} displayName: Payload Key path: outputs[0].syslog.payloadKey @@ -1746,28 +1611,20 @@ spec: - description: |- ProcId is PROCID part of the syslog-msg header. This supports template syntax to allow dynamic per-event values. - The ProcId can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} - ProcId needs to be specified if using rfc5424. The maximum length of the final values is truncated to 128 displayName: PROCID path: outputs[0].syslog.procId @@ -1776,7 +1633,6 @@ spec: - description: |- The RFC to which the generated messages conform to. - Supported values are: 1. RFC3164 2. RFC5424 @@ -1785,26 +1641,19 @@ spec: - description: |- Severity to set on outgoing syslog records. - Severity values are defined in https://tools.ietf.org/html/rfc5424#section-6.2.1 - The value can be a decimal integer or one of these case-insensitive keywords: - Emergency Alert Critical Error Warning Notice Informational Debug - The Severity can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. {.foo||"Error"} displayName: Severity path: outputs[0].syslog.severity @@ -1872,7 +1721,6 @@ spec: - description: |- If InsecureSkipVerify is true, then the TLS client will be configured to skip validating server certificates. - This option is *not* recommended for production configurations. displayName: Skip Certificate Validation path: outputs[0].tls.insecureSkipVerify @@ -1921,7 +1769,6 @@ spec: - description: |- Filters lists the names of filters to be applied to records going through this pipeline. - Each filter is applied in order. If a filter drops a records, subsequent filters are not applied. displayName: Filters @@ -1929,16 +1776,12 @@ spec: - description: |- InputRefs lists the names (`input.name`) of inputs to this pipeline. - The following built-in input names are always available: - - `application` selects all logs from application pods. - - `infrastructure` selects logs from openshift and kubernetes pods and some node logs. - - `audit` selects node logs related to security audits. displayName: Inputs path: pipelines[0].inputRefs diff --git a/bundle/manifests/observability.openshift.io_clusterlogforwarders.yaml b/bundle/manifests/observability.openshift.io_clusterlogforwarders.yaml index 24472aab04..6d9c1c6a93 100644 --- a/bundle/manifests/observability.openshift.io_clusterlogforwarders.yaml +++ b/bundle/manifests/observability.openshift.io_clusterlogforwarders.yaml @@ -113,6 +113,14 @@ spec: More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object + terminationGracePeriodSeconds: + description: |- + TerminationGracePeriodSeconds defines the termination grace period for collector pods + in seconds. If not specified, the default is 10 seconds. + format: int64 + minimum: 1 + nullable: true + type: integer tolerations: description: Define the tolerations the collector pods will accept items: diff --git a/config/crd/bases/observability.openshift.io_clusterlogforwarders.yaml b/config/crd/bases/observability.openshift.io_clusterlogforwarders.yaml index 2916180b32..8a40cd653b 100644 --- a/config/crd/bases/observability.openshift.io_clusterlogforwarders.yaml +++ b/config/crd/bases/observability.openshift.io_clusterlogforwarders.yaml @@ -113,6 +113,14 @@ spec: More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object + terminationGracePeriodSeconds: + description: |- + TerminationGracePeriodSeconds defines the termination grace period for collector pods + in seconds. If not specified, the default is 10 seconds. + format: int64 + minimum: 1 + nullable: true + type: integer tolerations: description: Define the tolerations the collector pods will accept items: diff --git a/config/manifests/bases/cluster-logging.clusterserviceversion.yaml b/config/manifests/bases/cluster-logging.clusterserviceversion.yaml index a2d6b4730b..e126b39a59 100644 --- a/config/manifests/bases/cluster-logging.clusterserviceversion.yaml +++ b/config/manifests/bases/cluster-logging.clusterserviceversion.yaml @@ -51,7 +51,6 @@ spec: - description: |- ClusterLogForwarder is an API to configure forwarding logs. - You configure forwarding by specifying a list of `pipelines`, which forward from a set of named inputs to a set of named outputs. displayName: Cluster Log Forwarder @@ -73,6 +72,13 @@ spec: path: collector.resources x-descriptors: - urn:alm:descriptor:com.tectonic.ui:resourceRequirements + - description: |- + TerminationGracePeriodSeconds defines the termination grace period for collector pods + in seconds. If not specified, the default is 10 seconds. + displayName: Termination Grace Period Seconds + path: collector.terminationGracePeriodSeconds + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:number - description: Define the tolerations the collector pods will accept displayName: Tolerations path: collector.tolerations @@ -128,78 +134,56 @@ spec: - description: |- `In` is an array of dot-delimited field paths. Fields included here are removed from the log record. - Each field path expression must start with a "." - The path can contain alphanumeric characters and underscores (a-zA-Z0-9_). - If segments contain characters outside of this range, the segment must be quoted otherwise paths do NOT need to be quoted. - Examples: - - `.kubernetes.namespace_name` - - `.log_type` - - '.kubernetes.labels.foobar' - - `.kubernetes.labels."foo-bar/baz"` - NOTE1: `In` CANNOT contain `.log_type` or `.message` as those fields are required and cannot be pruned. - NOTE2: If this filter is used in a pipeline with GoogleCloudLogging, `.hostname` CANNOT be added to this list as it is a required field. displayName: Fields to be dropped path: filters[0].prune.in - description: |- `NotIn` is an array of dot-delimited field paths. All fields besides the ones listed here are removed from the log record. - Each field path expression must start with a "." - The path can contain alphanumeric characters and underscores (a-zA-Z0-9_). - If segments contain characters outside of this range, the segment must be quoted otherwise paths do NOT need to be quoted. - Examples: - - `.kubernetes.namespace_name` - - `.log_type` - - '.kubernetes.labels.foobar' - - `.kubernetes.labels."foo-bar/baz"` - NOTE1: `NotIn` MUST contain `.log_type` and `.message` as those fields are required and cannot be pruned. - NOTE2: If this filter is used in a pipeline with GoogleCloudLogging, `.hostname` MUST be added to this list as it is a required field. displayName: Fields to be kept path: filters[0].prune.notIn - description: |- Type of filter. - Possible filter types are: - 1. detectMultilineException - Enables multi-line error detection of container logs. No additional configuration required. 2. drop - Drop whole log records based on the evaluation of a set of regex tests. See field `drop` for configuration. 3. kubeAPIAudit - Remove unwanted audit events and reduce event size to create a manageable audit trail. See field `kubeAPIaudit` for configuration. @@ -211,7 +195,6 @@ spec: - description: |- Inputs are named filters for log messages to be forwarded. - There are three built-in inputs named `application`, `infrastructure` and `audit`. You don't need to define inputs here if those are sufficient for your needs. See `inputRefs` for more. @@ -225,7 +208,6 @@ spec: - description: |- Excludes is the set of namespaces and containers to ignore when collecting logs. - Takes precedence over Includes option. displayName: Exclude path: inputs[0].application.excludes @@ -246,7 +228,6 @@ spec: - description: |- Includes is the set of namespaces and containers to include when collecting logs. - Note: infrastructure namespaces are still excluded for "*" values unless a qualifying glob pattern is specified. displayName: Include path: inputs[0].application.includes @@ -267,10 +248,8 @@ spec: - description: |- Selector for logs from pods with matching labels. - Only messages from pods with these labels are collected. - If absent or empty, logs are collected regardless of labels. displayName: Pod Selector path: inputs[0].application.selector @@ -357,7 +336,6 @@ spec: - description: |- TLS contains settings for controlling options of TLS connections. - The operator will request certificates from the cluster's cert signing service when TLS is not defined. The certificates are injected into a secret named "-" which is mounted into the collector. The collector is configured to use the public and private key provided by the service @@ -533,25 +511,18 @@ spec: - description: |- GroupName defines the strategy for grouping logstreams - The GroupName can be a combination of static and dynamic values consisting of field paths followed by "\|\|" followed by another field path or a static value. - A dynamic value is encased in single curly brackets "{}" and MUST end with a static fallback value separated with "\|\|". - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar\|\|"none"} - 2. {.foo\|\|.bar\|\|"missing"} - 3. foo.{.bar.baz\|\|.qux.quux.corge\|\|.grault\|\|"nil"}-waldo.fred{.plugh\|\|"none"} displayName: Group Name path: outputs[0].cloudwatch.groupName @@ -586,7 +557,6 @@ spec: - description: |- URL to send log records to. - The 'username@password' part of `url` is ignored. displayName: Destination URL path: outputs[0].cloudwatch.url @@ -651,30 +621,22 @@ spec: - description: |- Index is the index for the logs. This supports template syntax to allow dynamic per-event values. - The Index can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - When forwarding logs to the Red Hat Managed Elasticsearch, the index must match the pattern ^(app|infra|audit)-write$ where the prefix depends upon the log_type. This requires defining a distinct output for each log type or distinct pipelines with the openshiftLabels filter. See the product documentation for examples. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} displayName: Log Index path: outputs[0].elasticsearch.index @@ -751,25 +713,18 @@ spec: - description: |- LogId is the log ID to which to publish logs. This identifies log stream. - The LogId can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} displayName: Log Stream ID path: outputs[0].googleCloudLogging.logId @@ -934,7 +889,6 @@ spec: - description: |- Brokers specifies the list of broker endpoints of a Kafka cluster. - The list represents only the initial set used by the collector's Kafka client for the first connection only. The collector's Kafka client fetches constantly an updated list from Kafka. These updates are not reconciled back to the collector configuration. @@ -945,25 +899,18 @@ spec: - description: |- Topic specifies the target topic to send logs to. The value when not specified is 'topic' - The Topic can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} displayName: Kafka Topic path: outputs[0].kafka.topic @@ -1048,46 +995,33 @@ spec: - description: |- LabelKeys can be used to customize which log record keys are mapped to Loki stream labels. - If LabelKeys is not set, the default keys are: - - log_type - - kubernetes.container_name - - kubernetes.namespace_name - - kubernetes.pod_name - One additional label "kubernetes_host" is not part of the label keys configuration. It contains the hostname where the collector is running and is always present. - Note: Loki label names must match the regular expression "[a-zA-Z_:][a-zA-Z0-9_:]*" Log record keys may contain characters like "." and "/" that are not allowed in Loki labels. Log record keys are translated to Loki labels by replacing any illegal characters with '_'. - For example the default log record keys translate to these Loki labels: - - log_type - - kubernetes_container_name - - kubernetes_namespace_name - - kubernetes_pod_name - Note: the set of labels should be small, Loki imposes limits on the size and number of labels allowed. See https://grafana.com/docs/loki/latest/configuration/#limits_config for more. Loki queries can also query based on any log record field (not just labels) using query filters. @@ -1096,25 +1030,18 @@ spec: - description: |- TenantKey is the tenant for the logs. This supports vector's template syntax to allow dynamic per-event values. - The TenantKey can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} displayName: Tenant Key path: outputs[0].loki.tenantKey @@ -1181,41 +1108,31 @@ spec: - description: |- DataModel can be used to customize how log data is stored in LokiStack. - There are two different models to choose from: - - Viaq - Otel - When the data model is not set, it currently defaults to the "Viaq" data model. displayName: Data Model path: outputs[0].lokiStack.dataModel - description: |- LabelKeys can be used to customize which log record keys are mapped to Loki stream labels. - Note: Loki label names must match the regular expression "[a-zA-Z_:][a-zA-Z0-9_:]*" Log record keys may contain characters like "." and "/" that are not allowed in Loki labels. Log record keys are translated to Loki labels by replacing any illegal characters with '_'. - For example the default log record keys translate to these Loki labels: - - log_type - - kubernetes_container_name - - kubernetes_namespace_name - - kubernetes_pod_name - Note: the set of labels should be small, Loki imposes limits on the size and number of labels allowed. See https://grafana.com/docs/loki/latest/configuration/#limits_config for more. Loki queries can also query based on any log record field (not just labels) using query filters. @@ -1235,7 +1152,6 @@ spec: - description: |- LabelKeys contains a list of log record keys that are mapped to Loki stream labels. - By default, this list is combined with the labels specified in the Global configuration. This behavior can be changed by setting IgnoreGlobal to true. displayName: Label Keys @@ -1253,7 +1169,6 @@ spec: - description: |- LabelKeys contains a list of log record keys that are mapped to Loki stream labels. - By default, this list is combined with the labels specified in the Global configuration. This behavior can be changed by setting IgnoreGlobal to true. displayName: Label Keys @@ -1261,22 +1176,16 @@ spec: - description: |- Global contains a list of record keys which are used for all tenants. - If LabelKeys is not set, the default keys are: - - log_type - - kubernetes.container_name - - kubernetes.namespace_name - - kubernetes.pod_name - One additional label "kubernetes_host" is not part of the label keys configuration. It contains the hostname where the collector is running and is always present. displayName: Global Configuration @@ -1295,7 +1204,6 @@ spec: - description: |- LabelKeys contains a list of log record keys that are mapped to Loki stream labels. - By default, this list is combined with the labels specified in the Global configuration. This behavior can be changed by setting IgnoreGlobal to true. displayName: Label Keys @@ -1422,11 +1330,9 @@ spec: - description: |- URL to send log records to. - An absolute URL, with a valid http scheme. The OTLP spec recommends it terminate with `/v1/logs` but that 'Non-default URL paths for requests MAY be configured on the client and server sides.' - Basic TLS is enabled if the URL scheme requires it (for example 'https'). The 'username@password' part of `url` is ignored. displayName: Destination URL @@ -1472,25 +1378,18 @@ spec: - description: |- Index is the index for the logs. This supports template syntax to allow dynamic per-event values. - The Index can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} displayName: Index path: outputs[0].splunk.index @@ -1529,36 +1428,25 @@ spec: syslog protocol displayName: Syslog Output path: outputs[0].syslog - - description: |- + - description: | AppName is APP-NAME part of the syslog-msg header. - AppName needs to be specified if using rfc5424. The maximum length of the final values is truncated to 48 This supports template syntax to allow dynamic per-event values. - The AppName can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} - - - TODO: DETERMIN HOW to default the app name that isnt based on fluentd assumptions of "tag" when this is empty displayName: App Name path: outputs[0].syslog.appName x-descriptors: @@ -1566,7 +1454,6 @@ spec: - description: |- Enrichment is an additional modification to the log message before forwarding it to the receiver. - Supported values are: 1. None - Adds no additional enrichment to the record @@ -1580,30 +1467,23 @@ spec: - description: |- Facility to set on outgoing syslog records. - Facility values are defined in https://tools.ietf.org/html/rfc5424#section-6.2.1. - The value can be a decimal integer. Facility keywords are not standardized, this API recognizes at least the following case-insensitive keywords (defined by https://en.wikipedia.org/wiki/Syslog#Facility_Levels): - kernel user mail daemon auth syslog lpr news uucp cron authpriv ftp ntp security console solaris-cron local0 local1 local2 local3 local4 local5 local6 local7 - The Facility can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. {.foo||"user"} displayName: Facility path: outputs[0].syslog.facility @@ -1612,28 +1492,20 @@ spec: - description: |- MsgId is MSGID part of the syslog-msg header. This supports template syntax to allow dynamic per-event values. - The MsgId can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} - MsgId needs to be specified if using rfc5424. The maximum length of the final values is truncated to 32 displayName: MSGID path: outputs[0].syslog.msgId @@ -1642,25 +1514,18 @@ spec: - description: |- PayloadKey specifies record field to use as payload. This supports template syntax to allow dynamic per-event values. - The PayloadKey must be a single field path encased in single curly brackets `{}`. - Field paths must only contain alphanumeric and underscores. Any field with other characters must be quoted. - If left empty, Syslog will use the whole message as the payload key - Example: - 1. {.bar} - 2. {.foo.bar.baz} - 3. {.foo.bar."baz/with/slashes"} displayName: Payload Key path: outputs[0].syslog.payloadKey @@ -1669,28 +1534,20 @@ spec: - description: |- ProcId is PROCID part of the syslog-msg header. This supports template syntax to allow dynamic per-event values. - The ProcId can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. - A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. foo-{.bar||"none"} - 2. {.foo||.bar||"missing"} - 3. foo.{.bar.baz||.qux.quux.corge||.grault||"nil"}-waldo.fred{.plugh||"none"} - ProcId needs to be specified if using rfc5424. The maximum length of the final values is truncated to 128 displayName: PROCID path: outputs[0].syslog.procId @@ -1699,7 +1556,6 @@ spec: - description: |- The RFC to which the generated messages conform to. - Supported values are: 1. RFC3164 2. RFC5424 @@ -1708,26 +1564,19 @@ spec: - description: |- Severity to set on outgoing syslog records. - Severity values are defined in https://tools.ietf.org/html/rfc5424#section-6.2.1 - The value can be a decimal integer or one of these case-insensitive keywords: - Emergency Alert Critical Error Warning Notice Informational Debug - The Severity can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value. A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`. - Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes. - Example: - 1. {.foo||"Error"} displayName: Severity path: outputs[0].syslog.severity @@ -1795,7 +1644,6 @@ spec: - description: |- If InsecureSkipVerify is true, then the TLS client will be configured to skip validating server certificates. - This option is *not* recommended for production configurations. displayName: Skip Certificate Validation path: outputs[0].tls.insecureSkipVerify @@ -1844,7 +1692,6 @@ spec: - description: |- Filters lists the names of filters to be applied to records going through this pipeline. - Each filter is applied in order. If a filter drops a records, subsequent filters are not applied. displayName: Filters @@ -1852,16 +1699,12 @@ spec: - description: |- InputRefs lists the names (`input.name`) of inputs to this pipeline. - The following built-in input names are always available: - - `application` selects all logs from application pods. - - `infrastructure` selects logs from openshift and kubernetes pods and some node logs. - - `audit` selects node logs related to security audits. displayName: Inputs path: pipelines[0].inputRefs diff --git a/docs/reference/operator/api_observability_v1.adoc b/docs/reference/operator/api_observability_v1.adoc index 2379ae4cd2..807d484ab4 100644 --- a/docs/reference/operator/api_observability_v1.adoc +++ b/docs/reference/operator/api_observability_v1.adoc @@ -77,6 +77,9 @@ Type:: object |resources|object| The resource requirements for the collector +|terminationGracePeriodSeconds|int| TerminationGracePeriodSeconds defines the termination grace period for collector pods +in seconds. If not specified, the default is 10 seconds. + |tolerations|array| Define the tolerations the collector pods will accept |====================== @@ -130,6 +133,10 @@ Type:: object Type:: object +=== .spec.collector.terminationGracePeriodSeconds + +Type:: int + === .spec.collector.tolerations[] Type:: array diff --git a/internal/collector/collector.go b/internal/collector/collector.go index 7bb1208214..1c407a0f77 100644 --- a/internal/collector/collector.go +++ b/internal/collector/collector.go @@ -21,32 +21,33 @@ import ( ) const ( - defaultAudience = "openshift" - clusterLoggingPriorityClassName = "system-node-critical" - MetricsPort = int32(24231) - MetricsPortName = "metrics" - metricsVolumeName = "metrics" - metricsVolumePath = "/etc/collector/metrics" - saTokenVolumeName = "sa-token" - saTokenExpirationSecs = 3600 //1 hour - sourcePodsName = "varlogpods" - sourcePodsPath = "/var/log/pods" - sourceJournalName = "varlogjournal" - sourceJournalPath = "/var/log/journal" - sourceAuditdName = "varlogaudit" - sourceAuditdPath = "/var/log/audit" - sourceAuditOVNName = "varlogovn" - sourceOVNPath = "/var/log/ovn" - sourceOAuthServerName = "varlogoauthserver" - sourceOAuthServerPath = "/var/log/oauth-server" - sourceOAuthAPIServerName = "varlogoauthapiserver" - sourceOAuthAPIServerPath = "/var/log/oauth-apiserver" - sourceOpenshiftAPIServerName = "varlogopenshiftapiserver" - sourceOpenshiftAPIServerPath = "/var/log/openshift-apiserver" - sourceKubeAPIServerName = "varlogkubeapiserver" - sourceKubeAPIServerPath = "/var/log/kube-apiserver" - tmpVolumeName = "tmp" - tmpPath = "/tmp" + defaultAudience = "openshift" + clusterLoggingPriorityClassName = "system-node-critical" + MetricsPort = int32(24231) + MetricsPortName = "metrics" + metricsVolumeName = "metrics" + metricsVolumePath = "/etc/collector/metrics" + saTokenVolumeName = "sa-token" + saTokenExpirationSecs = 3600 //1 hour + defaultTerminationGracePeriodSeconds int64 = 10 + sourcePodsName = "varlogpods" + sourcePodsPath = "/var/log/pods" + sourceJournalName = "varlogjournal" + sourceJournalPath = "/var/log/journal" + sourceAuditdName = "varlogaudit" + sourceAuditdPath = "/var/log/audit" + sourceAuditOVNName = "varlogovn" + sourceOVNPath = "/var/log/ovn" + sourceOAuthServerName = "varlogoauthserver" + sourceOAuthServerPath = "/var/log/oauth-server" + sourceOAuthAPIServerName = "varlogoauthapiserver" + sourceOAuthAPIServerPath = "/var/log/oauth-apiserver" + sourceOpenshiftAPIServerName = "varlogopenshiftapiserver" + sourceOpenshiftAPIServerPath = "/var/log/openshift-apiserver" + sourceKubeAPIServerName = "varlogkubeapiserver" + sourceKubeAPIServerPath = "/var/log/kube-apiserver" + tmpVolumeName = "tmp" + tmpPath = "/tmp" ) type Visitor func(collector *v1.Container, podSpec *v1.PodSpec, resNames *factory.ForwarderResourceNames, namespace, logLevel string) @@ -128,11 +129,18 @@ func (f *Factory) NewDeployment(namespace, name string, trustedCABundle *v1.Conf func (f *Factory) NewPodSpec(trustedCABundle *v1.ConfigMap, spec obs.ClusterLogForwarderSpec, clusterID string, tlsProfileSpec configv1.TLSProfileSpec, namespace string) *v1.PodSpec { + var gracePeriod *int64 + if f.CollectorSpec.TerminationGracePeriodSeconds != nil { + gracePeriod = f.CollectorSpec.TerminationGracePeriodSeconds + } else { + gracePeriod = utils.GetPtr(defaultTerminationGracePeriodSeconds) + } + podSpec := &v1.PodSpec{ NodeSelector: utils.EnsureLinuxNodeSelector(f.NodeSelector()), PriorityClassName: clusterLoggingPriorityClassName, ServiceAccountName: f.ResourceNames.ServiceAccount, - TerminationGracePeriodSeconds: utils.GetPtr[int64](10), + TerminationGracePeriodSeconds: gracePeriod, Tolerations: append(constants.DefaultTolerations(), f.Tolerations()...), Volumes: []v1.Volume{ {Name: metricsVolumeName, VolumeSource: v1.VolumeSource{Secret: &v1.SecretVolumeSource{SecretName: f.ResourceNames.SecretMetrics}}}, diff --git a/internal/collector/collector_test.go b/internal/collector/collector_test.go index 8138ad9123..b64e25c910 100644 --- a/internal/collector/collector_test.go +++ b/internal/collector/collector_test.go @@ -134,6 +134,20 @@ var _ = Describe("Factory#Daemonset", func() { Describe("when creating the podSpec", func() { + Context("and evaluating terminationGracePeriodSeconds", func() { + It("should default to 10 when not specified", func() { + Expect(*podSpec.TerminationGracePeriodSeconds).To(Equal(int64(10))) + }) + + It("should use spec value when specified", func() { + factory.CollectorSpec = obs.CollectorSpec{ + TerminationGracePeriodSeconds: utils.GetPtr[int64](60), + } + podSpec = *factory.NewPodSpec(nil, obs.ClusterLogForwarderSpec{}, "1234", tls.GetClusterTLSProfileSpec(nil), constants.OpenshiftNS) + Expect(*podSpec.TerminationGracePeriodSeconds).To(Equal(int64(60))) + }) + }) + Context("and evaluating tolerations", func() { It("should add only defaults when none are defined", func() { Expect(podSpec.Tolerations).To(Equal(constants.DefaultTolerations())) @@ -411,6 +425,20 @@ var _ = Describe("Factory#Deployment", func() { Describe("when creating the podSpec", func() { + Context("and evaluating terminationGracePeriodSeconds", func() { + It("should default to 10 when not specified", func() { + Expect(*podSpec.TerminationGracePeriodSeconds).To(Equal(int64(10))) + }) + + It("should use spec value when specified", func() { + factory.CollectorSpec = obs.CollectorSpec{ + TerminationGracePeriodSeconds: utils.GetPtr[int64](60), + } + podSpec = *factory.NewPodSpec(nil, obs.ClusterLogForwarderSpec{}, "1234", tls.GetClusterTLSProfileSpec(nil), constants.OpenshiftNS) + Expect(*podSpec.TerminationGracePeriodSeconds).To(Equal(int64(60))) + }) + }) + Context("and mounting volumes", func() { It("should not mount host path or sa token volumes", func() { Expect(podSpec.Volumes).NotTo(ContainElement(v1.Volume{Name: saTokenVolumeName, VolumeSource: v1.VolumeSource{Projected: &v1.ProjectedVolumeSource{Sources: []v1.VolumeProjection{saToken}}}}))