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

Expose allowAutoConverge and allowPostCopy #2199

Merged
merged 1 commit into from
Jan 4, 2023
Merged
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
20 changes: 18 additions & 2 deletions api/v1beta1/hyperconverged_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type HyperConvergedSpec struct {

// Live migration limits and timeouts are applied so that migration processes do not
// overwhelm the cluster.
// +kubebuilder:default={"completionTimeoutPerGiB": 800, "parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150}
// +kubebuilder:default={"completionTimeoutPerGiB": 800, "parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150, "allowAutoConverge": false, "allowPostCopy": false}
// +optional
LiveMigrationConfig LiveMigrationConfigurations `json:"liveMigrationConfig,omitempty"`

Expand Down Expand Up @@ -253,6 +253,22 @@ type LiveMigrationConfigurations struct {
// The migrations will be performed over a dedicated multus network to minimize disruption to tenant workloads due to network saturation when VM live migrations are triggered.
// +optional
Network *string `json:"network,omitempty"`

// AllowAutoConverge allows the platform to compromise performance/availability of VMIs to
// guarantee successful VMI live migrations. Defaults to false
// +optional
// +kubebuilder:default=false
// +default=false
AllowAutoConverge *bool `json:"allowAutoConverge,omitempty"`

// AllowPostCopy enables post-copy live migrations. Such migrations allow even the busiest VMIs
// to successfully live-migrate. However, events like a network failure can cause a VMI crash.
// If set to true, migrations will still start in pre-copy, but switch to post-copy when
// CompletionTimeoutPerGiB triggers. Defaults to false
// +optional
// +kubebuilder:default=false
// +default=false
AllowPostCopy *bool `json:"allowPostCopy,omitempty"`
}

// HyperConvergedFeatureGates is a set of optional feature gates to enable or disable new features that are not enabled
Expand Down Expand Up @@ -542,7 +558,7 @@ type HyperConverged struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// +kubebuilder:default={"certConfig": {"ca": {"duration": "48h0m0s", "renewBefore": "24h0m0s"}, "server": {"duration": "24h0m0s", "renewBefore": "12h0m0s"}}, "featureGates": {"withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployKubeSecondaryDNS": false, "nonRoot": true}, "liveMigrationConfig": {"completionTimeoutPerGiB": 800, "parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150}, "uninstallStrategy": "BlockUninstallIfWorkloadsExist"}
// +kubebuilder:default={"certConfig": {"ca": {"duration": "48h0m0s", "renewBefore": "24h0m0s"}, "server": {"duration": "24h0m0s", "renewBefore": "12h0m0s"}}, "featureGates": {"withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployKubeSecondaryDNS": false, "nonRoot": true}, "liveMigrationConfig": {"completionTimeoutPerGiB": 800, "parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150, "allowAutoConverge": false, "allowPostCopy": false}, "uninstallStrategy": "BlockUninstallIfWorkloadsExist"}
// +optional
Spec HyperConvergedSpec `json:"spec,omitempty"`
Status HyperConvergedStatus `json:"status,omitempty"`
Expand Down
12 changes: 11 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion api/v1beta1/zz_generated.defaults.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion api/v1beta1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ spec:
nonRoot: true
withHostPassthroughCPU: false
liveMigrationConfig:
allowAutoConverge: false
allowPostCopy: false
completionTimeoutPerGiB: 800
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
Expand Down Expand Up @@ -1899,13 +1901,30 @@ spec:
type: object
liveMigrationConfig:
default:
allowAutoConverge: false
allowPostCopy: false
completionTimeoutPerGiB: 800
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
progressTimeout: 150
description: Live migration limits and timeouts are applied so that
migration processes do not overwhelm the cluster.
properties:
allowAutoConverge:
default: false
description: AllowAutoConverge allows the platform to compromise
performance/availability of VMIs to guarantee successful VMI
live migrations. Defaults to false
type: boolean
allowPostCopy:
default: false
description: AllowPostCopy enables post-copy live migrations.
Such migrations allow even the busiest VMIs to successfully
live-migrate. However, events like a network failure can cause
a VMI crash. If set to true, migrations will still start in
pre-copy, but switch to post-copy when CompletionTimeoutPerGiB
triggers. Defaults to false
type: boolean
bandwidthPerMigration:
description: Bandwidth limit of each migration, in MiB/s.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
Expand Down
2 changes: 2 additions & 0 deletions controllers/operands/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ func hcLiveMigrationToKv(lm hcov1beta1.LiveMigrationConfigurations) (*kubevirtco
ParallelMigrationsPerCluster: lm.ParallelMigrationsPerCluster,
ProgressTimeout: lm.ProgressTimeout,
Network: lm.Network,
AllowAutoConverge: lm.AllowAutoConverge,
AllowPostCopy: lm.AllowPostCopy,
}, nil
}

Expand Down
18 changes: 18 additions & 0 deletions controllers/operands/kubevirt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ Version: 1.2.3`)
Expect(*mc.ParallelOutboundMigrationsPerNode).Should(Equal(uint32(2)))
Expect(*mc.ProgressTimeout).Should(Equal(int64(150)))
Expect(mc.Network).Should(BeNil())
Expect(*mc.AllowAutoConverge).Should(BeFalse())
Expect(*mc.AllowPostCopy).Should(BeFalse())
})

It("should find if present", func() {
Expand Down Expand Up @@ -335,6 +337,8 @@ Version: 1.2.3`)
ParallelOutboundMigrationsPerNode: &wrongNumeric32Value,
ProgressTimeout: &wrongNumeric64Value,
Network: &network,
AllowAutoConverge: pointer.Bool(false),
AllowPostCopy: pointer.Bool(false),
}

cl := commonTestUtils.InitClient([]runtime.Object{hco, existKv})
Expand Down Expand Up @@ -388,6 +392,8 @@ Version: 1.2.3`)
Expect(*mc.ParallelOutboundMigrationsPerNode).Should(Equal(uint32(2)))
Expect(*mc.ProgressTimeout).Should(Equal(int64(150)))
Expect(mc.Network).Should(BeNil())
Expect(*mc.AllowAutoConverge).Should(BeFalse())
Expect(*mc.AllowPostCopy).Should(BeFalse())
})

It("should fail if the SMBIOS is wrongly formatted mandatory configurations", func() {
Expand Down Expand Up @@ -519,6 +525,8 @@ Version: 1.2.3`)
hco.Spec.LiveMigrationConfig.ParallelMigrationsPerCluster = &parallelMigrationsPerCluster
hco.Spec.LiveMigrationConfig.ProgressTimeout = &progressTimeout
hco.Spec.LiveMigrationConfig.Network = &network
hco.Spec.LiveMigrationConfig.AllowAutoConverge = pointer.Bool(true)
hco.Spec.LiveMigrationConfig.AllowPostCopy = pointer.Bool(true)

cl := commonTestUtils.InitClient([]runtime.Object{hco, existKv})
handler := (*genericOperand)(newKubevirtHandler(cl, commonTestUtils.GetScheme()))
Expand All @@ -543,6 +551,8 @@ Version: 1.2.3`)
Expect(*mc.ParallelMigrationsPerCluster).To(Equal(parallelMigrationsPerCluster))
Expect(*mc.ProgressTimeout).To(Equal(progressTimeout))
Expect(*mc.Network).To(Equal(network))
Expect(*mc.AllowAutoConverge).To(BeTrue())
Expect(*mc.AllowPostCopy).To(BeTrue())

// ObjectReference should have been updated
Expect(hco.Status.RelatedObjects).To(Not(BeNil()))
Expand Down Expand Up @@ -2843,6 +2853,8 @@ Version: 1.2.3`)
ParallelOutboundMigrationsPerNode: &parallelOutboundMigrationsPerNode,
ProgressTimeout: &progressTimeout,
Network: &network,
AllowAutoConverge: pointer.Bool(true),
AllowPostCopy: pointer.Bool(true),
}
mc, err := hcLiveMigrationToKv(lmc)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -2853,6 +2865,8 @@ Version: 1.2.3`)
Expect(*mc.ParallelOutboundMigrationsPerNode).Should(Equal(parallelOutboundMigrationsPerNode))
Expect(*mc.ProgressTimeout).Should(Equal(progressTimeout))
Expect(*mc.Network).Should(Equal(network))
Expect(*mc.AllowAutoConverge).Should(BeTrue())
Expect(*mc.AllowPostCopy).Should(BeTrue())
})

It("should create valid empty KV LM config from a valid empty HC LM config", func() {
Expand All @@ -2866,6 +2880,8 @@ Version: 1.2.3`)
Expect(mc.ParallelOutboundMigrationsPerNode).Should(BeNil())
Expect(mc.ProgressTimeout).Should(BeNil())
Expect(mc.Network).Should(BeNil())
Expect(mc.AllowAutoConverge).Should(BeNil())
Expect(mc.AllowPostCopy).Should(BeNil())
})

It("should return error if the value of the BandwidthPerMigration field is not valid", func() {
Expand All @@ -2877,6 +2893,8 @@ Version: 1.2.3`)
ParallelOutboundMigrationsPerNode: &parallelOutboundMigrationsPerNode,
ProgressTimeout: &progressTimeout,
Network: &network,
AllowAutoConverge: pointer.Bool(true),
AllowPostCopy: pointer.Bool(true),
}
mc, err := hcLiveMigrationToKv(lmc)
Expect(err).To(HaveOccurred())
Expand Down
19 changes: 19 additions & 0 deletions deploy/crds/hco00.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ spec:
nonRoot: true
withHostPassthroughCPU: false
liveMigrationConfig:
allowAutoConverge: false
allowPostCopy: false
completionTimeoutPerGiB: 800
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
Expand Down Expand Up @@ -1899,13 +1901,30 @@ spec:
type: object
liveMigrationConfig:
default:
allowAutoConverge: false
allowPostCopy: false
completionTimeoutPerGiB: 800
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
progressTimeout: 150
description: Live migration limits and timeouts are applied so that
migration processes do not overwhelm the cluster.
properties:
allowAutoConverge:
default: false
description: AllowAutoConverge allows the platform to compromise
performance/availability of VMIs to guarantee successful VMI
live migrations. Defaults to false
type: boolean
allowPostCopy:
default: false
description: AllowPostCopy enables post-copy live migrations.
Such migrations allow even the busiest VMIs to successfully
live-migrate. However, events like a network failure can cause
a VMI crash. If set to true, migrations will still start in
pre-copy, but switch to post-copy when CompletionTimeoutPerGiB
triggers. Defaults to false
type: boolean
bandwidthPerMigration:
description: Bandwidth limit of each migration, in MiB/s.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
Expand Down
2 changes: 2 additions & 0 deletions deploy/hco.cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
withHostPassthroughCPU: false
infra: {}
liveMigrationConfig:
allowAutoConverge: false
allowPostCopy: false
completionTimeoutPerGiB: 800
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ spec:
nonRoot: true
withHostPassthroughCPU: false
liveMigrationConfig:
allowAutoConverge: false
allowPostCopy: false
completionTimeoutPerGiB: 800
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
Expand Down Expand Up @@ -1899,13 +1901,30 @@ spec:
type: object
liveMigrationConfig:
default:
allowAutoConverge: false
allowPostCopy: false
completionTimeoutPerGiB: 800
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
progressTimeout: 150
description: Live migration limits and timeouts are applied so that
migration processes do not overwhelm the cluster.
properties:
allowAutoConverge:
default: false
description: AllowAutoConverge allows the platform to compromise
performance/availability of VMIs to guarantee successful VMI
live migrations. Defaults to false
type: boolean
allowPostCopy:
default: false
description: AllowPostCopy enables post-copy live migrations.
Such migrations allow even the busiest VMIs to successfully
live-migrate. However, events like a network failure can cause
a VMI crash. If set to true, migrations will still start in
pre-copy, but switch to post-copy when CompletionTimeoutPerGiB
triggers. Defaults to false
type: boolean
bandwidthPerMigration:
description: Bandwidth limit of each migration, in MiB/s.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ spec:
nonRoot: true
withHostPassthroughCPU: false
liveMigrationConfig:
allowAutoConverge: false
allowPostCopy: false
completionTimeoutPerGiB: 800
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
Expand Down Expand Up @@ -1899,13 +1901,30 @@ spec:
type: object
liveMigrationConfig:
default:
allowAutoConverge: false
allowPostCopy: false
completionTimeoutPerGiB: 800
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
progressTimeout: 150
description: Live migration limits and timeouts are applied so that
migration processes do not overwhelm the cluster.
properties:
allowAutoConverge:
default: false
description: AllowAutoConverge allows the platform to compromise
performance/availability of VMIs to guarantee successful VMI
live migrations. Defaults to false
type: boolean
allowPostCopy:
default: false
description: AllowPostCopy enables post-copy live migrations.
Such migrations allow even the busiest VMIs to successfully
live-migrate. However, events like a network failure can cause
a VMI crash. If set to true, migrations will still start in
pre-copy, but switch to post-copy when CompletionTimeoutPerGiB
triggers. Defaults to false
type: boolean
bandwidthPerMigration:
description: Bandwidth limit of each migration, in MiB/s.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
Expand Down
Loading