Skip to content

Commit 645e06c

Browse files
refactor
Signed-off-by: Yaroslav Borbat <yaroslav.borbat@flant.com>
1 parent d08bdd9 commit 645e06c

23 files changed

Lines changed: 505 additions & 213 deletions

File tree

images/virtualization-artifact/Taskfile.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ includes:
77
api:
88
taskfile: ../../api/Taskfile.dist.yaml
99
dir: ../../api
10+
config:
11+
taskfile: pkg/config/apis/Taskfile.yaml
12+
dir: pkg/config/apis
1013

1114
vars:
1215
BaseNamespace: d8-virtualization

images/virtualization-artifact/cmd/virtualization-controller/app/app.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 app
218

319
import (

images/virtualization-artifact/cmd/virtualization-controller/app/controller.go

Lines changed: 49 additions & 4 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 app
218

319
import (
@@ -34,19 +50,48 @@ var controllers = map[string]func(
3450
virtualizationClient kubeclient.Client,
3551
) error{
3652
cvi.ControllerName: func(ctx context.Context, mgr manager.Manager, log *log.Logger, configuration *componentconfig.VirtualizationControllerConfiguration, virtualizationClient kubeclient.Client) error {
37-
_, err := cvi.NewController(ctx, mgr, log, configuration.Spec.ImportSettings.ImporterImage, configuration.Spec.ImportSettings.UploaderImage, configuration.Spec.ImportSettings.Requirements, config.ToLegacyDVCR(configuration), configuration.Spec.Namespace)
53+
_, err := cvi.NewController(ctx,
54+
mgr,
55+
log,
56+
configuration.Spec.ImportSettings.ImporterImage,
57+
configuration.Spec.ImportSettings.UploaderImage,
58+
configuration.Spec.ImportSettings.Requirements,
59+
config.ToLegacyDVCR(configuration),
60+
configuration.Spec.Namespace)
3861
return err
3962
},
4063
vd.ControllerName: func(ctx context.Context, mgr manager.Manager, log *log.Logger, configuration *componentconfig.VirtualizationControllerConfiguration, virtualizationClient kubeclient.Client) error {
41-
_, err := vd.NewController(ctx, mgr, log, configuration.Spec.ImportSettings.ImporterImage, configuration.Spec.ImportSettings.UploaderImage, configuration.Spec.ImportSettings.Requirements, config.ToLegacyDVCR(configuration), config.ToLegacyVirtualDiskStorageClassSettings(configuration))
64+
_, err := vd.NewController(
65+
ctx,
66+
mgr,
67+
log,
68+
configuration.Spec.ImportSettings.ImporterImage,
69+
configuration.Spec.ImportSettings.UploaderImage,
70+
configuration.Spec.ImportSettings.Requirements,
71+
config.ToLegacyDVCR(configuration),
72+
config.ToLegacyVirtualDiskStorageClassSettings(configuration))
4273
return err
4374
},
4475
vi.ControllerName: func(ctx context.Context, mgr manager.Manager, log *log.Logger, configuration *componentconfig.VirtualizationControllerConfiguration, virtualizationClient kubeclient.Client) error {
45-
_, err := vi.NewController(ctx, mgr, log, configuration.Spec.ImportSettings.ImporterImage, configuration.Spec.ImportSettings.UploaderImage, configuration.Spec.ImportSettings.BounderImage, configuration.Spec.ImportSettings.Requirements, config.ToLegacyDVCR(configuration), config.ToLegacyVirtualImageStorageClassSettings(configuration))
76+
_, err := vi.NewController(
77+
ctx,
78+
mgr,
79+
log,
80+
configuration.Spec.ImportSettings.ImporterImage,
81+
configuration.Spec.ImportSettings.UploaderImage,
82+
configuration.Spec.ImportSettings.BounderImage,
83+
configuration.Spec.ImportSettings.Requirements,
84+
config.ToLegacyDVCR(configuration),
85+
config.ToLegacyVirtualImageStorageClassSettings(configuration))
4686
return err
4787
},
4888
vm.ControllerName: func(ctx context.Context, mgr manager.Manager, log *log.Logger, configuration *componentconfig.VirtualizationControllerConfiguration, virtualizationClient kubeclient.Client) error {
49-
return vm.SetupController(ctx, mgr, log, config.ToLegacyDVCR(configuration), configuration.Spec.FirmwareImage)
89+
return vm.SetupController(
90+
ctx,
91+
mgr,
92+
log,
93+
config.ToLegacyDVCR(configuration),
94+
configuration.Spec.FirmwareImage)
5095
},
5196
vm.GCVMMigrationControllerName: func(ctx context.Context, mgr manager.Manager, log *log.Logger, configuration *componentconfig.VirtualizationControllerConfiguration, virtualizationClient kubeclient.Client) error {
5297
return vm.SetupGC(mgr, log, configuration.Spec.GarbageCollector.VMIMigration)

images/virtualization-artifact/cmd/virtualization-controller/app/scheme.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 app
218

319
import (

images/virtualization-artifact/cmd/virtualization-controller/main.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 main
218

319
import (
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
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
// +k8s:deepcopy-gen=package,register
218
package componentconfig

images/virtualization-artifact/pkg/config/apis/componentconfig/generated/openapi/zz_generated.openapi.go

Lines changed: 17 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

images/virtualization-artifact/pkg/config/apis/componentconfig/register.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 componentconfig
218

319
import (

images/virtualization-artifact/pkg/config/apis/componentconfig/types.go

Lines changed: 22 additions & 12 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 componentconfig
218

319
import (
@@ -24,6 +40,7 @@ type VirtualizationControllerConfigurationSpec struct {
2440
VirtualDiskStorageClassSettings VirtualDiskStorageClassSettings
2541
ImportSettings ImportSettings
2642
DVCR DVCR
43+
Ingress Ingress
2744
}
2845

2946
type GarbageCollector struct {
@@ -57,23 +74,16 @@ type ImportSettings struct {
5774
type DVCR struct {
5875
// AuthSecret is a name of the Secret with docker authentication.
5976
AuthSecret string
60-
// AuthSecretNamespace is a namespace for the AuthSecret.
61-
AuthSecretNamespace string
6277
// CertsSecret is a name of the TLS Secret with DVCR certificates (only CA cert is used).
6378
CertsSecret string
64-
// CertsSecretNamespace is a namespace for the CertsSecret.
65-
CertsSecretNamespace string
6679
// RegistryURL is a registry hostname with optional endpoint.
6780
RegistryURL string
6881
// InsecureTLS specifies if registry is insecure (trust all certificates). Works for destination only.
69-
InsecureTLS string
70-
// UploaderIngressSettings are settings for uploading images to the DVCR using ingress.
71-
UploaderIngressSettings UploaderIngressSettings
82+
InsecureTLS bool
7283
}
7384

74-
type UploaderIngressSettings struct {
75-
Host string
76-
TLSSecret string
77-
TLSSecretNamespace string
78-
Class string
85+
type Ingress struct {
86+
Host string
87+
TLSSecret string
88+
Class string
7989
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
17+
package v1alpha1
18+
19+
import "k8s.io/apimachinery/pkg/runtime"
20+
21+
func addDefaultingFuncs(scheme *runtime.Scheme) error {
22+
return nil
23+
}

0 commit comments

Comments
 (0)