Skip to content

Commit

Permalink
[Issue-193] Fixing lint issues (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
katarzyna-kulpa committed Nov 28, 2023
1 parent b12559c commit a3dd442
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 20 deletions.
16 changes: 5 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,40 +112,34 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exportloopref
- funlen
- gochecknoinits
- gocognit
# - goconst
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- golint
- gosimple
- gosec
- govet
- ineffassign
- interfacer
- lll
- megacheck
- misspell
# - nakedret
- scopelint
- nakedret
- staticcheck
- structcheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
- maligned
- prealloc
- dupl
- gosec

# don't enable:
# - gochecknoglobals Because of setupMgr and CrushVolumes // TODO - https://github.com/dell/csi-baremetal/issues/474
Expand Down
2 changes: 2 additions & 0 deletions pkg/constant/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ const (
RsysLabelKey = "app.kubernetes.io/instance"
// DefaultNamespace is the default namespace
DefaultNamespace = "default"
// LogLevelSlogan parameter definition
LogLevelSlogan = "--loglevel="
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func createControllerContainers(csi *csibaremetalv1.Deployment) []corev1.Contain
"--endpoint=$(CSI_ENDPOINT)",
"--namespace=$(NAMESPACE)",
"--extender=true",
"--loglevel=" + common.MatchLogLevel(c.Log.Level),
constant.LogLevelSlogan + common.MatchLogLevel(c.Log.Level),
"--healthport=" + strconv.Itoa(healthPort),
"--metrics-address=:" + strconv.Itoa(constant.PrometheusPort),
"--metrics-path=/metrics",
Expand Down
4 changes: 2 additions & 2 deletions pkg/node/node_daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func createNodeContainers(csi *csibaremetalv1.Deployment, platform *PlatformDesc
nodeImage = platform.NodeImage(node.Image)
)
args := []string{
"--loglevel=" + common.MatchLogLevel(node.Log.Level),
constant.LogLevelSlogan + common.MatchLogLevel(node.Log.Level),
"--drivemgrendpoint=" + driveMgr.Endpoint,
}
driveMgrMounts := []corev1.VolumeMount{
Expand Down Expand Up @@ -252,7 +252,7 @@ func createNodeContainers(csi *csibaremetalv1.Deployment, platform *PlatformDesc
"--nodename=$(KUBE_NODE_NAME)",
"--namespace=$(NAMESPACE)",
"--extender=true",
"--loglevel=" + common.MatchLogLevel(node.Log.Level),
constant.LogLevelSlogan + common.MatchLogLevel(node.Log.Level),
"--metrics-address=:" + strconv.Itoa(constant.PrometheusPort),
"--metrics-path=/metrics",
"--drivemgrendpoint=" + driveMgr.Endpoint,
Expand Down
2 changes: 1 addition & 1 deletion pkg/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func createNodeControllerContainers(csi *csibaremetalv1.Deployment) []corev1.Con

args := []string{
"--namespace=$(NAMESPACE)",
"--loglevel=" + common.MatchLogLevel(log.Level),
constant.LogLevelSlogan + common.MatchLogLevel(log.Level),
"--logformat=" + common.MatchLogFormat(log.Format),
}
if ns != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/patcher/scheduler_patcher_vanilla.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (p patcherConfiguration) createPatcherContainers() []corev1.Container {
"main.py",
},
Args: []string{
"--loglevel=" + common.MatchLogLevel(p.loglevel),
constant.LogLevelSlogan + common.MatchLogLevel(p.loglevel),
"--restore",
"--interval=" + strconv.Itoa(p.interval),
"--target-config-path=" + p.targetConfig,
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler_extender.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func createExtenderContainers(csi *csibaremetalv1.Deployment, isPatchingEnabled
"--provisioner=" + constant.CSIName,
"--port=" + strconv.Itoa(extenderPort),
"--healthport=" + strconv.Itoa(healthPort),
"--loglevel=" + common.MatchLogLevel(csi.Spec.Scheduler.Log.Level),
constant.LogLevelSlogan + common.MatchLogLevel(csi.Spec.Scheduler.Log.Level),
"--certFile=",
"--privateKeyFile=",
"--metrics-address=:" + strconv.Itoa(constant.PrometheusPort),
Expand Down
6 changes: 3 additions & 3 deletions pkg/validator/rbac/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (r *rbac) ValidateServiceAccountIsBound(ctx context.Context, rules *models.
Namespace: rules.Namespace,
}); err != nil {
r.log.Errorf("failed to get roles list: %s", err.Error())
return
return err
}

// check if there exists role bindings, which matches passed service account
Expand All @@ -45,7 +45,7 @@ func (r *rbac) ValidateServiceAccountIsBound(ctx context.Context, rules *models.
Namespace: rules.Namespace,
}); err != nil {
r.log.Errorf("failed to get roles list: %s", err.Error())
return
return err
}

// preparing founded role bindings refs and finding matched ones between them
Expand All @@ -68,7 +68,7 @@ func (r *rbac) ValidateServiceAccountIsBound(ctx context.Context, rules *models.
continue
}
if r.matcher.MatchPolicyRules(matchesRoles[i].Rules, rules.Role.Rules) {
return
return err
}
}
return NewRBACError(fmt.Sprintf("failed to find any roles, matched to passed service account, "+
Expand Down

0 comments on commit a3dd442

Please sign in to comment.