chore: fix linter issues

Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
This commit is contained in:
Francesco Canovai 2024-11-13 16:21:06 +01:00 committed by Marco Nenciarini
parent ed6cc19d29
commit 8cd2a2e1ac
No known key found for this signature in database
GPG Key ID: 589F03F01BA55038
3 changed files with 10 additions and 7 deletions

View File

@ -50,6 +50,7 @@ func (e *ExtendedClient) refreshTTL(ctx context.Context) error {
return nil return nil
} }
// Get behaves like the original Get method, but uses a cache for secrets
func (e *ExtendedClient) Get( func (e *ExtendedClient) Get(
ctx context.Context, ctx context.Context,
key client.ObjectKey, key client.ObjectKey,
@ -139,6 +140,7 @@ func (e *ExtendedClient) RemoveSecret(key client.ObjectKey) {
} }
} }
// Update behaves like the original Update method, but on secrets it removes the secret from the cache
func (e *ExtendedClient) Update( func (e *ExtendedClient) Update(
ctx context.Context, ctx context.Context,
obj client.Object, obj client.Object,
@ -157,6 +159,7 @@ func (e *ExtendedClient) Update(
return e.Client.Update(ctx, obj, opts...) return e.Client.Update(ctx, obj, opts...)
} }
// Delete behaves like the original Delete method, but on secrets it removes the secret from the cache
func (e *ExtendedClient) Delete( func (e *ExtendedClient) Delete(
ctx context.Context, ctx context.Context,
obj client.Object, obj client.Object,
@ -175,6 +178,7 @@ func (e *ExtendedClient) Delete(
return e.Client.Delete(ctx, obj, opts...) return e.Client.Delete(ctx, obj, opts...)
} }
// Patch behaves like the original Patch method, but on secrets it removes the secret from the cache
func (e *ExtendedClient) Patch( func (e *ExtendedClient) Patch(
ctx context.Context, ctx context.Context,
obj client.Object, obj client.Object,

View File

@ -1,15 +1,16 @@
package client package client
import ( import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"time" "time"
v1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
v1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"

View File

@ -165,14 +165,12 @@ func reconcilePod(
request *lifecycle.OperatorLifecycleRequest, request *lifecycle.OperatorLifecycleRequest,
pluginConfiguration *config.PluginConfiguration, pluginConfiguration *config.PluginConfiguration,
) (*lifecycle.OperatorLifecycleResponse, error) { ) (*lifecycle.OperatorLifecycleResponse, error) {
contextLogger := log.FromContext(ctx).WithName("lifecycle")
pod, err := decoder.DecodePodJSON(request.GetObjectDefinition()) pod, err := decoder.DecodePodJSON(request.GetObjectDefinition())
if err != nil { if err != nil {
return nil, err return nil, err
} }
contextLogger = log.FromContext(ctx).WithName("plugin-barman-cloud-lifecycle"). contextLogger := log.FromContext(ctx).WithName("plugin-barman-cloud-lifecycle").
WithValues("podName", pod.Name) WithValues("podName", pod.Name)
mutatedPod := pod.DeepCopy() mutatedPod := pod.DeepCopy()