From 479c4e404e0ad8ceb17e9a9fe76e48cbafbc3b1a Mon Sep 17 00:00:00 2001 From: Bence Csati Date: Tue, 3 Dec 2024 15:05:06 +0100 Subject: [PATCH] wip Signed-off-by: Bence Csati --- charts/logging-operator/Chart.lock | 6 + .../logging.banzaicloud.io_loggings.yaml | 33 ++++ .../crds/logging.banzaicloud.io_loggings.yaml | 33 ++++ .../templates/clusterrole.yaml | 16 ++ .../logging.banzaicloud.io_loggings.yaml | 33 ++++ config/rbac/role.yaml | 16 ++ .../telemetry_controller_controller.go | 173 ++++++++++++++++++ .../crds/v1beta1/logging_types.md | 23 +++ go.mod | 43 ++--- go.sum | 95 +++++----- go.work | 4 +- main.go | 16 +- pkg/resources/fluentbit/tenants.go | 3 + .../telemetry-controller/resources.go | 155 ++++++++++++++++ pkg/sdk/logging/api/v1beta1/logging_types.go | 20 ++ .../api/v1beta1/zz_generated.deepcopy.go | 25 +++ 16 files changed, 619 insertions(+), 75 deletions(-) create mode 100644 charts/logging-operator/Chart.lock create mode 100644 controllers/logging/telemetry_controller_controller.go create mode 100644 pkg/resources/telemetry-controller/resources.go diff --git a/charts/logging-operator/Chart.lock b/charts/logging-operator/Chart.lock new file mode 100644 index 000000000..9c73bc5ec --- /dev/null +++ b/charts/logging-operator/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: logging-operator-crds + repository: "" + version: 0.0.0 +digest: sha256:cdfb5cdd4a7897d730175d7bfeb884fbaec8efcfdef1130680792abd9bff5a72 +generated: "2024-11-28T16:10:58.540563+01:00" diff --git a/charts/logging-operator/charts/logging-operator-crds/templates/logging.banzaicloud.io_loggings.yaml b/charts/logging-operator/charts/logging-operator-crds/templates/logging.banzaicloud.io_loggings.yaml index 780924e6c..55a61de20 100644 --- a/charts/logging-operator/charts/logging-operator-crds/templates/logging.banzaicloud.io_loggings.yaml +++ b/charts/logging-operator/charts/logging-operator-crds/templates/logging.banzaicloud.io_loggings.yaml @@ -12593,6 +12593,39 @@ spec: type: string type: object type: array + routeConfig: + properties: + disableLoggingRoute: + type: boolean + enableTelemetryControllerRoute: + type: boolean + tenantLabels: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + type: object skipInvalidResources: type: boolean syslogNG: diff --git a/charts/logging-operator/crds/logging.banzaicloud.io_loggings.yaml b/charts/logging-operator/crds/logging.banzaicloud.io_loggings.yaml index 4462feae0..44fce8683 100644 --- a/charts/logging-operator/crds/logging.banzaicloud.io_loggings.yaml +++ b/charts/logging-operator/crds/logging.banzaicloud.io_loggings.yaml @@ -12590,6 +12590,39 @@ spec: type: string type: object type: array + routeConfig: + properties: + disableLoggingRoute: + type: boolean + enableTelemetryControllerRoute: + type: boolean + tenantLabels: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + type: object skipInvalidResources: type: boolean syslogNG: diff --git a/charts/logging-operator/templates/clusterrole.yaml b/charts/logging-operator/templates/clusterrole.yaml index c720e85e8..f92be5d53 100644 --- a/charts/logging-operator/templates/clusterrole.yaml +++ b/charts/logging-operator/templates/clusterrole.yaml @@ -243,4 +243,20 @@ rules: - patch - update - watch +- apiGroups: + - telemetry.kube-logging.dev + resources: + - bridges + - collectors + - outputs + - subscriptions + - tenants + verbs: + - create + - delete + - get + - list + - patch + - update + - watch {{- end }} diff --git a/config/crd/bases/logging.banzaicloud.io_loggings.yaml b/config/crd/bases/logging.banzaicloud.io_loggings.yaml index 4462feae0..44fce8683 100644 --- a/config/crd/bases/logging.banzaicloud.io_loggings.yaml +++ b/config/crd/bases/logging.banzaicloud.io_loggings.yaml @@ -12590,6 +12590,39 @@ spec: type: string type: object type: array + routeConfig: + properties: + disableLoggingRoute: + type: boolean + enableTelemetryControllerRoute: + type: boolean + tenantLabels: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + type: object skipInvalidResources: type: boolean syslogNG: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 220d42442..2a2299dee 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -238,3 +238,19 @@ rules: - patch - update - watch +- apiGroups: + - telemetry.kube-logging.dev + resources: + - bridges + - collectors + - outputs + - subscriptions + - tenants + verbs: + - create + - delete + - get + - list + - patch + - update + - watch diff --git a/controllers/logging/telemetry_controller_controller.go b/controllers/logging/telemetry_controller_controller.go new file mode 100644 index 000000000..26575f318 --- /dev/null +++ b/controllers/logging/telemetry_controller_controller.go @@ -0,0 +1,173 @@ +// Copyright © 2024 Kube logging authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controllers + +import ( + "context" + "fmt" + + "github.com/go-logr/logr" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + + telemetry_controller "github.com/kube-logging/logging-operator/pkg/resources/telemetry-controller" + "github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1" + loggingv1beta1 "github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1" +) + +const ( + TelemetryControllerFinalizer = "telemetrycontroller.logging.banzaicloud.io/finalizer" +) + +// +kubebuilder:rbac:groups=telemetry.kube-logging.dev,resources=collectors;tenants;subscriptions;outputs;bridges;,verbs=get;list;watch;create;update;patch;delete + +func NewTelemetryControllerReconciler(client client.Client, log logr.Logger) *TelemetryControllerReconciler { + return &TelemetryControllerReconciler{ + Client: client, + Log: log, + } +} + +// TelemetryControllerReconciler reconciles Logging resources for the Telemetry controller +type TelemetryControllerReconciler struct { + client.Client + Log logr.Logger +} + +func (r *TelemetryControllerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + log := r.Log.WithValues("telemetry-controller", req.Name) + + var logging loggingv1beta1.Logging + if err := r.Client.Get(ctx, req.NamespacedName, &logging); err != nil { + return reconcile.Result{}, client.IgnoreNotFound(err) + } + + if logging.Spec.RouteConfig.EnableTelemetryControllerRoute { + log.Info("Reconciling Logging resource for Telemetry controller", "name", logging.Name) + + var objectsToCreate []client.Object + objectsToCreate = append(objectsToCreate, telemetry_controller.CreateCollector(&logging)) + objectsToCreate = append(objectsToCreate, telemetry_controller.CreateOutput(&logging)) + objectsToCreate = append(objectsToCreate, telemetry_controller.CreateSubscription(&logging)) + objectsToCreate = append(objectsToCreate, telemetry_controller.CreateTenant(&logging)) + + if logging.ObjectMeta.DeletionTimestamp.IsZero() { + if !controllerutil.ContainsFinalizer(&logging, TelemetryControllerFinalizer) { + r.Log.Info("adding telemetrycontroller finalizer") + controllerutil.AddFinalizer(&logging, TelemetryControllerFinalizer) + if err := r.Client.Update(ctx, &logging); err != nil { + return ctrl.Result{}, err + } + } + } else { + // The object is being deleted + if controllerutil.ContainsFinalizer(&logging, TelemetryControllerFinalizer) { + if err := r.deleteTelemetryControllerResources(ctx, log, &objectsToCreate); err != nil { + return ctrl.Result{}, err + } + + r.Log.Info("removing telemetrycontroller finalizer") + controllerutil.RemoveFinalizer(&logging, TelemetryControllerFinalizer) + if err := r.Client.Update(ctx, &logging); err != nil { + return ctrl.Result{}, err + } + } + + return ctrl.Result{}, nil + } + if err := r.isAggregatorReady(ctx, log, logging); err != nil { + return ctrl.Result{RequeueAfter: 5}, err + } + + if err := r.deployTelemetryControllerResources(ctx, log, &objectsToCreate); err != nil { + return ctrl.Result{}, err + } + } + + return ctrl.Result{}, nil +} + +func SetupTelemetryControllerWithManager(mgr ctrl.Manager, logger logr.Logger) error { + return ctrl.NewControllerManagedBy(mgr). + For(&loggingv1beta1.Logging{}). + Named("telemetrycontroller"). + Complete(NewTelemetryControllerReconciler(mgr.GetClient(), logger)) +} + +func (r *TelemetryControllerReconciler) deployTelemetryControllerResources(ctx context.Context, logger logr.Logger, objectsToCreate *[]client.Object) error { + logger.Info("Deploying Telemetry controller resources") + + for _, obj := range *objectsToCreate { + key := client.ObjectKeyFromObject(obj) + if err := r.Client.Get(ctx, key, obj); err != nil { + if !apierrors.IsNotFound(err) { + logger.Error(err, "Failed to get object", "object", obj.GetName()) + return err + } + if err := r.Client.Create(ctx, obj); err != nil { + logger.Error(err, "Failed to create object", "object", obj.GetName()) + return err + } + logger.Info("Created object", "object", obj.GetName()) + } else { + logger.Info("Object already exists", "object", obj.GetName()) + } + } + + return nil +} + +func (r *TelemetryControllerReconciler) deleteTelemetryControllerResources(ctx context.Context, logger logr.Logger, objectsToCreate *[]client.Object) error { + logger.Info("Logging resource is being deleted, deleting Telemetry controller resources") + + for _, obj := range *objectsToCreate { + if err := r.Client.Delete(ctx, obj); err != nil { + logger.Error(err, "Failed to delete object", "object", obj.GetName()) + return err + } + logger.Info("Deleted object", "object", obj.GetName()) + } + + return nil +} + +func (r *TelemetryControllerReconciler) isAggregatorReady(ctx context.Context, logger logr.Logger, logging v1beta1.Logging) error { + logger.Info("Waiting for aggregator pod to be ready") + + podName := fmt.Sprintf("%s-fluentd-0", logging.Name) + pod := &corev1.Pod{} + err := r.Client.Get(ctx, client.ObjectKey{Name: podName, Namespace: logging.Spec.ControlNamespace}, pod) + if err != nil { + if apierrors.IsNotFound(err) { + return fmt.Errorf("aggregator pod: %s not found", podName) + } + + r.Log.Error(err, "failed to get aggregator pod", "pod", podName) + return err + } + + for _, condition := range pod.Status.Conditions { + if condition.Type == corev1.PodReady && condition.Status == corev1.ConditionTrue { + r.Log.Info("Aggregator pod is ready", "pod", pod.Name) + return nil + } + } + + return fmt.Errorf("aggregator pod: %s is not ready", podName) +} diff --git a/docs/configuration/crds/v1beta1/logging_types.md b/docs/configuration/crds/v1beta1/logging_types.md index 46963c642..b90d0fbeb 100644 --- a/docs/configuration/crds/v1beta1/logging_types.md +++ b/docs/configuration/crds/v1beta1/logging_types.md @@ -84,6 +84,11 @@ Reference to the logging system. Each of the `loggingRef`s can manage a fluentbi InlineNodeAgent Configuration Deprecated, will be removed with next major version +### routeConfig (*RouteConfig, optional) {#loggingspec-routeconfig} + +RouteConfig determines whether to use loggingRoutes or to create resources based on the logging resource that can be managed by the Telmetry Controller. + + ### skipInvalidResources (bool, optional) {#loggingspec-skipinvalidresources} Whether to skip invalid Flow and ClusterFlow resources @@ -123,6 +128,24 @@ Configure timeout in seconds if strategy is StartWithTimeout +## RouteConfig + +### disableLoggingRoute (bool, optional) {#routeconfig-disableloggingroute} + +If DisableLoggingRoute is set to true, the logging route controller should remove the given tenant from the status of the logging resource. + + +### enableTelemetryControllerRoute (bool, optional) {#routeconfig-enabletelemetrycontrollerroute} + +If EnableTelemtryControllerRoute set to true, the opoerator will create the corresponding Tenant, Subscription, Output based on the logging resource. + + +### tenantLabels (*metav1.LabelSelector, optional) {#routeconfig-tenantlabels} + +TenantLabels is a map of labels that will be added to the tenant object so it can be matched with TelemetryController's TenantSelector ref: https://github.com/kube-logging/telemetry-controller/blob/main/api/telemetry/v1alpha1/collector_types.go + + + ## LoggingStatus LoggingStatus defines the observed state of Logging diff --git a/go.mod b/go.mod index d722f2de9..27d89e7c1 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/kube-logging/logging-operator -go 1.23 - -toolchain go1.23.3 +go 1.23.3 require ( emperror.dev/errors v0.8.1 @@ -12,21 +10,22 @@ require ( github.com/go-logr/logr v1.4.2 github.com/kube-logging/logging-operator/pkg/sdk v0.11.0 github.com/kube-logging/logging-operator/pkg/sdk/logging/model/syslogng/config v0.0.0 + github.com/kube-logging/telemetry-controller v0.0.0-20241203075129-301e49d89b30 github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.35.1 + github.com/onsi/gomega v1.36.0 github.com/pborman/uuid v1.2.1 github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1 github.com/prometheus/client_golang v1.20.5 github.com/siliconbrain/go-seqs v0.13.0 github.com/spf13/cast v1.7.0 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f - k8s.io/api v0.31.2 - k8s.io/apiextensions-apiserver v0.31.2 - k8s.io/apimachinery v0.31.2 - k8s.io/client-go v0.31.2 + k8s.io/api v0.31.3 + k8s.io/apiextensions-apiserver v0.31.3 + k8s.io/apimachinery v0.31.3 + k8s.io/client-go v0.31.3 k8s.io/klog/v2 v2.130.1 - sigs.k8s.io/controller-runtime v0.19.1 + sigs.k8s.io/controller-runtime v0.19.3 ) require ( @@ -37,16 +36,16 @@ require ( github.com/cisco-open/k8s-objectmatcher v1.10.0 // indirect github.com/cppforlife/go-patch v0.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/emicklei/go-restful/v3 v3.12.1 // indirect github.com/evanphx/json-patch v5.9.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/fatih/color v1.17.0 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/fsnotify/fsnotify v1.8.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-logr/zapr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.4 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect @@ -58,7 +57,7 @@ require ( github.com/imdario/mergo v0.3.16 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/compress v1.17.11 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect @@ -69,20 +68,22 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.60.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/wayneashleyberry/terminal-dimensions v1.1.0 // indirect github.com/x448/float16 v0.8.4 // indirect + go.opentelemetry.io/collector/config/configcompression v1.20.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.20.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.31.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sys v0.27.0 // indirect golang.org/x/term v0.26.0 // indirect golang.org/x/text v0.20.0 // indirect - golang.org/x/time v0.3.0 // indirect + golang.org/x/time v0.6.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/protobuf v1.35.1 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect @@ -90,8 +91,8 @@ require ( gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 // indirect + k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 // indirect + k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect diff --git a/go.sum b/go.sum index 9e410a97f..bcf020fe4 100644 --- a/go.sum +++ b/go.sum @@ -18,13 +18,12 @@ github.com/cisco-open/operator-tools v0.37.0 h1:qAkAbWQA+aeWHZOqpWL8FuiZ42cWWUZ0 github.com/cisco-open/operator-tools v0.37.0/go.mod h1:SaMi2aMNILC5Wrqw9m92ptN5InMH2Zt3CSKkGlzyqfQ= github.com/cppforlife/go-patch v0.2.0 h1:Y14MnCQjDlbw7WXT4k+u6DPAA9XnygN4BfrSpI/19RU= github.com/cppforlife/go-patch v0.2.0/go.mod h1:67a7aIi94FHDZdoeGSJRRFDp66l9MhaAG1yGxpUoFD8= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= -github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU= +github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= @@ -35,21 +34,20 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= @@ -80,8 +78,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -96,16 +94,17 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= -github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= +github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kube-logging/telemetry-controller v0.0.0-20241203075129-301e49d89b30 h1:XgiNLY7sgdaZ2rct79fvV7g0b3jY6ziwAYmh0v5LIZA= +github.com/kube-logging/telemetry-controller v0.0.0-20241203075129-301e49d89b30/go.mod h1:IYFH6OWWdKPskUDXfE9x6iF0aXErG++yTQpuGga4ulE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -129,12 +128,12 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo= -github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= +github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= -github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/onsi/gomega v1.36.0 h1:Pb12RlruUtj4XUuPUqeEWc6j5DkVVVA49Uf6YLfC95Y= +github.com/onsi/gomega v1.36.0/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -148,8 +147,8 @@ github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+ github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= +github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= @@ -163,22 +162,21 @@ github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cA github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/wayneashleyberry/terminal-dimensions v1.1.0 h1:EB7cIzBdsOzAgmhTUtTTQXBByuPheP/Zv1zL2BRPY6g= github.com/wayneashleyberry/terminal-dimensions v1.1.0/go.mod h1:2lc/0eWCObmhRczn2SdGSQtgBooLUzIotkkEGXqghyg= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector/config/configcompression v1.20.0 h1:H/mvz7J/5z+O74YsO0t2tk+REnO2tzLM8TgIQ4AZ5w0= +go.opentelemetry.io/collector/config/configcompression v1.20.0/go.mod h1:pnxkFCLUZLKWzYJvfSwZnPrnm0twX14CYj2ADth5xiU= +go.opentelemetry.io/collector/config/configopaque v1.20.0 h1:2I48zKiyyyYqjm7y0B9OLp24ku2ZSX3nCHG0r5FdWOQ= +go.opentelemetry.io/collector/config/configopaque v1.20.0/go.mod h1:6zlLIyOoRpJJ+0bEKrlZOZon3rOp5Jrz9fMdR4twOS4= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= @@ -202,8 +200,8 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -227,8 +225,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -267,25 +265,24 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0= -k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk= -k8s.io/apiextensions-apiserver v0.31.2 h1:W8EwUb8+WXBLu56ser5IudT2cOho0gAKeTOnywBLxd0= -k8s.io/apiextensions-apiserver v0.31.2/go.mod h1:i+Geh+nGCJEGiCGR3MlBDkS7koHIIKWVfWeRFiOsUcM= -k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= -k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc= -k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs= +k8s.io/api v0.31.3 h1:umzm5o8lFbdN/hIXbrK9oRpOproJO62CV1zqxXrLgk8= +k8s.io/api v0.31.3/go.mod h1:UJrkIp9pnMOI9K2nlL6vwpxRzzEX5sWgn8kGQe92kCE= +k8s.io/apiextensions-apiserver v0.31.3 h1:+GFGj2qFiU7rGCsA5o+p/rul1OQIq6oYpQw4+u+nciE= +k8s.io/apiextensions-apiserver v0.31.3/go.mod h1:2DSpFhUZZJmn/cr/RweH1cEVVbzFw9YBu4T+U3mf1e4= +k8s.io/apimachinery v0.31.3 h1:6l0WhcYgasZ/wk9ktLq5vLaoXJJr5ts6lkaQzgeYPq4= +k8s.io/apimachinery v0.31.3/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/client-go v0.31.3 h1:CAlZuM+PH2cm+86LOBemaJI/lQ5linJ6UFxKX/SoG+4= +k8s.io/client-go v0.31.3/go.mod h1:2CgjPUTpv3fE5dNygAr2NcM8nhHzXvxB8KL5gYc3kJs= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= -k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 h1:b2FmK8YH+QEwq/Sy2uAEhmqL5nPfGYbJOcaqjeYYZoA= -k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.19.1 h1:Son+Q40+Be3QWb+niBXAg2vFiYWolDjjRfO8hn/cxOk= -sigs.k8s.io/controller-runtime v0.19.1/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= +k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 h1:1dWzkmJrrprYvjGwh9kEUxmcUV/CtNU8QM7h1FLWQOo= +k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38/go.mod h1:coRQXBK9NxO98XUv3ZD6AK3xzHCxV6+b7lrquKwaKzA= +k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY9mD9fNT47QO6HI= +k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/controller-runtime v0.19.3 h1:XO2GvC9OPftRst6xWCpTgBZO04S2cbp0Qqkj8bX1sPw= +sigs.k8s.io/controller-runtime v0.19.3/go.mod h1:j4j87DqtsThvwTv5/Tc5NFRyyF/RF0ip4+62tbTSIUM= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/go.work b/go.work index 8962adaf6..c8a8ca6bf 100644 --- a/go.work +++ b/go.work @@ -1,6 +1,4 @@ -go 1.23 - -toolchain go1.23.1 +go 1.23.3 use ( . diff --git a/main.go b/main.go index 2f89b264a..02faa495e 100644 --- a/main.go +++ b/main.go @@ -56,6 +56,7 @@ import ( loggingv1beta1 "github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1" "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/types" "github.com/kube-logging/logging-operator/pkg/webhook/podhandler" + telemetryv1alpha1 "github.com/kube-logging/telemetry-controller/api/telemetry/v1alpha1" // +kubebuilder:scaffold:imports ) @@ -72,6 +73,7 @@ func init() { // +kubebuilder:scaffold:scheme _ = prometheusOperator.AddToScheme(scheme) _ = apiextensions.AddToScheme(scheme) + _ = telemetryv1alpha1.AddToScheme(scheme) } func main() { @@ -83,6 +85,7 @@ func main() { var namespace string var loggingRef string var finalizerCleanup bool + var enableTelemetryControllerRoute bool var klogLevel int flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.") @@ -95,6 +98,7 @@ func main() { flag.StringVar(&namespace, "watch-namespace", "", "Namespace to filter the list of watched objects") flag.StringVar(&loggingRef, "watch-logging-name", "", "Logging resource name to optionally filter the list of watched objects based on which logging they belong to by checking the app.kubernetes.io/managed-by label") flag.BoolVar(&finalizerCleanup, "finalizer-cleanup", false, "Remove finalizers from Logging resources during operator shutdown, useful for Helm uninstallation") + flag.BoolVar(&enableTelemetryControllerRoute, "enable-telemetry-controller-route", false, "Enable the Telemetry Controller route for Logging resources") flag.Parse() ctx := context.Background() @@ -201,6 +205,13 @@ func main() { os.Exit(1) } + if enableTelemetryControllerRoute { + if err := loggingControllers.SetupTelemetryControllerWithManager(mgr, ctrl.Log.WithName("telemetry-controller")); err != nil { + setupLog.Error(err, "unable to create controller", "controller", "TelemetryController") + os.Exit(1) + } + } + if os.Getenv("ENABLE_WEBHOOKS") == "true" { if err := loggingv1beta1.SetupWebhookWithManager(mgr, loggingv1beta1.APITypes()...); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "v1beta1.logging") @@ -353,8 +364,9 @@ func cleanupFinalizers(ctx context.Context, client client.Client) { } finalizers := []string{ - "fluentdconfig.logging.banzaicloud.io/finalizer", - "syslogngconfig.logging.banzaicloud.io/finalizer", + loggingControllers.FluentdConfigFinalizer, + loggingControllers.SyslogNGConfigFinalizer, + loggingControllers.TelemetryControllerFinalizer, } for _, logging := range loggingList.Items { for _, finalizer := range finalizers { diff --git a/pkg/resources/fluentbit/tenants.go b/pkg/resources/fluentbit/tenants.go index 55139d146..a250f3415 100644 --- a/pkg/resources/fluentbit/tenants.go +++ b/pkg/resources/fluentbit/tenants.go @@ -56,6 +56,9 @@ func FindTenants(ctx context.Context, target metav1.LabelSelector, reader client } for _, l := range loggingList.Items { l := l + if l.Spec.RouteConfig != nil && l.Spec.RouteConfig.DisableLoggingRoute { + continue + } targetNamespaces, err := model.UniqueWatchNamespaces(ctx, reader, &l) if err != nil { return nil, err diff --git a/pkg/resources/telemetry-controller/resources.go b/pkg/resources/telemetry-controller/resources.go new file mode 100644 index 000000000..259d07577 --- /dev/null +++ b/pkg/resources/telemetry-controller/resources.go @@ -0,0 +1,155 @@ +// Copyright © 2024 Kube logging authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package telemetry_controller + +import ( + "fmt" + + "github.com/cisco-open/operator-tools/pkg/utils" + "github.com/kube-logging/logging-operator/pkg/resources/fluentd" + "github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1" + telemetryv1alpha1 "github.com/kube-logging/telemetry-controller/api/telemetry/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + telemetryApiVersion = "telemetry.kube-logging.dev/v1alpha1" + k8sMetadataName = "kubernetes.io/metadata.name" + collectorKind = "Collector" + tenantKind = "Tenant" + subscriptionKind = "Subscription" + outputKind = "Output" +) + +func CreateCollector(logging *v1beta1.Logging) *telemetryv1alpha1.Collector { + return &telemetryv1alpha1.Collector{ + TypeMeta: metav1.TypeMeta{ + APIVersion: telemetryApiVersion, + Kind: collectorKind, + }, + ObjectMeta: metav1.ObjectMeta{ + Name: logging.Name, + }, + Spec: telemetryv1alpha1.CollectorSpec{ + TenantSelector: *logging.Spec.RouteConfig.TenantLabels, + ControlNamespace: logging.Spec.ControlNamespace, + Debug: true, + }, + } +} + +func CreateTenant(logging *v1beta1.Logging) *telemetryv1alpha1.Tenant { + namespaceSelectors := convertToLabelSelectors(logging.Spec.WatchNamespaces, logging.Spec.WatchNamespaceSelector) + return &telemetryv1alpha1.Tenant{ + TypeMeta: metav1.TypeMeta{ + APIVersion: telemetryApiVersion, + Kind: tenantKind, + }, + ObjectMeta: metav1.ObjectMeta{ + Name: logging.Name, + Labels: logging.Spec.RouteConfig.TenantLabels.MatchLabels, + }, + Spec: telemetryv1alpha1.TenantSpec{ + SubscriptionNamespaceSelectors: []metav1.LabelSelector{ + { + MatchLabels: map[string]string{ + k8sMetadataName: logging.Spec.ControlNamespace, + }, + }, + }, + LogSourceNamespaceSelectors: namespaceSelectors, + }, + } +} + +func CreateSubscription(logging *v1beta1.Logging) *telemetryv1alpha1.Subscription { + return &telemetryv1alpha1.Subscription{ + TypeMeta: metav1.TypeMeta{ + APIVersion: telemetryApiVersion, + Kind: subscriptionKind, + }, + ObjectMeta: metav1.ObjectMeta{ + Name: logging.Name, + Namespace: logging.Spec.ControlNamespace, + }, + Spec: telemetryv1alpha1.SubscriptionSpec{ + Condition: "true", + Outputs: []telemetryv1alpha1.NamespacedName{ + { + Namespace: logging.Spec.ControlNamespace, + Name: logging.Name, + }, + }, + }, + } +} + +func CreateOutput(logging *v1beta1.Logging) *telemetryv1alpha1.Output { + return &telemetryv1alpha1.Output{ + TypeMeta: metav1.TypeMeta{ + APIVersion: telemetryApiVersion, + Kind: outputKind, + }, + ObjectMeta: metav1.ObjectMeta{ + Name: logging.Name, + Namespace: logging.Spec.ControlNamespace, + }, + Spec: telemetryv1alpha1.OutputSpec{ + Fluentforward: &telemetryv1alpha1.Fluentforward{ + TCPClientSettings: telemetryv1alpha1.TCPClientSettings{ + Endpoint: aggregatorEndpoint(logging), + TLSSetting: &telemetryv1alpha1.TLSClientSetting{ + Insecure: true, + }, + }, + Tag: utils.StringPointer("otelcol"), + // Will be available once the fluentforwardexporter is released + // Kubernetes: &telemetryv1alpha1.KubernetesMetadata{ + // Key: "kubernetes", + // IncludePodLabels: true, + // }, + }, + }, + } +} + +func aggregatorEndpoint(l *v1beta1.Logging) *string { + endpoint := fmt.Sprintf("%s.%s.svc%s:%d", l.QualifiedName(fluentd.ServiceName), l.Spec.ControlNamespace, l.ClusterDomainAsSuffix(), fluentd.ServicePort) + return &endpoint +} + +func convertToLabelSelectors(watchNamespaces []string, watchNamespaceSelector *metav1.LabelSelector) []metav1.LabelSelector { + var labelSelectors []metav1.LabelSelector + + // Convert WatchNamespaces to LabelSelectors + for _, ns := range watchNamespaces { + labelSelectors = append(labelSelectors, metav1.LabelSelector{ + MatchExpressions: []metav1.LabelSelectorRequirement{ + { + Key: k8sMetadataName, + Operator: metav1.LabelSelectorOpIn, + Values: []string{ns}, + }, + }, + }) + } + + // Append WatchNamespaceSelector if it exists + if watchNamespaceSelector != nil { + labelSelectors = append(labelSelectors, *watchNamespaceSelector) + } + + return labelSelectors +} diff --git a/pkg/sdk/logging/api/v1beta1/logging_types.go b/pkg/sdk/logging/api/v1beta1/logging_types.go index 36bbd7921..08cba5803 100644 --- a/pkg/sdk/logging/api/v1beta1/logging_types.go +++ b/pkg/sdk/logging/api/v1beta1/logging_types.go @@ -92,6 +92,9 @@ type LoggingSpec struct { // - downstream parsers can use the `log` field instead of `message` as they did with the docker runtime // - the `concat` and `parser` filters are automatically set back to use the `log` field EnableDockerParserCompatibilityForCRI bool `json:"enableDockerParserCompatibilityForCRI,omitempty"` + // RouteConfig determines whether to use loggingRoutes or to create resources based on the logging resource + // that can be managed by the Telmetry Controller. + RouteConfig *RouteConfig `json:"routeConfig,omitempty"` } type ConfigCheckStrategy string @@ -114,6 +117,19 @@ type ConfigCheck struct { Labels map[string]string `json:"labels,omitempty"` } +type RouteConfig struct { + // If DisableLoggingRoute is set to true, the logging route controller + // should remove the given tenant from the status of the logging resource. + DisableLoggingRoute bool `json:"disableLoggingRoute,omitempty"` + // If EnableTelemtryControllerRoute set to true, the opoerator will create + // the corresponding Tenant, Subscription, Output based on the logging resource. + EnableTelemetryControllerRoute bool `json:"enableTelemetryControllerRoute,omitempty"` + // TenantLabels is a map of labels that will be added to the tenant object + // so it can be matched with TelemetryController's TenantSelector + // ref: https://github.com/kube-logging/telemetry-controller/blob/main/api/telemetry/v1alpha1/collector_types.go + TenantLabels *metav1.LabelSelector `json:"tenantLabels,omitempty"` +} + // LoggingStatus defines the observed state of Logging type LoggingStatus struct { // Result of the config check. Under normal conditions there is a single item in the map with a bool value. @@ -207,6 +223,10 @@ func (l *Logging) SetDefaults() error { return err } } + if l.Spec.RouteConfig == nil { + l.Spec.RouteConfig = &RouteConfig{} + } + l.configCheckDefaults() if len(l.Status.SyslogNGConfigName) == 0 { l.Spec.SyslogNGSpec.SetDefaults() diff --git a/pkg/sdk/logging/api/v1beta1/zz_generated.deepcopy.go b/pkg/sdk/logging/api/v1beta1/zz_generated.deepcopy.go index a1c0f5131..a8783b647 100644 --- a/pkg/sdk/logging/api/v1beta1/zz_generated.deepcopy.go +++ b/pkg/sdk/logging/api/v1beta1/zz_generated.deepcopy.go @@ -2057,6 +2057,11 @@ func (in *LoggingSpec) DeepCopyInto(out *LoggingSpec) { } } } + if in.RouteConfig != nil { + in, out := &in.RouteConfig, &out.RouteConfig + *out = new(RouteConfig) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoggingSpec. @@ -2704,6 +2709,26 @@ func (in *ReadinessDefaultCheck) DeepCopy() *ReadinessDefaultCheck { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteConfig) DeepCopyInto(out *RouteConfig) { + *out = *in + if in.TenantLabels != nil { + in, out := &in.TenantLabels, &out.TenantLabels + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteConfig. +func (in *RouteConfig) DeepCopy() *RouteConfig { + if in == nil { + return nil + } + out := new(RouteConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Security) DeepCopyInto(out *Security) { *out = *in