Skip to content

Commit

Permalink
lint-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreylimnardy committed Jan 30, 2025
1 parent 76997da commit 167007c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
8 changes: 0 additions & 8 deletions controllers/telemetry/logpipeline_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/discovery"
"k8s.io/client-go/rest"
Expand Down Expand Up @@ -62,13 +61,6 @@ const (
fbDaemonSetName = fbBaseName
)

var (
// FluentBit
fbMemoryLimit = resource.MustParse("1Gi")
fbCPURequest = resource.MustParse("100m")
fbMemoryRequest = resource.MustParse("50Mi")
)

// LogPipelineController reconciles a LogPipeline object
type LogPipelineController struct {
client.Client
Expand Down
2 changes: 0 additions & 2 deletions internal/reconciler/logpipeline/fluentbit/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func (r *Reconciler) SupportedOutput() logpipelineutils.Mode {
}

func New(client client.Client, config fluentbit.Config, agentApplierDeleter AgentApplierDeleter, prober commonstatus.Prober, healthProber logpipeline.FlowHealthProber, checker IstioStatusChecker, validator *Validator, converter commonstatus.ErrorToMessageConverter) *Reconciler {

config.PipelineDefaults = builder.PipelineDefaults{
InputTag: defaultInputTag,
MemoryBufferLimit: defaultMemoryBufferLimit,
Expand Down Expand Up @@ -116,7 +115,6 @@ func (r *Reconciler) doReconcile(ctx context.Context, pipeline *telemetryv1alpha
if err = r.agentApplierDeleter.DeleteResources(ctx, r.Client, fluentbit.AgentApplyOptions{Config: r.config}); err != nil {
return fmt.Errorf("failed to delete log pipeline resources: %w", err)
}

}

allowedPorts := getFluentBitPorts()
Expand Down
1 change: 0 additions & 1 deletion internal/resources/fluentbit/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func NewFluentBitApplierDeleter(fbImage, exporterImage, priorityClassName string
}

func (aad *AgentApplierDeleter) ApplyResources(ctx context.Context, c client.Client, opts AgentApplyOptions) error {

syncer := Syncer{
Client: c,
Config: opts.Config,
Expand Down
20 changes: 9 additions & 11 deletions internal/resources/fluentbit/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ package fluentbit

import (
"context"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"os"
"testing"

"github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1"
testutils "github.com/kyma-project/telemetry-manager/internal/utils/test"

"github.com/stretchr/testify/require"
istiosecurityclientv1 "istio.io/client-go/pkg/apis/security/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/client/interceptor"

telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1"
testutils "github.com/kyma-project/telemetry-manager/internal/utils/test"
)

func TestAgent_ApplyResources(t *testing.T) {
Expand Down Expand Up @@ -45,7 +45,7 @@ func TestAgent_ApplyResources(t *testing.T) {
scheme := runtime.NewScheme()
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(istiosecurityclientv1.AddToScheme(scheme))
utilruntime.Must(v1alpha1.AddToScheme(scheme))
utilruntime.Must(telemetryv1alpha1.AddToScheme(scheme))

fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithInterceptorFuncs(interceptor.Funcs{
Create: func(_ context.Context, c client.WithWatch, obj client.Object, _ ...client.CreateOption) error {
Expand Down Expand Up @@ -91,7 +91,7 @@ func TestAgent_ApplyResources(t *testing.T) {
AllowedPorts: []int32{5555, 6666},

Pipeline: &logPipeline,
DeployableLogPipelines: []v1alpha1.LogPipeline{logPipeline},
DeployableLogPipelines: []telemetryv1alpha1.LogPipeline{logPipeline},
})
require.NoError(t, err)

Expand Down Expand Up @@ -120,7 +120,7 @@ func TestAgent_DeleteResources(t *testing.T) {

scheme := runtime.NewScheme()
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(v1alpha1.AddToScheme(scheme))
utilruntime.Must(telemetryv1alpha1.AddToScheme(scheme))

fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithInterceptorFuncs(interceptor.Funcs{
Create: func(ctx context.Context, c client.WithWatch, obj client.Object, _ ...client.CreateOption) error {
Expand All @@ -140,9 +140,7 @@ func TestAgent_DeleteResources(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.name, func(t *testing.T) {

agentApplyOptions := AgentApplyOptions{
Config: Config{
DaemonSet: types.NamespacedName{Name: "foo-daemonset", Namespace: "kyma-system"},
Expand All @@ -155,7 +153,7 @@ func TestAgent_DeleteResources(t *testing.T) {
},
AllowedPorts: []int32{5555, 6666},
Pipeline: &logPipeline,
DeployableLogPipelines: []v1alpha1.LogPipeline{logPipeline},
DeployableLogPipelines: []telemetryv1alpha1.LogPipeline{logPipeline},
}

err := tt.sut.ApplyResources(context.Background(), fakeClient, agentApplyOptions)
Expand All @@ -173,7 +171,7 @@ func TestAgent_DeleteResources(t *testing.T) {
}
}

//func TestMakeDaemonSet(t *testing.T) {
// func TestMakeDaemonSet(t *testing.T) {
// name := types.NamespacedName{Name: "telemetry-fluent-bit", Namespace: "telemetry-system"}
// checksum := "foo"
// ds := DaemonSetConfig{
Expand Down

0 comments on commit 167007c

Please sign in to comment.