Skip to content

Commit 0c05825

Browse files
committed
Move the enableCommonBootImageImport field
Deprecated the `spec.featureGates.enableCommonBootImageImport` field. Added the `spec.enableCommonBootImageImport` field instead. Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
1 parent 3156c07 commit 0c05825

File tree

17 files changed

+154
-106
lines changed

17 files changed

+154
-106
lines changed

api/v1beta1/hyperconverged_types.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type HyperConvergedSpec struct {
6666

6767
// featureGates is a map of feature gate flags. Setting a flag to `true` will enable
6868
// the feature. Setting `false` or removing the feature gate, disables the feature.
69-
// +kubebuilder:default={"downwardMetrics": false, "enableCommonBootImageImport": true, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "disableMDevConfiguration": false, "persistentReservation": false, "enableApplicationAwareQuota": false}
69+
// +kubebuilder:default={"downwardMetrics": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "disableMDevConfiguration": false, "persistentReservation": false, "enableApplicationAwareQuota": false}
7070
// +optional
7171
FeatureGates HyperConvergedFeatureGates `json:"featureGates,omitempty"`
7272

@@ -243,6 +243,15 @@ type HyperConvergedSpec struct {
243243
// +default={"memoryOvercommitPercentage": 100}
244244
// +optional
245245
HigherWorkloadDensity *HigherWorkloadDensityConfiguration `json:"higherWorkloadDensity,omitempty"`
246+
247+
// Opt-in to automatic delivery/updates of the common data import cron templates.
248+
// There are two sources for the data import cron templates: hard coded list of common templates, and custom
249+
// templates that can be added to the dataImportCronTemplates field. This feature gates only control the common
250+
// templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field.
251+
// +optional
252+
// +kubebuilder:default=true
253+
// +default=true
254+
EnableCommonBootImageImport *bool `json:"enableCommonBootImageImport,omitempty"`
246255
}
247256

248257
// CertRotateConfigCA contains the tunables for TLS certificates.
@@ -411,8 +420,7 @@ type HyperConvergedFeatureGates struct {
411420
// templates that can be added to the dataImportCronTemplates field. This feature gates only control the common
412421
// templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field.
413422
// +optional
414-
// +kubebuilder:default=true
415-
// +default=true
423+
// Deprecated: use spec.enableCommonBootImageImport instead
416424
EnableCommonBootImageImport *bool `json:"enableCommonBootImageImport,omitempty"`
417425

418426
// Deprecated: This field is ignored and will be removed on the next version of the API.
@@ -839,7 +847,7 @@ type HyperConverged struct {
839847
metav1.TypeMeta `json:",inline"`
840848
metav1.ObjectMeta `json:"metadata,omitempty"`
841849

842-
// +kubebuilder:default={"certConfig": {"ca": {"duration": "48h0m0s", "renewBefore": "24h0m0s"}, "server": {"duration": "24h0m0s", "renewBefore": "12h0m0s"}},"featureGates": {"downwardMetrics": false, "enableCommonBootImageImport": true, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "disableMDevConfiguration": false, "persistentReservation": false, "enableApplicationAwareQuota": false}, "liveMigrationConfig": {"completionTimeoutPerGiB": 150, "parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150, "allowAutoConverge": false, "allowPostCopy": false}, "resourceRequirements": {"vmiCPUAllocationRatio": 10}, "uninstallStrategy": "BlockUninstallIfWorkloadsExist", "virtualMachineOptions": {"disableFreePageReporting": false, "disableSerialConsoleLog": false}}
850+
// +kubebuilder:default={"certConfig": {"ca": {"duration": "48h0m0s", "renewBefore": "24h0m0s"}, "server": {"duration": "24h0m0s", "renewBefore": "12h0m0s"}},"featureGates": {"downwardMetrics": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "disableMDevConfiguration": false, "persistentReservation": false, "enableApplicationAwareQuota": false}, "liveMigrationConfig": {"completionTimeoutPerGiB": 150, "parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150, "allowAutoConverge": false, "allowPostCopy": false}, "resourceRequirements": {"vmiCPUAllocationRatio": 10}, "uninstallStrategy": "BlockUninstallIfWorkloadsExist", "virtualMachineOptions": {"disableFreePageReporting": false, "disableSerialConsoleLog": false}, "enableCommonBootImageImport": true}
843851
// +optional
844852
Spec HyperConvergedSpec `json:"spec,omitempty"`
845853
Status HyperConvergedStatus `json:"status,omitempty"`

api/v1beta1/zz_generated.deepcopy.go

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/zz_generated.defaults.go

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/zz_generated.openapi.go

+9-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml

+10-3
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ spec:
5656
server:
5757
duration: 24h0m0s
5858
renewBefore: 12h0m0s
59+
enableCommonBootImageImport: true
5960
featureGates:
6061
deployKubeSecondaryDNS: false
6162
deployVmConsoleProxy: false
6263
disableMDevConfiguration: false
6364
downwardMetrics: false
6465
enableApplicationAwareQuota: false
65-
enableCommonBootImageImport: true
6666
persistentReservation: false
6767
liveMigrationConfig:
6868
allowAutoConverge: false
@@ -1015,6 +1015,14 @@ spec:
10151015
Default RuntimeClass can be changed when kubevirt is running, existing VMIs are not impacted till
10161016
the next restart/live-migration when they are eventually going to consume the new default RuntimeClass.
10171017
type: string
1018+
enableCommonBootImageImport:
1019+
default: true
1020+
description: |-
1021+
Opt-in to automatic delivery/updates of the common data import cron templates.
1022+
There are two sources for the data import cron templates: hard coded list of common templates, and custom
1023+
templates that can be added to the dataImportCronTemplates field. This feature gates only control the common
1024+
templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field.
1025+
type: boolean
10181026
evictionStrategy:
10191027
description: |-
10201028
EvictionStrategy defines at the cluster level if the VirtualMachineInstance should be
@@ -1039,7 +1047,6 @@ spec:
10391047
disableMDevConfiguration: false
10401048
downwardMetrics: false
10411049
enableApplicationAwareQuota: false
1042-
enableCommonBootImageImport: true
10431050
persistentReservation: false
10441051
description: |-
10451052
featureGates is a map of feature gate flags. Setting a flag to `true` will enable
@@ -1088,12 +1095,12 @@ spec:
10881095
Application Aware Quota feature
10891096
type: boolean
10901097
enableCommonBootImageImport:
1091-
default: true
10921098
description: |-
10931099
Opt-in to automatic delivery/updates of the common data import cron templates.
10941100
There are two sources for the data import cron templates: hard coded list of common templates, and custom
10951101
templates that can be added to the dataImportCronTemplates field. This feature gates only control the common
10961102
templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field.
1103+
Deprecated: use spec.enableCommonBootImageImport instead
10971104
type: boolean
10981105
enableManagedTenantQuota:
10991106
description: 'Deprecated: This field is ignored and will be removed

controllers/operands/imageStream.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ type imageStreamOperand struct {
4040
}
4141

4242
func (iso imageStreamOperand) ensure(req *common.HcoRequest) *EnsureResult {
43-
if req.Instance.Spec.FeatureGates.EnableCommonBootImageImport != nil && *req.Instance.Spec.FeatureGates.EnableCommonBootImageImport {
44-
// if the FG is set, make sure the imageStream is in place and up-to-date
45-
43+
// if the EnableCommonBootImageImport field is set, make sure the imageStream is in place and up-to-date
44+
if req.Instance.Spec.EnableCommonBootImageImport != nil && *req.Instance.Spec.EnableCommonBootImageImport {
4645
if result := iso.checkCustomNamespace(req); result != nil {
4746
return result
4847
}

controllers/operands/imageStream_test.go

+19-19
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var _ = Describe("imageStream tests", func() {
4242

4343
Context("test imageStreamHandler", func() {
4444
It("should not create the ImageStream resource if the FG is not set", func() {
45-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false)
45+
hco.Spec.EnableCommonBootImageImport = ptr.To(false)
4646

4747
getImageStreamFileLocation = func() string {
4848
return testFilesLocation
@@ -69,7 +69,7 @@ var _ = Describe("imageStream tests", func() {
6969
})
7070

7171
It("should delete the ImageStream resource if the FG is not set", func() {
72-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false)
72+
hco.Spec.EnableCommonBootImageImport = ptr.To(false)
7373

7474
getImageStreamFileLocation = func() string {
7575
return testFilesLocation
@@ -137,7 +137,7 @@ var _ = Describe("imageStream tests", func() {
137137

138138
hcoNamespace := commontestutils.NewHcoNamespace()
139139
hco := commontestutils.NewHco()
140-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
140+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
141141
eventEmitter := commontestutils.NewEventEmitterMock()
142142
ci := commontestutils.ClusterInfoMock{}
143143
cli := commontestutils.InitClient([]client.Object{hcoNamespace, hco, ci.GetCSV()})
@@ -163,7 +163,7 @@ var _ = Describe("imageStream tests", func() {
163163

164164
By("Run again, this time when the FG is false")
165165
eventEmitter.Reset()
166-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false)
166+
hco.Spec.EnableCommonBootImageImport = ptr.To(false)
167167
req = commontestutils.NewReq(hco)
168168
Expect(handler.Ensure(req)).To(Succeed())
169169

@@ -229,7 +229,7 @@ var _ = Describe("imageStream tests", func() {
229229
}
230230

231231
hco := commontestutils.NewHco()
232-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
232+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
233233
cli := commontestutils.InitClient([]client.Object{hco})
234234
handlers, err := getImageStreamHandlers(logger, cli, schemeForTest, hco)
235235
Expect(err).ToNot(HaveOccurred())
@@ -280,7 +280,7 @@ var _ = Describe("imageStream tests", func() {
280280
Expect(imageStreamNames).To(ContainElement("test-image-stream"))
281281

282282
hco := commontestutils.NewHco()
283-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
283+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
284284
By("apply the ImageStream CRs", func() {
285285
req := commontestutils.NewReq(hco)
286286
res := handlers[0].ensure(req)
@@ -344,7 +344,7 @@ var _ = Describe("imageStream tests", func() {
344344
Expect(imageStreamNames).To(ContainElement("test-image-stream"))
345345

346346
hco := commontestutils.NewHco()
347-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
347+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
348348

349349
By("apply the ImageStream CRs", func() {
350350
req := commontestutils.NewReq(hco)
@@ -417,7 +417,7 @@ var _ = Describe("imageStream tests", func() {
417417
Expect(imageStreamNames).To(ContainElement("test-image-stream"))
418418

419419
hco := commontestutils.NewHco()
420-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
420+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
421421

422422
By("apply the ImageStream CRs", func() {
423423
req := commontestutils.NewReq(hco)
@@ -486,7 +486,7 @@ var _ = Describe("imageStream tests", func() {
486486
Expect(imageStreamNames).To(ContainElement("test-image-stream"))
487487

488488
hco := commontestutils.NewHco()
489-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
489+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
490490

491491
By("apply the ImageStream CRs", func() {
492492
req := commontestutils.NewReq(hco)
@@ -555,7 +555,7 @@ var _ = Describe("imageStream tests", func() {
555555
Expect(imageStreamNames).To(ContainElement("test-image-stream"))
556556

557557
hco := commontestutils.NewHco()
558-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
558+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
559559

560560
By("apply the ImageStream CRs", func() {
561561
req := commontestutils.NewReq(hco)
@@ -625,7 +625,7 @@ var _ = Describe("imageStream tests", func() {
625625
Expect(imageStreamNames).To(ContainElement("test-image-stream"))
626626

627627
hco := commontestutils.NewHco()
628-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
628+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
629629

630630
By("apply the ImageStream CRs", func() {
631631
req := commontestutils.NewReq(hco)
@@ -702,7 +702,7 @@ var _ = Describe("imageStream tests", func() {
702702
Expect(imageStreamNames).To(ContainElement("test-image-stream"))
703703

704704
hco := commontestutils.NewHco()
705-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
705+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
706706

707707
By("apply the ImageStream CRs", func() {
708708
req := commontestutils.NewReq(hco)
@@ -753,7 +753,7 @@ var _ = Describe("imageStream tests", func() {
753753
}
754754

755755
hco := commontestutils.NewHco()
756-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
756+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
757757
hco.Spec.CommonBootImageNamespace = ptr.To(customNS)
758758

759759
cli := commontestutils.InitClient([]client.Object{hco})
@@ -781,7 +781,7 @@ var _ = Describe("imageStream tests", func() {
781781

782782
By("create imagestream in the default namespace")
783783
hco := commontestutils.NewHco()
784-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
784+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
785785
cli := commontestutils.InitClient([]client.Object{hco})
786786
handlers, err := getImageStreamHandlers(logger, cli, schemeForTest, hco)
787787
Expect(err).ToNot(HaveOccurred())
@@ -804,7 +804,7 @@ var _ = Describe("imageStream tests", func() {
804804

805805
By("replace the image stream with a new one in the custom namespace")
806806
hco = commontestutils.NewHco()
807-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
807+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
808808
hco.Spec.CommonBootImageNamespace = ptr.To(customNS)
809809
Expect(objectreferencesv1.SetObjectReference(&hco.Status.RelatedObjects, *ref)).To(Succeed())
810810

@@ -835,7 +835,7 @@ var _ = Describe("imageStream tests", func() {
835835

836836
By("create imagestream in a custom namespace")
837837
hco := commontestutils.NewHco()
838-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
838+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
839839
hco.Spec.CommonBootImageNamespace = ptr.To(customNS)
840840

841841
cli := commontestutils.InitClient([]client.Object{hco})
@@ -860,7 +860,7 @@ var _ = Describe("imageStream tests", func() {
860860

861861
By("replace the image stream with a new one in the default namespace")
862862
hco = commontestutils.NewHco()
863-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
863+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
864864
Expect(objectreferencesv1.SetObjectReference(&hco.Status.RelatedObjects, *ref)).To(Succeed())
865865

866866
req = commontestutils.NewReq(hco)
@@ -890,7 +890,7 @@ var _ = Describe("imageStream tests", func() {
890890

891891
By("create imagestream in a custom namespace")
892892
hco := commontestutils.NewHco()
893-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
893+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
894894
hco.Spec.CommonBootImageNamespace = ptr.To(customNS)
895895

896896
cli := commontestutils.InitClient([]client.Object{hco})
@@ -915,7 +915,7 @@ var _ = Describe("imageStream tests", func() {
915915

916916
By("replace the image stream with a new one in another custom namespace")
917917
hco = commontestutils.NewHco()
918-
hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true)
918+
hco.Spec.EnableCommonBootImageImport = ptr.To(true)
919919
hco.Spec.CommonBootImageNamespace = ptr.To(customNS + "1")
920920
Expect(objectreferencesv1.SetObjectReference(&hco.Status.RelatedObjects, *ref)).To(Succeed())
921921

controllers/operands/ssp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func getDataImportCronTemplates(hc *hcov1beta1.HyperConverged) ([]hcov1beta1.Dat
238238
}
239239

240240
var dictList []hcov1beta1.DataImportCronTemplateStatus
241-
if hc.Spec.FeatureGates.EnableCommonBootImageImport != nil && *hc.Spec.FeatureGates.EnableCommonBootImageImport {
241+
if hc.Spec.EnableCommonBootImageImport != nil && *hc.Spec.EnableCommonBootImageImport {
242242
dictList = getCommonDicts(dictList, crDicts, hc)
243243
}
244244
dictList = getCustomDicts(dictList, crDicts)

0 commit comments

Comments
 (0)