From 045252edca915b2374ac16696abbb568ce30235a Mon Sep 17 00:00:00 2001 From: Fixer38 Date: Sat, 11 Apr 2026 21:39:48 +0200 Subject: [PATCH 1/2] fix: make fmt run --- api/v1alpha1/zz_generated.deepcopy.go | 2 +- internal/server/handlers.go | 6 +++--- internal/storage/models.go | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 78d62be..ac25820 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -9,8 +9,8 @@ package v1alpha1 import ( - runtime "k8s.io/apimachinery/pkg/runtime" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/internal/server/handlers.go b/internal/server/handlers.go index a66b525..b4917c3 100644 --- a/internal/server/handlers.go +++ b/internal/server/handlers.go @@ -32,10 +32,10 @@ type apiMeta struct { } type diffResponse struct { - FromRevision int64 `json:"fromRevision"` - ToRevision int64 `json:"toRevision"` + FromRevision int64 `json:"fromRevision"` + ToRevision int64 `json:"toRevision"` Patch json.RawMessage `json:"patch"` - ChangedPaths []string `json:"changedPaths"` + ChangedPaths []string `json:"changedPaths"` FromSnapshot json.RawMessage `json:"fromSnapshot,omitempty"` ToSnapshot json.RawMessage `json:"toSnapshot,omitempty"` } diff --git a/internal/storage/models.go b/internal/storage/models.go index 64c9b4b..36ec432 100644 --- a/internal/storage/models.go +++ b/internal/storage/models.go @@ -76,9 +76,9 @@ type ResourceListQuery struct { // StorageStats provides storage statistics. type StorageStats struct { - TotalResources int64 `json:"totalResources"` - TotalRevisions int64 `json:"totalRevisions"` - StorageBytes int64 `json:"storageBytes"` + TotalResources int64 `json:"totalResources"` + TotalRevisions int64 `json:"totalRevisions"` + StorageBytes int64 `json:"storageBytes"` OldestRevision *time.Time `json:"oldestRevision,omitempty"` NewestRevision *time.Time `json:"newestRevision,omitempty"` } @@ -93,10 +93,10 @@ type KindStats struct { // DiffResult represents the diff between two revisions. type DiffResult struct { - FromRevision int64 `json:"fromRevision"` - ToRevision int64 `json:"toRevision"` - Patch []byte `json:"patch"` - ChangedPaths []string `json:"changedPaths"` - FromSnapshot []byte `json:"fromSnapshot"` - ToSnapshot []byte `json:"toSnapshot"` + FromRevision int64 `json:"fromRevision"` + ToRevision int64 `json:"toRevision"` + Patch []byte `json:"patch"` + ChangedPaths []string `json:"changedPaths"` + FromSnapshot []byte `json:"fromSnapshot"` + ToSnapshot []byte `json:"toSnapshot"` } From bc6a32316ade5c222de7516f3904654c26c0ad40 Mon Sep 17 00:00:00 2001 From: Fixer38 Date: Sat, 11 Apr 2026 21:40:04 +0200 Subject: [PATCH 2/2] fix: issue with metrics server being parsed but not used when creating the manager config --- cmd/kflashback/main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/kflashback/main.go b/cmd/kflashback/main.go index d462ab0..27375ce 100644 --- a/cmd/kflashback/main.go +++ b/cmd/kflashback/main.go @@ -12,12 +12,13 @@ import ( "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/dynamic" + clientgoscheme "k8s.io/client-go/kubernetes/scheme" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/healthz" "sigs.k8s.io/controller-runtime/pkg/log/zap" + metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" flashbackv1alpha1 "github.com/kflashback/kflashback/api/v1alpha1" "github.com/kflashback/kflashback/internal/config" @@ -117,8 +118,11 @@ func main() { mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ Scheme: scheme, HealthProbeBindAddress: cfg.HealthAddress, - LeaderElection: cfg.LeaderElection, - LeaderElectionID: "kflashback.flashback.io", + Metrics: metricsserver.Options{ + BindAddress: cfg.MetricsAddress, + }, + LeaderElection: cfg.LeaderElection, + LeaderElectionID: "kflashback.flashback.io", }) if err != nil { setupLog.Error(err, "unable to create manager")