From 21abee8529af60866fd285cfc717abe818ffe7fa Mon Sep 17 00:00:00 2001 From: Armando Ruocco Date: Wed, 2 Oct 2024 12:15:05 +0200 Subject: [PATCH] chore: more cleanup Signed-off-by: Armando Ruocco --- cmd/instance/main.go | 3 +-- internal/cnpgi/instance/backup.go | 8 -------- internal/cnpgi/instance/start.go | 3 --- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/cmd/instance/main.go b/cmd/instance/main.go index 6808306..7af8be3 100644 --- a/cmd/instance/main.go +++ b/cmd/instance/main.go @@ -62,8 +62,7 @@ func main() { } if err := mgr.Add(&instance.CNPGI{ - Client: mgr.GetClient(), - Recorder: mgr.GetEventRecorderFor("cnpg-i"), + Client: mgr.GetClient(), ClusterObjectKey: client.ObjectKey{ Namespace: namespace, Name: clusterName, diff --git a/internal/cnpgi/instance/backup.go b/internal/cnpgi/instance/backup.go index b4b3945..705dd76 100644 --- a/internal/cnpgi/instance/backup.go +++ b/internal/cnpgi/instance/backup.go @@ -13,7 +13,6 @@ import ( "github.com/cloudnative-pg/machinery/pkg/fileutils" "github.com/cloudnative-pg/machinery/pkg/log" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -21,7 +20,6 @@ import ( // of the Backup CNPG capability type BackupServiceImplementation struct { Client client.Client - Recorder record.EventRecorder InstanceName string backup.UnimplementedBackupServer } @@ -93,12 +91,6 @@ func (b BackupServiceImplementation) Backup( return nil, err } - contextLogger.Info("Backup completed") - b.Recorder.Event(backupObj, "Normal", "Completed", "Backup completed") - - // Set the status to completed - backupObj.Status.SetAsCompleted() - executedBackupInfo, err := backupCmd.GetExecutedBackupInfo( ctx, backupObj.Status.BackupName, backupObj.Status.ServerName, cluster, env) if err != nil { diff --git a/internal/cnpgi/instance/start.go b/internal/cnpgi/instance/start.go index 91a54fb..269ff8d 100644 --- a/internal/cnpgi/instance/start.go +++ b/internal/cnpgi/instance/start.go @@ -7,14 +7,12 @@ import ( "github.com/cloudnative-pg/cnpg-i/pkg/backup" "github.com/cloudnative-pg/cnpg-i/pkg/wal" "google.golang.org/grpc" - "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" ) // CNPGI is the implementation of the PostgreSQL sidecar type CNPGI struct { Client client.Client - Recorder record.EventRecorder WALConfigurationKey client.ObjectKey ClusterObjectKey client.ObjectKey PGDataPath string @@ -44,7 +42,6 @@ func (c *CNPGI) Start(ctx context.Context) error { }) backup.RegisterBackupServer(server, BackupServiceImplementation{ Client: c.Client, - Recorder: c.Recorder, InstanceName: c.InstanceName, }) return nil