Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions api/observability/v1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ const (
// ConditionTypeMaxUnavailable validates the value of the max-unavailable-rollout annotation
ConditionTypeMaxUnavailable = GroupName + "/MaxUnavailableAnnotation"

// ConditionTypeUseKubeCache validates the value of the use-apiserver-cache annotation
ConditionTypeUseKubeCache = GroupName + "/UseKubeCacheAnnotation"

// ConditionTypeReady indicates the service is ready.
//
// Ready=True means the operands are running and providing some service.
Expand Down
2 changes: 1 addition & 1 deletion api/observability/v1/output_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ type Kafka struct {
Brokers []BrokerURL `json:"brokers,omitempty"`
}

// +kubebuilder:validation:XValidation:rule="self == '' || (isURL(self) && (self.startsWith('tcp://') || self.startsWith('tls://')))",message="each broker must be a valid URL with a tcp or tls scheme"
// +kubebuilder:validation:XValidation:rule="isURL(self) && (self.startsWith('tcp://') || self.startsWith('tls://'))",message="each broker must be a valid URL with a tcp or tls scheme"
type BrokerURL string

type LokiTuningSpec struct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
name: cluster-logging-operator
name: cluster-logging-operator-metrics
Expand All @@ -14,3 +15,5 @@ spec:
name: cluster-logging-operator
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ spec:
groups:
- name: logging_collector.alerts
rules:
- alert: ClusterLogForwarderDeprecations
annotations:
message: The Cluster Logging Operator version {{$labels.version}} includes
deprecations to some feature of ClusterLogForwarder.
summary: |-
The Cluster Logging Operator version {{$labels.version}} includes deprecations to some features of ClusterLogForwarder which
will be removed in a future release. Please see the release notes for details:
https://docs.redhat.com/en/documentation/red_hat_openshift_logging/6.3/html/release_notes
expr: |
max by (version) (csv_succeeded{exported_namespace="openshift-logging", name=~"cluster-logging.*", version=~"6.3.*"}) > 0
for: 1m
labels:
namespace: openshift-logging
service: collector
severity: info
- alert: CollectorNodeDown
annotations:
description: Prometheus could not scrape {{ $labels.namespace }}/{{ $labels.pod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2533,8 +2533,7 @@ spec:
x-kubernetes-validations:
- message: each broker must be a valid URL with a tcp
or tls scheme
rule: self == '' || (isURL(self) && (self.startsWith('tcp://')
|| self.startsWith('tls://')))
rule: isURL(self) && (self.startsWith('tcp://') || self.startsWith('tls://'))
type: array
topic:
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2533,8 +2533,7 @@ spec:
x-kubernetes-validations:
- message: each broker must be a valid URL with a tcp
or tls scheme
rule: self == '' || (isURL(self) && (self.startsWith('tcp://')
|| self.startsWith('tls://')))
rule: isURL(self) && (self.startsWith('tcp://') || self.startsWith('tls://'))
type: array
topic:
description: |-
Expand Down
14 changes: 14 additions & 0 deletions config/prometheus/collector_alerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ spec:
groups:
- name: logging_collector.alerts
rules:
- alert: ClusterLogForwarderDeprecations
annotations:
message: "The Cluster Logging Operator version {{$labels.version}} includes deprecations to some feature of ClusterLogForwarder."
summary: |-
The Cluster Logging Operator version {{$labels.version}} includes deprecations to some features of ClusterLogForwarder which
will be removed in a future release. Please see the release notes for details:
https://docs.redhat.com/en/documentation/red_hat_openshift_logging/6.3/html/release_notes
expr: |
max by (version) (csv_succeeded{exported_namespace="openshift-logging", name=~"cluster-logging.*", version=~"6.3.*"}) > 0
for: 1m
labels:
namespace: openshift-logging
service: collector
severity: info
- alert: CollectorNodeDown
annotations:
description: "Prometheus could not scrape {{ $labels.namespace }}/{{ $labels.pod }} collector component for more than 10m."
Expand Down
3 changes: 1 addition & 2 deletions internal/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (f *Factory) Affinity() *v1.Affinity {
return f.CollectorSpec.Affinity
}

func New(confHash, clusterID string, collectorSpec *obs.CollectorSpec, secrets internalobs.Secrets, configMaps map[string]*v1.ConfigMap, forwarderSpec obs.ClusterLogForwarderSpec, resNames *factory.ForwarderResourceNames, isDaemonset bool, logLevel string, useCache bool, maxUnavailable string) *Factory {
func New(confHash, clusterID string, collectorSpec *obs.CollectorSpec, secrets internalobs.Secrets, configMaps map[string]*v1.ConfigMap, forwarderSpec obs.ClusterLogForwarderSpec, resNames *factory.ForwarderResourceNames, isDaemonset bool, logLevel string, maxUnavailable string) *Factory {
if collectorSpec == nil {
collectorSpec = &obs.CollectorSpec{}
}
Expand All @@ -111,7 +111,6 @@ func New(confHash, clusterID string, collectorSpec *obs.CollectorSpec, secrets i
PodLabelVisitor: vector.PodLogExcludeLabel,
isDaemonset: isDaemonset,
LogLevel: logLevel,
UseKubeCache: useCache,
MaxUnavailable: maxUnavailable,
}
return factory
Expand Down
11 changes: 1 addition & 10 deletions internal/constants/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@ const (

AnnotationSecretHash = "observability.openshift.io/secret-hash"

// AnnotationKubeCache is used to enable caching for requests to the kube-apiserver using vector kubernetes_logs source.
// Tech-Preview feature
//
// While enabling cache can significantly reduce Kubernetes control plane
// memory pressure, the trade-off is a chance of receiving stale data.
AnnotationKubeCache = "observability.openshift.io/use-apiserver-cache"

// AnnotationMaxUnavailable configures the maximum number of DaemonSet pods that can be unavailable during a rolling update.
// Tech-Preview feature
//
// AnnotationMaxUnavailable (Deprecated) configures the maximum number of DaemonSet pods that can be unavailable during a rolling update.
// This can be an absolute number (e.g., 1) or a percentage (e.g., 10%). Default is 100%.
AnnotationMaxUnavailable = "observability.openshift.io/max-unavailable-rollout"
)
19 changes: 1 addition & 18 deletions internal/controller/observability/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ func ReconcileCollector(context internalcontext.ForwarderContext, pollInterval,
options = context.AdditionalContext
}

// Set kubeapi and rollout options based on annotation (LOG-7196)
// TODO: replace with API fields
SetKubeCacheOption(context.Forwarder.Annotations, options)
// Set rollout options based on annotation (LOG-7196)
SetMaxUnavailableRolloutOption(context.Forwarder.Annotations, options)

if internalobs.Outputs(context.Forwarder.Spec.Outputs).NeedServiceAccountToken() {
Expand Down Expand Up @@ -115,7 +113,6 @@ func ReconcileCollector(context internalcontext.ForwarderContext, pollInterval,
resourceNames,
isDaemonSet,
LogLevel(context.Forwarder.Annotations),
factory.IncludesKubeCacheOption(options),
factory.GetMaxUnavailableValue(options),
)

Expand Down Expand Up @@ -180,11 +177,6 @@ func EvaluateAnnotationsForEnabledCapabilities(annotations map[string]string, op
if strings.ToLower(value) == "true" {
options[generatorhelpers.EnableDebugOutput] = "true"
}
case constants.AnnotationKubeCache:
// Matching the validate_annotations logic
if observability.IsEnabledValue(value) {
options[framework.UseKubeCacheOption] = "true"
}
case constants.AnnotationMaxUnavailable:
// Matching the validate_annotations logic
if observability.IsPercentOrWholeNumber(value) {
Expand All @@ -201,15 +193,6 @@ func LogLevel(annotations map[string]string) string {
return "warn"
}

func SetKubeCacheOption(annotations map[string]string, options framework.Options) {
if value, found := annotations[constants.AnnotationKubeCache]; found {
if observability.IsEnabledValue(value) {
log.V(3).Info("Kube cache annotation found")
options[framework.UseKubeCacheOption] = "true"
}
}
}

func SetMaxUnavailableRolloutOption(annotations map[string]string, options framework.Options) {
if value, found := annotations[constants.AnnotationMaxUnavailable]; found {
if observability.IsPercentOrWholeNumber(value) {
Expand Down
5 changes: 0 additions & 5 deletions internal/controller/observability/collector_features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ var _ = Describe("#EvaluateAnnotationsForEnabledCapabilities", func() {
Entry("enables debug for True", helpers.EnableDebugOutput, "true", AnnotationDebugOutput, "True"),
Entry("disables debug for anything else", "", "", AnnotationDebugOutput, "abcdef"),

Entry("enables kube-cache for true", framework.UseKubeCacheOption, "true", AnnotationKubeCache, "true"),
Entry("enables kube-cache for True", framework.UseKubeCacheOption, "true", AnnotationKubeCache, "True"),
Entry("enables kube-cache for enabled", framework.UseKubeCacheOption, "true", AnnotationKubeCache, "enabled"),
Entry("disables kube-cache for anything else", "", "", AnnotationKubeCache, "bubbles"),

Entry("enables max-unavailable for value '10'", framework.MaxUnavailableOption, "10", AnnotationMaxUnavailable, "10"),
Entry("enables max-unavailable for value '99%'", framework.MaxUnavailableOption, "99%", AnnotationMaxUnavailable, "99%"),
Entry("disables max-unavailable option for anything not a number or percentage", "", "", AnnotationMaxUnavailable, "fluffy"),
Expand Down
13 changes: 0 additions & 13 deletions internal/factory/options.go

This file was deleted.

1 change: 0 additions & 1 deletion internal/generator/framework/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const (
URL = "url"
OptionServiceAccountTokenSecretName = "serviceAccountTokenSecretName"
OptionForwarderName = "forwarderName"
UseKubeCacheOption = "useKubeCache"
MaxUnavailableOption = "maxUnavailableRollout"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/generator/vector/conf/complex.toml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_infrastructure_container_meta]
type = "remap"
Expand Down Expand Up @@ -420,7 +420,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_mytestapp_container_meta]
type = "remap"
Expand Down
4 changes: 2 additions & 2 deletions internal/generator/vector/conf/complex_http_receiver.toml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_infrastructure_container_meta]
type = "remap"
Expand Down Expand Up @@ -457,7 +457,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_mytestapp_container_meta]
type = "remap"
Expand Down
45 changes: 1 addition & 44 deletions internal/generator/vector/conf/conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package conf
import (
_ "embed"
"fmt"

obs "github.com/openshift/cluster-logging-operator/api/observability/v1"

"github.com/openshift/cluster-logging-operator/internal/factory"
Expand Down Expand Up @@ -69,50 +70,6 @@ var _ = Describe("Testing Complete Config Generation", func() {
conf := Conf(secrets, spec, constants.OpenshiftNS, "my-forwarder", factory.ForwarderResourceNames{CommonName: constants.CollectorName}, op)
Expect(string(exp)).To(EqualConfigFrom(conf))
},
Entry("with spec for containers and kube-cache enabled",
"container.toml",
framework.Options{framework.UseKubeCacheOption: "true"},
obs.ClusterLogForwarderSpec{
Inputs: []obs.InputSpec{
{
Name: "mytestapp",
Type: obs.InputTypeApplication,
Application: &obs.Application{
Includes: []obs.NamespaceContainerSpec{
{Namespace: "test-ns"},
},
},
},
{
Name: "myinfra",
Type: obs.InputTypeInfrastructure,
Infrastructure: &obs.Infrastructure{
Sources: []obs.InfrastructureSource{obs.InfrastructureSourceContainer},
},
},
},
Pipelines: []obs.PipelineSpec{
{
InputRefs: []string{
"myinfra",
"mytestapp",
},
OutputRefs: []string{outputName},
Name: "mypipeline",
FilterRefs: []string{"my-labels"},
},
},
Outputs: []obs.OutputSpec{
kafkaOutput,
},
Filters: []obs.FilterSpec{
{
Name: "my-labels",
Type: obs.FilterTypeOpenshiftLabels,
OpenshiftLabels: map[string]string{"key1": "value1", "key2": "value2"},
},
},
}),
Entry("with complex spec",
"complex.toml",
nil,
Expand Down
2 changes: 1 addition & 1 deletion internal/generator/vector/input/application.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_application_container_meta]
type = "remap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_my_app_container_meta]
type = "remap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_my_app_container_meta]
type = "remap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_my_app_container_meta]
type = "remap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_my_app_container_meta]
type = "remap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_my_app_container_meta]
type = "remap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_my_app_container_meta]
type = "remap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_my_app_container_meta]
type = "remap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_my_app_container_meta]
type = "remap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pod_annotation_fields.pod_uid = "kubernetes.pod_id"
pod_annotation_fields.pod_node_name = "hostname"
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id"
rotate_wait_secs = 5
use_apiserver_cache = false
use_apiserver_cache = true

[transforms.input_application_container_meta]
type = "remap"
Expand Down
Loading