diff --git a/cmd/maintenance/create/options.go b/cmd/maintenance/create/options.go index deb76bf..75de571 100644 --- a/cmd/maintenance/create/options.go +++ b/cmd/maintenance/create/options.go @@ -9,6 +9,7 @@ import ( "google.golang.org/protobuf/types/known/durationpb" "github.com/ydb-platform/ydb-go-genproto/draft/protos/Ydb_Maintenance" + "github.com/ydb-platform/ydbops/cmd/restart" "github.com/ydb-platform/ydbops/pkg/client/cms" "github.com/ydb-platform/ydbops/pkg/cmdutil" @@ -49,12 +50,12 @@ func (o *Options) nodeIdsToNodes( ) []*Ydb_Maintenance.Node { targetedNodes := []*Ydb_Maintenance.Node{} - // TODO @jorres arguments to PrepareRestarters are a dirty hack. - // We actually only need Filter component from restarters. 2 and 3 arguments - // are required in PrepareRestarters to actually perform node restarts, - // but we only use restarters in the scope of this function to filter nodes - // so their value does not matter. Splitting something like 'Filterers' from - // Restarters into separate interface should solve this. + // TODO @jorres arguments to PrepareRestarters are a dirty hack. + // We actually only need Filter component from restarters. 2 and 3 arguments + // are required in PrepareRestarters to actually perform node restarts, + // but we only use restarters in the scope of this function to filter nodes + // so their value does not matter. Splitting something like 'Filterers' from + // Restarters into separate interface should solve this. storageRestarter, tenantRestarter := restart.PrepareRestarters( &o.FilteringOptions, []string{}, diff --git a/cmd/restart/options.go b/cmd/restart/options.go index f9a678f..95c9350 100644 --- a/cmd/restart/options.go +++ b/cmd/restart/options.go @@ -25,9 +25,9 @@ func PrepareRestarters( sshArgs []string, customSystemdUnitName string, restartDuration int, -) (restarters.Restarter, restarters.Restarter) { +) (storage, tenant restarters.Restarter) { if opts.KubeconfigPath != "" { - storageRestarter := restarters.NewStorageK8sRestarter( + storage = restarters.NewStorageK8sRestarter( options.Logger, &restarters.StorageK8sRestarterOptions{ K8sRestarterOptions: &restarters.K8sRestarterOptions{ @@ -37,7 +37,7 @@ func PrepareRestarters( }, }, ) - tenantRestarter := restarters.NewTenantK8sRestarter( + tenant = restarters.NewTenantK8sRestarter( options.Logger, &restarters.TenantK8sRestarterOptions{ K8sRestarterOptions: &restarters.K8sRestarterOptions{ @@ -47,20 +47,20 @@ func PrepareRestarters( }, }, ) - return storageRestarter, tenantRestarter + return storage, tenant } - storageRestarter := restarters.NewStorageSSHRestarter( + storage = restarters.NewStorageSSHRestarter( options.Logger, sshArgs, customSystemdUnitName, ) - tenantRestarter := restarters.NewTenantSSHRestarter( + tenant = restarters.NewTenantSSHRestarter( options.Logger, sshArgs, customSystemdUnitName, ) - return storageRestarter, tenantRestarter + return storage, tenant } func (o *Options) Run(f cmdutil.Factory) error { diff --git a/pkg/options/filtering.go b/pkg/options/filtering.go index b9e0e50..3b9fe80 100644 --- a/pkg/options/filtering.go +++ b/pkg/options/filtering.go @@ -10,13 +10,14 @@ import ( "github.com/spf13/pflag" "github.com/ydb-platform/ydb-go-genproto/draft/protos/Ydb_Maintenance" + "github.com/ydb-platform/ydbops/internal/collections" "github.com/ydb-platform/ydbops/pkg/profile" "github.com/ydb-platform/ydbops/pkg/utils" ) const ( - DefaultMaxStaticNodeId = 50000 + DefaultMaxStaticNodeId = 50000 ) var ( diff --git a/pkg/rolling/options.go b/pkg/rolling/options.go index 782efd9..70e5fed 100644 --- a/pkg/rolling/options.go +++ b/pkg/rolling/options.go @@ -33,9 +33,7 @@ type RestartOptions struct { CustomSystemdUnitName string } -var ( - rawSSHUnparsedArgs string -) +var rawSSHUnparsedArgs string func (o *RestartOptions) Validate() error { err := o.FilteringOptions.Validate()