Skip to content

Commit d4a5cb2

Browse files
committed
++ linters
Signed-off-by: Ivan Mikheykin <[email protected]>
1 parent 59a3f9a commit d4a5cb2

File tree

9 files changed

+62
-43
lines changed

9 files changed

+62
-43
lines changed

.dmtlint.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ linters-settings:
4747
- cdi-sa
4848
- kubevirt-internal-virtualization-controller
4949
- kubevirt-internal-virtualization-handler
50-
module:
51-
exclude-rules:
52-
license:
53-
files:
54-
- images/hooks/cmd/virtualization-module-hooks/register-ee.go
55-
- images/hooks/pkg/hooks/tls-certificates-audit/hook.go
56-
directories:
57-
- test/
58-
- api/client/generated
59-
- hack/
60-
- images/
61-
- tools/
62-
images:
63-
# CDI patches are soon to be phased out by moving them to 3p repo
64-
patches:
65-
disable: true
50+
# module:
51+
# exclude-rules:
52+
# license:
53+
# files:
54+
# - images/hooks/cmd/virtualization-module-hooks/register-ee.go
55+
# - images/hooks/pkg/hooks/tls-certificates-audit/hook.go
56+
# directories:
57+
# - test/
58+
# - api/client/generated
59+
# - hack/
60+
# - images/
61+
# - tools/
62+
# images:
63+
# # CDI patches are soon to be phased out by moving them to 3p repo
64+
# patches:
65+
# disable: true

images/dvcr-artifact/cmd/dvcr-cleaner/cmd/kubernetes/termination_log.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2025 Flant JSC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package kubernetes
218

319
import (

images/dvcr-artifact/cmd/dvcr-cleaner/cmd/storage/stats.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2025 Flant JSC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package storage
218

319
type FSInfo struct {

images/dvcr-artifact/go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ require (
1717
github.com/prometheus/client_golang v1.19.0
1818
github.com/prometheus/client_model v0.6.0
1919
github.com/spf13/cobra v1.8.1
20+
github.com/spf13/pflag v1.0.5
2021
golang.org/x/sync v0.14.0
22+
golang.org/x/sys v0.33.0
23+
k8s.io/apimachinery v0.30.2
2124
k8s.io/klog/v2 v2.120.1
2225
kubevirt.io/containerized-data-importer v0.0.0-00010101000000-000000000000
2326
kubevirt.io/containerized-data-importer-api v1.60.3
@@ -64,9 +67,11 @@ require (
6467
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
6568
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
6669
github.com/gorilla/mux v1.8.1 // indirect
70+
github.com/gorilla/websocket v1.5.0 // indirect
6771
github.com/hashicorp/errwrap v1.1.0 // indirect
6872
github.com/hashicorp/go-cleanhttp v0.5.2
6973
github.com/inconshreveable/mousetrap v1.1.0 // indirect
74+
github.com/imdario/mergo v0.3.16 // indirect
7075
github.com/jmespath/go-jmespath v0.4.0 // indirect
7176
github.com/josharian/intern v1.0.0 // indirect
7277
github.com/json-iterator/go v1.1.12 // indirect
@@ -95,7 +100,6 @@ require (
95100
github.com/prometheus/common v0.51.1 // indirect
96101
github.com/prometheus/procfs v0.15.1 // indirect
97102
github.com/sirupsen/logrus v1.9.3 // indirect
98-
github.com/spf13/pflag v1.0.5 // indirect
99103
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
100104
github.com/ulikunitz/xz v0.5.15 // indirect
101105
github.com/vbatts/tar-split v0.11.5 // indirect
@@ -110,7 +114,6 @@ require (
110114
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
111115
golang.org/x/net v0.26.0 // indirect
112116
golang.org/x/oauth2 v0.27.0 // indirect
113-
golang.org/x/sys v0.33.0 // indirect
114117
golang.org/x/term v0.32.0 // indirect
115118
golang.org/x/text v0.25.0 // indirect
116119
golang.org/x/time v0.5.0 // indirect
@@ -125,7 +128,6 @@ require (
125128
gopkg.in/yaml.v3 v3.0.1 // indirect
126129
k8s.io/api v0.30.2 // indirect
127130
k8s.io/apiextensions-apiserver v0.30.2 // indirect
128-
k8s.io/apimachinery v0.30.2 // indirect
129131
k8s.io/apiserver v0.30.2 // indirect
130132
k8s.io/client-go v8.0.0+incompatible // indirect
131133
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect

images/dvcr-artifact/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7
203203
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
204204
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
205205
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
206+
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
207+
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
206208
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
207209
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
208210
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=

images/virtualization-artifact/pkg/controller/dvcr-maintenance/dvcr_maintenance_controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"sigs.k8s.io/controller-runtime/pkg/manager"
2828

2929
"github.com/deckhouse/deckhouse/pkg/log"
30+
"github.com/deckhouse/virtualization-controller/pkg/controller/dvcr-maintenance/internal"
3031
"github.com/deckhouse/virtualization-controller/pkg/controller/gc"
3132
"github.com/deckhouse/virtualization-controller/pkg/dvcr"
3233
"github.com/deckhouse/virtualization-controller/pkg/logger"
@@ -68,8 +69,8 @@ func NewController(
6869
return nil, err
6970
}
7071

71-
// Not an elegant solution, but it is easier to setup cron watch here.
72-
cronSource, err := gc.NewCronSource(dvcr.CleanupSchedule, gc.NewSingleObjectLister(ns, "dvcr"), log)
72+
// Not an elegant solution, but it is easier to setup cron watch here, than in internal/watcher package.
73+
cronSource, err := gc.NewCronSource(dvcr.AutoCleanupSchedule, gc.NewSingleObjectLister(ns, "dvcr"), log)
7374
if err != nil {
7475
return nil, fmt.Errorf("setup DVCR cleanup cron source: %w", err)
7576
}

images/virtualization-artifact/pkg/controller/dvcr-maintenance/dvcr_maintenance_reconciler.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
7777
func (r *Reconciler) SetupController(_ context.Context, mgr manager.Manager, ctr controller.Controller) error {
7878
for _, w := range []Watcher{
7979
watcher.NewDVCRDeploymentWatcher(mgr.GetClient()),
80-
watcher.NewCronWatcher(),
80+
// watcher.NewVirtualImageWatcher(mgr.GetClient()),
81+
// watcher.NewVirtualDiskWatcher(mgr.GetClient()),
82+
// watcher.NewClusterVirtualImageWatcher(mgr.GetClient()),
8183
} {
8284
err := w.Watch(mgr, ctr)
8385
if err != nil {

images/virtualization-artifact/pkg/controller/dvcr-maintenance/internal/watcher/cron.go

Lines changed: 0 additions & 20 deletions
This file was deleted.

templates/dvcr/configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ data:
1717
{{- if eq (include "dvcr.isMaintenance" . ) "true" }}
1818
maintenance:
1919
readonly: true
20-
{{- else }}
20+
{{- end }}
2121
http:
2222
addr: :5000
2323
headers:

0 commit comments

Comments
 (0)