@@ -28,36 +28,36 @@ import (
28
28
loggingv1beta1 "github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1"
29
29
)
30
30
31
- func NewAggregationPolicyReconciler (client client.Client , log logr.Logger ) * AggregationPolicyReconciler {
32
- return & AggregationPolicyReconciler {
31
+ func NewLoggingRouteReconciler (client client.Client , log logr.Logger ) * LoggingRouteReconciler {
32
+ return & LoggingRouteReconciler {
33
33
Client : client ,
34
34
Log : log ,
35
35
}
36
36
}
37
37
38
- // AggregationPolicyReconciler reconciles an AggregationPolicy object
39
- type AggregationPolicyReconciler struct {
38
+ // LoggingRouteReconciler reconciles an LoggingRoute object
39
+ type LoggingRouteReconciler struct {
40
40
client.Client
41
41
Log logr.Logger
42
42
}
43
43
44
- // +kubebuilder:rbac:groups=logging.banzaicloud.io,resources=aggregationpolicies ,verbs=get;list;watch;create;update;patch;delete
45
- // +kubebuilder:rbac:groups=logging.banzaicloud.io,resources=aggregationpolicies /status,verbs=get;update;patch
44
+ // +kubebuilder:rbac:groups=logging.banzaicloud.io,resources=loggingroutes ,verbs=get;list;watch;create;update;patch;delete
45
+ // +kubebuilder:rbac:groups=logging.banzaicloud.io,resources=loggingroutes /status,verbs=get;update;patch
46
46
47
- // Reconcile aggregation policies
48
- func (r * AggregationPolicyReconciler ) Reconcile (ctx context.Context , req ctrl.Request ) (ctrl.Result , error ) {
49
- var agrPol loggingv1beta1.AggregationPolicy
50
- if err := r .Client .Get (ctx , req .NamespacedName , & agrPol ); err != nil {
47
+ // Reconcile routes between logging domains
48
+ func (r * LoggingRouteReconciler ) Reconcile (ctx context.Context , req ctrl.Request ) (ctrl.Result , error ) {
49
+ var loggingRoute loggingv1beta1.LoggingRoute
50
+ if err := r .Client .Get (ctx , req .NamespacedName , & loggingRoute ); err != nil {
51
51
return reconcile.Result {}, client .IgnoreNotFound (err )
52
52
}
53
53
54
- tenants , err := fluentbit .FindTenants (ctx , agrPol .Spec .WatchNamespaceTargets , r .Client )
54
+ tenants , err := fluentbit .FindTenants (ctx , loggingRoute .Spec .Targets , r .Client )
55
55
if err != nil {
56
56
return ctrl.Result {}, errors .WrapIf (err , "listing tenants" )
57
57
}
58
58
59
59
var problems []string
60
- agrPol .Status .Tenants = make ([]loggingv1beta1.Tenant , 0 )
60
+ loggingRoute .Status .Tenants = make ([]loggingv1beta1.Tenant , 0 )
61
61
62
62
for _ , t := range tenants {
63
63
valid := true
@@ -74,13 +74,13 @@ func (r *AggregationPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Re
74
74
Namespaces : t .Namespaces ,
75
75
}
76
76
if valid {
77
- agrPol .Status .Tenants = append (agrPol .Status .Tenants , tenantStatus )
77
+ loggingRoute .Status .Tenants = append (loggingRoute .Status .Tenants , tenantStatus )
78
78
}
79
79
}
80
80
81
- agrPol .Status .Problems = problems
81
+ loggingRoute .Status .Problems = problems
82
82
83
- err = r .Status ().Update (ctx , & agrPol )
83
+ err = r .Status ().Update (ctx , & loggingRoute )
84
84
if err != nil {
85
85
return ctrl.Result {}, err
86
86
}
0 commit comments