Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update exit code at .golangci.yaml #110

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ kubeconfig
!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.vscode
.idea
*.swp
*.swo
Expand Down
7 changes: 1 addition & 6 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ linters-settings:
require-specific: true

linters:
disable-all: true
enable:
- bodyclose
- depguard
Expand Down Expand Up @@ -53,10 +52,6 @@ linters:
- unparam
- whitespace
- unused
# Deprecated
- varcheck
- structcheck
- deadcode

run:
issues-exit-code: 0
issues-exit-code: 1
4 changes: 2 additions & 2 deletions api/v1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1 contains API Schema definitions for the discoblocks.ondat.io v1 API group
//+kubebuilder:object:generate=true
//+groupName=discoblocks.ondat.io
// +kubebuilder:object:generate=true
// +groupName=discoblocks.ondat.io
package v1

import (
Expand Down
2 changes: 1 addition & 1 deletion controllers/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type NodeReconciler struct {
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
func (r *NodeReconciler) Reconcile(_ context.Context, _ ctrl.Request) (ctrl.Result, error) {
return ctrl.Result{}, nil
}

Expand Down
3 changes: 2 additions & 1 deletion controllers/pvc_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ func (r *PVCReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
}

// MonitorVolumes monitors volumes periodycally
//
//nolint:gocyclo // It is complex we know
func (r *PVCReconciler) MonitorVolumes() {
logger := logf.Log.WithName("VolumeMonitor")
Expand Down Expand Up @@ -571,7 +572,7 @@ func (r *PVCReconciler) createPVC(config *discoblocksondatiov1.DiskConfig, pod *
}
logger = logger.WithValues("pvc_name", pvc.Name)

utils.PVCDecorator(config, prefix, driver, pvc)
utils.PVCDecorator(config, pvc)

scAllowedTopology, err := driver.GetStorageClassAllowedTopology(node)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion mutators/pod_mutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type PodMutator struct {
//+kubebuilder:webhook:path=/mutate-v1-pod,mutating=true,sideEffects=NoneOnDryRun,failurePolicy=fail,groups="",resources=pods,verbs=create,versions=v1,admissionReviewVersions=v1,name=mpod.kb.io

// Handle pod mutation
//
//nolint:gocyclo // It is complex we know
func (a *PodMutator) Handle(ctx context.Context, req admission.Request) admission.Response {
logger := podMutatorLog.WithValues("req_name", req.Name, "namespace", req.Namespace)
Expand Down Expand Up @@ -213,7 +214,7 @@ func (a *PodMutator) Handle(ctx context.Context, req admission.Request) admissio
}
logger = logger.WithValues("pvc_name", pvc.Name)

utils.PVCDecorator(&config, prefix, driver, pvc)
utils.PVCDecorator(&config, pvc)

pvcNamesWithMount := map[string]string{
pvc.Name: utils.RenderMountPoint(config.Spec.MountPointPattern, pvc.Name, 0),
Expand Down
3 changes: 1 addition & 2 deletions pkg/utils/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

discoblocksondatiov1 "github.com/ondat/discoblocks/api/v1"
"github.com/ondat/discoblocks/pkg/drivers"
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -244,7 +243,7 @@ func RenderResizeJob(podName, pvcName, pvName, namespace, nodeName, fs, preResiz
}

// PVCDecorator decorates new PVC instance
func PVCDecorator(config *discoblocksondatiov1.DiskConfig, prefix string, driver *drivers.Driver, pvc *corev1.PersistentVolumeClaim) {
func PVCDecorator(config *discoblocksondatiov1.DiskConfig, pvc *corev1.PersistentVolumeClaim) {
pvc.Finalizers = []string{RenderFinalizer(config.Name)}

pvc.Labels = map[string]string{
Expand Down
4 changes: 2 additions & 2 deletions schedulers/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (s *podSCheduler) Name() string {
}

// Filter does the filtering
func (s *podSCheduler) Filter(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, nodeInfo *framework.NodeInfo) *framework.Status {
func (s *podSCheduler) Filter(ctx context.Context, _ *framework.CycleState, pod *corev1.Pod, nodeInfo *framework.NodeInfo) *framework.Status {
logger := s.logger.WithValues("pod_name", pod.Name, "namespace", pod.Namespace, "node", nodeInfo.Node().Name)

errorStatus := framework.Success
Expand Down Expand Up @@ -149,6 +149,6 @@ func (s *podSCheduler) Filter(ctx context.Context, state *framework.CycleState,
}

// Factory framework compatible factory
func (s *podSCheduler) Factory(configuration runtime.Object, f framework.Handle) (framework.Plugin, error) {
func (s *podSCheduler) Factory(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
return s, nil
}