From df57463649bc249b3d866cf9055f71a011dd4bb6 Mon Sep 17 00:00:00 2001 From: Niklas Treml Date: Thu, 22 Feb 2024 14:40:28 +0100 Subject: [PATCH] fix: Initialize fluentd as nil (#2) * initialize fluentd as nil * fix: unit tests * debug logs * no explicit nil initialization --- fn.go | 4 ++-- fn_test.go | 23 ----------------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/fn.go b/fn.go index 8abd540..ba2e8d9 100644 --- a/fn.go +++ b/fn.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/logging" @@ -60,7 +61,7 @@ func (f *Function) RunFunction(ctx context.Context, req *fnv1beta1.RunFunctionRe projectid, ok := targetns.GetLabels()[in.NamespaceLabel] if !ok { - response.Fatal(rsp, errors.New("cannot get project id")) + response.Fatal(rsp, fmt.Errorf("cannot get project id %s for namespace %s", projectid, targetns.GetName())) return rsp, nil } @@ -68,7 +69,6 @@ func (f *Function) RunFunction(ctx context.Context, req *fnv1beta1.RunFunctionRe l.Spec.ControlNamespace = ns l.Spec.WatchNamespaceSelector = &metav1.LabelSelector{} l.Spec.WatchNamespaceSelector.MatchLabels = map[string]string{in.NamespaceLabel: projectid} - l.Spec.FluentdSpec = &v1beta1.FluentdSpec{} cd, err := composed.From(l) if err != nil { diff --git a/fn_test.go b/fn_test.go index 3b366c8..2bc1f71 100644 --- a/fn_test.go +++ b/fn_test.go @@ -86,29 +86,6 @@ func TestRunFunction(t *testing.T) { }, "enableRecreateWorkloadOnImmutableFieldChange": false, "flowConfigCheckDisabled": false, - "fluentd": { - "compressConfigFile": false, - "disablePvc": false, - "enableMsgpackTimeSupport": false, - "livenessDefaultCheck": false, - "port": 0, - "readinessDefaultCheck": { - "bufferFileNumber": false, - "bufferFileNumberMax": 0, - "bufferFreeSpace": false, - "bufferFreeSpaceThreshold": 0, - "failureThreshold": 0, - "initialDelaySeconds": 0, - "periodSeconds": 0, - "successThreshold": 0, - "timeoutSeconds": 0 - }, - "tls": { - "enabled": false - }, - "volumeMountChmod": false, - "workers": 0 - }, "skipInvalidResources": false }, "status": {