Skip to content

Commit ea58ca8

Browse files
authored
[release-1.5] Disable default workloadUpdates strategies (#1578)
Enabling workloadUpdates strategies by default can expose unexpected behaviours. Temporary disable it until we properly covered all the corner cases. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=2017394 This is a manual cherry pick of #1577 Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
1 parent f5b767a commit ea58ca8

File tree

11 files changed

+21
-94
lines changed

11 files changed

+21
-94
lines changed

deploy/crds/hco00.crd.yaml

+1-10
Original file line numberDiff line numberDiff line change
@@ -1294,32 +1294,23 @@ spec:
12941294
providers
12951295
type: string
12961296
workloadUpdateStrategy:
1297-
default:
1298-
batchEvictionInterval: 1m0s
1299-
batchEvictionSize: 10
1300-
workloadUpdateMethods:
1301-
- LiveMigrate
13021297
description: WorkloadUpdateStrategy defines at the cluster level how
13031298
to handle automated workload updates
13041299
properties:
13051300
batchEvictionInterval:
1306-
default: 1m0s
13071301
description: BatchEvictionInterval Represents the interval to
13081302
wait before issuing the next batch of shutdowns
13091303
type: string
13101304
batchEvictionSize:
1311-
default: 10
13121305
description: BatchEvictionSize Represents the number of VMIs that
13131306
can be forced updated per the BatchShutdownInteral interval
13141307
type: integer
13151308
workloadUpdateMethods:
1316-
default:
1317-
- LiveMigrate
13181309
description: WorkloadUpdateMethods defines the methods that can
13191310
be used to disrupt workloads during automated workload updates.
13201311
When multiple methods are present, the least disruptive method
13211312
takes precedence over more disruptive methods. For example if
1322-
both LiveMigrate and Shutdown methods are listed, only VMs which
1313+
both LiveMigrate and Evict methods are listed, only VMs which
13231314
are not live migratable will be restarted/shutdown. An empty
13241315
list defaults to no automated workload updating.
13251316
items:

deploy/hco.cr.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,4 @@ spec:
2020
parallelMigrationsPerCluster: 5
2121
parallelOutboundMigrationsPerNode: 2
2222
progressTimeout: 150
23-
workloadUpdateStrategy:
24-
batchEvictionInterval: 1m0s
25-
batchEvictionSize: 10
26-
workloadUpdateMethods:
27-
- LiveMigrate
2823
workloads: {}

deploy/index-image/community-kubevirt-hyperconverged/1.5.0/manifests/hco00.crd.yaml

+1-10
Original file line numberDiff line numberDiff line change
@@ -1294,32 +1294,23 @@ spec:
12941294
providers
12951295
type: string
12961296
workloadUpdateStrategy:
1297-
default:
1298-
batchEvictionInterval: 1m0s
1299-
batchEvictionSize: 10
1300-
workloadUpdateMethods:
1301-
- LiveMigrate
13021297
description: WorkloadUpdateStrategy defines at the cluster level how
13031298
to handle automated workload updates
13041299
properties:
13051300
batchEvictionInterval:
1306-
default: 1m0s
13071301
description: BatchEvictionInterval Represents the interval to
13081302
wait before issuing the next batch of shutdowns
13091303
type: string
13101304
batchEvictionSize:
1311-
default: 10
13121305
description: BatchEvictionSize Represents the number of VMIs that
13131306
can be forced updated per the BatchShutdownInteral interval
13141307
type: integer
13151308
workloadUpdateMethods:
1316-
default:
1317-
- LiveMigrate
13181309
description: WorkloadUpdateMethods defines the methods that can
13191310
be used to disrupt workloads during automated workload updates.
13201311
When multiple methods are present, the least disruptive method
13211312
takes precedence over more disruptive methods. For example if
1322-
both LiveMigrate and Shutdown methods are listed, only VMs which
1313+
both LiveMigrate and Evict methods are listed, only VMs which
13231314
are not live migratable will be restarted/shutdown. An empty
13241315
list defaults to no automated workload updating.
13251316
items:

deploy/olm-catalog/community-kubevirt-hyperconverged/1.5.0/manifests/hco00.crd.yaml

+1-10
Original file line numberDiff line numberDiff line change
@@ -1294,32 +1294,23 @@ spec:
12941294
providers
12951295
type: string
12961296
workloadUpdateStrategy:
1297-
default:
1298-
batchEvictionInterval: 1m0s
1299-
batchEvictionSize: 10
1300-
workloadUpdateMethods:
1301-
- LiveMigrate
13021297
description: WorkloadUpdateStrategy defines at the cluster level how
13031298
to handle automated workload updates
13041299
properties:
13051300
batchEvictionInterval:
1306-
default: 1m0s
13071301
description: BatchEvictionInterval Represents the interval to
13081302
wait before issuing the next batch of shutdowns
13091303
type: string
13101304
batchEvictionSize:
1311-
default: 10
13121305
description: BatchEvictionSize Represents the number of VMIs that
13131306
can be forced updated per the BatchShutdownInteral interval
13141307
type: integer
13151308
workloadUpdateMethods:
1316-
default:
1317-
- LiveMigrate
13181309
description: WorkloadUpdateMethods defines the methods that can
13191310
be used to disrupt workloads during automated workload updates.
13201311
When multiple methods are present, the least disruptive method
13211312
takes precedence over more disruptive methods. For example if
1322-
both LiveMigrate and Shutdown methods are listed, only VMs which
1313+
both LiveMigrate and Evict methods are listed, only VMs which
13231314
are not live migratable will be restarted/shutdown. An empty
13241315
list defaults to no automated workload updating.
13251316
items:

docs/api.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ HyperConvergedSpec defines the desired state of HyperConverged
132132
| obsoleteCPUs | ObsoleteCPUs allows avoiding scheduling of VMs for obsolete CPU models | *[HyperConvergedObsoleteCPUs](#hyperconvergedobsoletecpus) | | false |
133133
| commonTemplatesNamespace | CommonTemplatesNamespace defines namespace in which common templates will be deployed. It overrides the default openshift namespace. | *string | | false |
134134
| storageImport | StorageImport contains configuration for importing containerized data | *[StorageImportConfig](#storageimportconfig) | | false |
135-
| workloadUpdateStrategy | WorkloadUpdateStrategy defines at the cluster level how to handle automated workload updates | *[HyperConvergedWorkloadUpdateStrategy](#hyperconvergedworkloadupdatestrategy) | {"workloadUpdateMethods": {"LiveMigrate"}, "batchEvictionSize": 10, "batchEvictionInterval": "1m0s"} | false |
135+
| workloadUpdateStrategy | WorkloadUpdateStrategy defines at the cluster level how to handle automated workload updates | *[HyperConvergedWorkloadUpdateStrategy](#hyperconvergedworkloadupdatestrategy) | | false |
136136

137137
[Back to TOC](#table-of-contents)
138138

@@ -155,9 +155,9 @@ HyperConvergedWorkloadUpdateStrategy defines options related to updating a KubeV
155155

156156
| Field | Description | Scheme | Default | Required |
157157
| ----- | ----------- | ------ | -------- |-------- |
158-
| workloadUpdateMethods | WorkloadUpdateMethods defines the methods that can be used to disrupt workloads during automated workload updates. When multiple methods are present, the least disruptive method takes precedence over more disruptive methods. For example if both LiveMigrate and Shutdown methods are listed, only VMs which are not live migratable will be restarted/shutdown. An empty list defaults to no automated workload updating. | []string | {"LiveMigrate"} | false |
159-
| batchEvictionSize | BatchEvictionSize Represents the number of VMIs that can be forced updated per the BatchShutdownInteral interval | *int | 10 | false |
160-
| batchEvictionInterval | BatchEvictionInterval Represents the interval to wait before issuing the next batch of shutdowns | *metav1.Duration | "1m0s" | false |
158+
| workloadUpdateMethods | WorkloadUpdateMethods defines the methods that can be used to disrupt workloads during automated workload updates. When multiple methods are present, the least disruptive method takes precedence over more disruptive methods. For example if both LiveMigrate and Evict methods are listed, only VMs which are not live migratable will be restarted/shutdown. An empty list defaults to no automated workload updating. | []string | | false |
159+
| batchEvictionSize | BatchEvictionSize Represents the number of VMIs that can be forced updated per the BatchShutdownInteral interval | *int | | false |
160+
| batchEvictionInterval | BatchEvictionInterval Represents the interval to wait before issuing the next batch of shutdowns | *metav1.Duration | | false |
161161

162162
[Back to TOC](#table-of-contents)
163163

docs/cluster-configuration.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -406,19 +406,15 @@ spec:
406406
commonTemplatesNamespace: kubevirt
407407
```
408408

409-
## Enable eventual launcher updates by default
410-
us the HyperConverged `spec.workloadUpdateStrategy` object to define how to handle automated workload updates at the cluster
409+
## Optionally enable launcher updates
410+
The HyperConverged `spec.workloadUpdateStrategy` defines how to handle automated workload updates at the cluster
411411
level.
412412

413413
The `workloadUpdateStrategy` fields are:
414414
* `batchEvictionInterval` - BatchEvictionInterval Represents the interval to wait before issuing the next batch of
415415
shutdowns.
416416

417-
The Default value is `1m`
418-
419417
* `batchEvictionSize` - Represents the number of VMIs that can be forced updated per the BatchShutdownInteral interval
420-
421-
The default value is `10`
422418

423419
* `workloadUpdateMethods` - defines the methods that can be used to disrupt workloads
424420
during automated workload updates.
@@ -429,7 +425,7 @@ The `workloadUpdateStrategy` fields are:
429425

430426
An empty list defaults to no automated workload updating.
431427

432-
The default values is `LiveMigrate`; `Evict` is not enabled by default being potentially disruptive for the existing workloads.
428+
The feature is not enabled by default being potentially disruptive for the existing workloads.
433429

434430
### workloadUpdateStrategy example
435431
```yaml

hack/check_defaults.sh

-22
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ FGDEFAULTS='{"sriovLiveMigration":true,"withHostPassthroughCPU":false}'
2626
LMDEFAULTS='{"completionTimeoutPerGiB":800,"parallelMigrationsPerCluster":5,"parallelOutboundMigrationsPerNode":2,"progressTimeout":150}'
2727
PERMITTED_HOST_DEVICES_DEFAULT1='{"pciDeviceSelector":"10DE:1DB6","resourceName":"nvidia.com/GV100GL_Tesla_V100"}'
2828
PERMITTED_HOST_DEVICES_DEFAULT2='{"pciDeviceSelector":"10DE:1EB8","resourceName":"nvidia.com/TU104GL_Tesla_T4"}'
29-
WORKLOAD_UPDATE_STRATEGY_DEFAULT='{"batchEvictionInterval":"1m0s","batchEvictionSize":10,"workloadUpdateMethods":["LiveMigrate"]}'
3029

3130
CERTCONFIGPATHS=(
3231
"/spec/certConfig/ca/duration"
@@ -56,14 +55,6 @@ LMPATHS=(
5655
"/spec"
5756
)
5857

59-
WORKLOAD_UPDATE_STRATEGY_PATHS=(
60-
"/spec/workloadUpdateStrategy/workloadUpdateMethods"
61-
"/spec/workloadUpdateStrategy/batchEvictionSize"
62-
"/spec/workloadUpdateStrategy/batchEvictionInterval"
63-
"/spec/workloadUpdateStrategy"
64-
"/spec"
65-
)
66-
6758
echo "Check that certConfig defaults are behaving as expected"
6859

6960
./hack/retry.sh 10 3 "${KUBECTL_BINARY} patch hco -n \"${INSTALLED_NAMESPACE}\" --type=json kubevirt-hyperconverged -p '[{ \"op\": \"replace\", \"path\": /spec, \"value\": {} }]'"
@@ -102,16 +93,3 @@ for JPATH in "${LMPATHS[@]}"; do
10293
fi
10394
sleep 2
10495
done
105-
106-
echo "Check that workloadUpdateStrategy defaults are behaving as expected"
107-
108-
./hack/retry.sh 10 3 "${KUBECTL_BINARY} patch hco -n \"${INSTALLED_NAMESPACE}\" --type=json kubevirt-hyperconverged -p '[{ \"op\": \"replace\", \"path\": /spec, \"value\": {} }]'"
109-
for JPATH in "${WORKLOAD_UPDATE_STRATEGY_PATHS[@]}"; do
110-
./hack/retry.sh 10 3 "${KUBECTL_BINARY} patch hco -n \"${INSTALLED_NAMESPACE}\" --type='json' kubevirt-hyperconverged -p '[{ \"op\": \"remove\", \"path\": '\"${JPATH}\"' }]'"
111-
WORKLOAD_UPDATE_STRATEGY=$(${KUBECTL_BINARY} get hco -n "${INSTALLED_NAMESPACE}" kubevirt-hyperconverged -o jsonpath='{.spec.workloadUpdateStrategy}')
112-
if [[ "${WORKLOAD_UPDATE_STRATEGY_DEFAULT}" != "${WORKLOAD_UPDATE_STRATEGY}" ]]; then
113-
echo "Failed checking CR defaults for workloadUpdateStrategy"
114-
exit 1
115-
fi
116-
sleep 2
117-
done

pkg/apis/hco/v1beta1/hyperconverged_types.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ type HyperConvergedSpec struct {
8686
StorageImport *StorageImportConfig `json:"storageImport,omitempty"`
8787

8888
// WorkloadUpdateStrategy defines at the cluster level how to handle automated workload updates
89-
// +kubebuilder:default={"workloadUpdateMethods": {"LiveMigrate"}, "batchEvictionSize": 10, "batchEvictionInterval": "1m0s"}
9089
// +optional
9190
WorkloadUpdateStrategy *HyperConvergedWorkloadUpdateStrategy `json:"workloadUpdateStrategy,omitempty"`
9291
}
@@ -282,26 +281,23 @@ type HyperConvergedWorkloadUpdateStrategy struct {
282281
// WorkloadUpdateMethods defines the methods that can be used to disrupt workloads
283282
// during automated workload updates.
284283
// When multiple methods are present, the least disruptive method takes
285-
// precedence over more disruptive methods. For example if both LiveMigrate and Shutdown
284+
// precedence over more disruptive methods. For example if both LiveMigrate and Evict
286285
// methods are listed, only VMs which are not live migratable will be restarted/shutdown.
287286
// An empty list defaults to no automated workload updating.
288287
//
289288
// +listType=atomic
290-
// +kubebuilder:default={"LiveMigrate"}
291289
// +optional
292290
WorkloadUpdateMethods []string `json:"workloadUpdateMethods,omitempty"`
293291

294292
// BatchEvictionSize Represents the number of VMIs that can be forced updated per
295293
// the BatchShutdownInteral interval
296294
//
297-
// +kubebuilder:default=10
298295
// +optional
299296
BatchEvictionSize *int `json:"batchEvictionSize,omitempty"`
300297

301298
// BatchEvictionInterval Represents the interval to wait before issuing the next
302299
// batch of shutdowns
303300
//
304-
// +kubebuilder:default="1m0s"
305301
// +optional
306302
BatchEvictionInterval *metav1.Duration `json:"batchEvictionInterval,omitempty"`
307303
}

pkg/components/components.go

-8
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,6 @@ func GetOperatorCR() *hcov1beta1.HyperConverged {
797797
parallelOutboundMigrationsPerNode := uint32(2)
798798
progressTimeout := int64(150)
799799

800-
batchEvictionSize := 10
801-
batchEvictionInterval := metav1.Duration{Duration: 1 * time.Minute}
802-
803800
return &hcov1beta1.HyperConverged{
804801
TypeMeta: metav1.TypeMeta{
805802
APIVersion: util.APIVersion,
@@ -829,11 +826,6 @@ func GetOperatorCR() *hcov1beta1.HyperConverged {
829826
ParallelOutboundMigrationsPerNode: &parallelOutboundMigrationsPerNode,
830827
ProgressTimeout: &progressTimeout,
831828
},
832-
WorkloadUpdateStrategy: &hcov1beta1.HyperConvergedWorkloadUpdateStrategy{
833-
WorkloadUpdateMethods: []string{"LiveMigrate"},
834-
BatchEvictionSize: &batchEvictionSize,
835-
BatchEvictionInterval: &batchEvictionInterval,
836-
},
837829
LocalStorageClassName: "",
838830
},
839831
}

pkg/controller/operands/kubevirt_test.go

+7-13
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ Version: 1.2.3`)
17261726
Expect(req.Conditions).To(BeEmpty())
17271727
})
17281728

1729-
It("should set Workload Update Strategy to defaults if missing in HCO CR", func() {
1729+
It("should not set Workload Update Strategy if missing in HCO CR", func() {
17301730
existingResource := NewKubeVirtWithNameOnly(hco)
17311731

17321732
cl := commonTestUtils.InitClient([]runtime.Object{hco})
@@ -1745,14 +1745,7 @@ Version: 1.2.3`)
17451745

17461746
Expect(foundResource.Spec.WorkloadUpdateStrategy).ToNot(BeNil())
17471747
kvUpdateStrategy := foundResource.Spec.WorkloadUpdateStrategy
1748-
Expect(kvUpdateStrategy.BatchEvictionInterval.Duration.String()).Should(Equal("1m0s"))
1749-
Expect(*kvUpdateStrategy.BatchEvictionSize).Should(Equal(defaultBatchEvictionSize))
1750-
Expect(kvUpdateStrategy.WorkloadUpdateMethods).Should(HaveLen(1))
1751-
Expect(kvUpdateStrategy.WorkloadUpdateMethods).Should(
1752-
ContainElements(
1753-
kubevirtv1.WorkloadUpdateMethodLiveMigrate,
1754-
),
1755-
)
1748+
Expect(kvUpdateStrategy.WorkloadUpdateMethods).Should(HaveLen(0))
17561749

17571750
Expect(req.Conditions).To(BeEmpty())
17581751
})
@@ -1763,10 +1756,11 @@ Version: 1.2.3`)
17631756
Expect(err).ToNot(HaveOccurred())
17641757

17651758
modifiedBatchEvictionSize := 5
1766-
hco.Spec.WorkloadUpdateStrategy.WorkloadUpdateMethods = []string{"aaa", "bbb", "ccc"}
1767-
hco.Spec.WorkloadUpdateStrategy.BatchEvictionInterval = &metav1.Duration{Duration: time.Minute * 3}
1768-
hco.Spec.WorkloadUpdateStrategy.BatchEvictionSize = &modifiedBatchEvictionSize
1769-
1759+
hco.Spec.WorkloadUpdateStrategy = &hcov1beta1.HyperConvergedWorkloadUpdateStrategy{
1760+
WorkloadUpdateMethods: []string{"aaa", "bbb", "ccc"},
1761+
BatchEvictionSize: &modifiedBatchEvictionSize,
1762+
BatchEvictionInterval: &metav1.Duration{Duration: time.Minute * 3},
1763+
}
17701764
cl := commonTestUtils.InitClient([]runtime.Object{hco, existingKv})
17711765
handler := (*genericOperand)(newKubevirtHandler(cl, commonTestUtils.GetScheme()))
17721766
res := handler.ensure(req)

tools/util/marshaller.go

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ func fixQuoteIssues(yamlBytes []byte) []byte {
8686
s = strings.Replace(s, " '\"", " \"", -1)
8787
s = strings.Replace(s, "\"'\n", "\"\n", -1)
8888

89+
// fix quoted empty square brackets by removing unneeded single quotes...
90+
s = strings.Replace(s, " '[]'", " []", -1)
91+
8992
yamlBytes = []byte(s)
9093
return yamlBytes
9194
}

0 commit comments

Comments
 (0)