Skip to content

Commit bc3925f

Browse files
author
Pavel Okhlopkov
committed
lint
Signed-off-by: Pavel Okhlopkov <[email protected]>
1 parent 05f1b2b commit bc3925f

File tree

9 files changed

+25
-20
lines changed

9 files changed

+25
-20
lines changed

pkg/addon-operator/operator.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import (
1212
"time"
1313

1414
"github.com/deckhouse/deckhouse/pkg/log"
15+
"github.com/gofrs/uuid/v5"
16+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
17+
"k8s.io/client-go/tools/leaderelection"
18+
1519
"github.com/flant/addon-operator/pkg"
1620
"github.com/flant/addon-operator/pkg/addon-operator/converge"
1721
"github.com/flant/addon-operator/pkg/app"
@@ -42,9 +46,6 @@ import (
4246
"github.com/flant/shell-operator/pkg/task/queue"
4347
fileUtils "github.com/flant/shell-operator/pkg/utils/file"
4448
"github.com/flant/shell-operator/pkg/utils/measure"
45-
"github.com/gofrs/uuid/v5"
46-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
47-
"k8s.io/client-go/tools/leaderelection"
4849
)
4950

5051
const (
@@ -986,7 +987,7 @@ func (op *AddonOperator) DrainModuleQueues(modName string) {
986987
}
987988

988989
// ParallelTasksHandler handles limited types of tasks in parallel queues.
989-
func (op *AddonOperator) ParallelTasksHandler(ctx context.Context, t sh_task.Task) queue.TaskResult {
990+
func (op *AddonOperator) ParallelTasksHandler(_ context.Context, t sh_task.Task) queue.TaskResult {
990991
taskLogLabels := t.GetLogLabels()
991992
taskLogEntry := utils.EnrichLoggerWithLabels(op.Logger, taskLogLabels)
992993
var res queue.TaskResult
@@ -1612,15 +1613,14 @@ func (op *AddonOperator) handleQueueSynchronizationPhase(
16121613
syncTask := op.createSynchronizationTask(t, hook, info, hm)
16131614

16141615
// Sort tasks by queue destination and wait requirements
1615-
if syncTask.GetQueueName() == t.GetQueueName() {
1616+
if syncTask.GetQueueName() == t.GetQueueName() { //nolint: gocritic
16161617
mainSyncTasks = append(mainSyncTasks, syncTask)
16171618
} else if info.KubernetesBinding.WaitForSynchronization {
16181619
parallelSyncTasksToWait = append(parallelSyncTasksToWait, syncTask)
16191620
} else {
16201621
parallelSyncTasks = append(parallelSyncTasks, syncTask)
16211622
}
16221623
})
1623-
16241624
if err != nil {
16251625
logEntry.Error("Failed to enable Kubernetes bindings", log.Err(err))
16261626
return queue.TaskResult{Status: queue.Fail}
@@ -1949,7 +1949,7 @@ func (op *AddonOperator) combineModuleHookBindingContexts(
19491949
func (op *AddonOperator) executeModuleHook(
19501950
t sh_task.Task,
19511951
module *modules.BasicModule,
1952-
hook *hooks.ModuleHook,
1952+
_ *hooks.ModuleHook,
19531953
hm task.HookMetadata,
19541954
logEntry *log.Logger,
19551955
metricLabels map[string]string,
@@ -1968,7 +1968,6 @@ func (op *AddonOperator) executeModuleHook(
19681968
// Run the hook and capture value checksums
19691969
beforeChecksum, afterChecksum, err := op.ModuleManager.RunModuleHook(
19701970
hm.ModuleName, hm.HookName, hm.BindingType, hm.BindingContext, t.GetLogLabels())
1971-
19721971
// Handle hook execution errors
19731972
if err != nil {
19741973
if hm.AllowFailure {

pkg/addon-operator/operator_test.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ import (
1010
"testing"
1111

1212
"github.com/deckhouse/deckhouse/pkg/log"
13+
. "github.com/onsi/gomega"
14+
v1 "k8s.io/api/core/v1"
15+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
16+
k8types "k8s.io/apimachinery/pkg/types"
17+
"sigs.k8s.io/yaml"
18+
1319
"github.com/flant/addon-operator/pkg/addon-operator/converge"
1420
mockhelm "github.com/flant/addon-operator/pkg/helm/test/mock"
1521
mockhelmresmgr "github.com/flant/addon-operator/pkg/helm_resources_manager/test/mock"
@@ -26,11 +32,6 @@ import (
2632
sh_task "github.com/flant/shell-operator/pkg/task"
2733
"github.com/flant/shell-operator/pkg/task/queue"
2834
file_utils "github.com/flant/shell-operator/pkg/utils/file"
29-
. "github.com/onsi/gomega"
30-
v1 "k8s.io/api/core/v1"
31-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
32-
k8types "k8s.io/apimachinery/pkg/types"
33-
"sigs.k8s.io/yaml"
3435
)
3536

3637
type assembleResult struct {

pkg/module_manager/models/modules/basic.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import (
1414
"time"
1515

1616
"github.com/deckhouse/deckhouse/pkg/log"
17-
"github.com/flant/addon-operator/pkg"
1817
"github.com/gofrs/uuid/v5"
1918
"github.com/hashicorp/go-multierror"
2019
"github.com/kennygrant/sanitize"
2120

21+
"github.com/flant/addon-operator/pkg"
2222
"github.com/flant/addon-operator/pkg/app"
2323
"github.com/flant/addon-operator/pkg/hook/types"
2424
environmentmanager "github.com/flant/addon-operator/pkg/module_manager/environment_manager"

pkg/module_manager/models/modules/helm.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import (
1212
"time"
1313

1414
"github.com/deckhouse/deckhouse/pkg/log"
15-
"github.com/flant/addon-operator/pkg"
1615
"github.com/gofrs/uuid/v5"
1716
"github.com/kennygrant/sanitize"
1817

18+
"github.com/flant/addon-operator/pkg"
1919
"github.com/flant/addon-operator/pkg/helm"
2020
"github.com/flant/addon-operator/pkg/helm/client"
2121
"github.com/flant/addon-operator/pkg/utils"

pkg/module_manager/models/modules/synchronization_state.go

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"sync"
77

88
"github.com/deckhouse/deckhouse/pkg/log"
9+
910
"github.com/flant/addon-operator/pkg"
1011
)
1112

pkg/task/global-hook-enable-kubernetes-bindings/task.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"time"
99

1010
"github.com/deckhouse/deckhouse/pkg/log"
11+
"github.com/gofrs/uuid/v5"
12+
1113
"github.com/flant/addon-operator/pkg"
1214
"github.com/flant/addon-operator/pkg/addon-operator/converge"
1315
"github.com/flant/addon-operator/pkg/helm"
@@ -23,7 +25,6 @@ import (
2325
shell_operator "github.com/flant/shell-operator/pkg/shell-operator"
2426
sh_task "github.com/flant/shell-operator/pkg/task"
2527
"github.com/flant/shell-operator/pkg/task/queue"
26-
"github.com/gofrs/uuid/v5"
2728
)
2829

2930
type TaskConfig interface {
@@ -91,7 +92,7 @@ func newGlobalHookEnableKubernetesBindings(cfg *taskConfig, logger *log.Logger)
9192
return service
9293
}
9394

94-
func (s *Task) Handle(ctx context.Context) queue.TaskResult {
95+
func (s *Task) Handle(_ context.Context) queue.TaskResult {
9596
defer trace.StartRegion(context.Background(), "DiscoverHelmReleases").End()
9697

9798
taskLogLabels := s.shellTask.GetLogLabels()

pkg/task/global-hook-enable-schedule-bindings/task.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55

66
"github.com/deckhouse/deckhouse/pkg/log"
7+
78
"github.com/flant/addon-operator/pkg/module_manager"
89
"github.com/flant/addon-operator/pkg/task"
910
"github.com/flant/addon-operator/pkg/utils"
@@ -51,7 +52,7 @@ func newGlobalHookEnableScheduleBindings(cfg *taskConfig, logger *log.Logger) *T
5152
return service
5253
}
5354

54-
func (s *Task) Handle(ctx context.Context) queue.TaskResult {
55+
func (s *Task) Handle(_ context.Context) queue.TaskResult {
5556
result := queue.TaskResult{}
5657

5758
taskLogLabels := s.shellTask.GetLogLabels()

pkg/task/global-hook-run/task.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"time"
88

99
"github.com/deckhouse/deckhouse/pkg/log"
10+
1011
"github.com/flant/addon-operator/pkg"
1112
"github.com/flant/addon-operator/pkg/addon-operator/converge"
1213
"github.com/flant/addon-operator/pkg/helm"
@@ -73,7 +74,7 @@ type Task struct {
7374
metricStorage metric.Storage
7475
logger *log.Logger
7576

76-
internals task.TaskInternals
77+
// internals task.TaskInternals
7778
}
7879

7980
// newGlobalHookRun creates a new task handler service
@@ -95,7 +96,7 @@ func newGlobalHookRun(cfg *taskConfig, logger *log.Logger) *Task {
9596
return service
9697
}
9798

98-
func (s *Task) Handle(ctx context.Context) queue.TaskResult {
99+
func (s *Task) Handle(_ context.Context) queue.TaskResult {
99100
defer trace.StartRegion(context.Background(), "GlobalHookRun").End()
100101

101102
var res queue.TaskResult

pkg/task/service/service.go

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"log/slog"
66

77
"github.com/deckhouse/deckhouse/pkg/log"
8+
89
"github.com/flant/addon-operator/pkg/helm"
910
"github.com/flant/addon-operator/pkg/helm_resources_manager"
1011
"github.com/flant/addon-operator/pkg/module_manager"

0 commit comments

Comments
 (0)