mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Set default ResizePolicy in fuzzer for roundtrip tests
This commit is contained in:
parent
4bbc6f1c2c
commit
2935b106dc
@ -309,6 +309,23 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
|||||||
c.FuzzNoCustom(ct) // fuzz self without calling this function again
|
c.FuzzNoCustom(ct) // fuzz self without calling this function again
|
||||||
ct.TerminationMessagePath = "/" + ct.TerminationMessagePath // Must be non-empty
|
ct.TerminationMessagePath = "/" + ct.TerminationMessagePath // Must be non-empty
|
||||||
ct.TerminationMessagePolicy = "File"
|
ct.TerminationMessagePolicy = "File"
|
||||||
|
// Match defaulting in pkg/apis/core/v1/defaults.go.
|
||||||
|
_, hasCPUReq := ct.Resources.Requests[core.ResourceCPU]
|
||||||
|
_, hasCPULim := ct.Resources.Limits[core.ResourceCPU]
|
||||||
|
_, hasMemReq := ct.Resources.Requests[core.ResourceMemory]
|
||||||
|
_, hasMemLim := ct.Resources.Limits[core.ResourceMemory]
|
||||||
|
if hasCPUReq || hasCPULim {
|
||||||
|
ct.ResizePolicy = append(ct.ResizePolicy, core.ContainerResizePolicy{
|
||||||
|
ResourceName: core.ResourceCPU,
|
||||||
|
RestartPolicy: core.NotRequired,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if hasMemReq || hasMemLim {
|
||||||
|
ct.ResizePolicy = append(ct.ResizePolicy, core.ContainerResizePolicy{
|
||||||
|
ResourceName: core.ResourceMemory,
|
||||||
|
RestartPolicy: core.NotRequired,
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
func(ep *core.EphemeralContainer, c fuzz.Continue) {
|
func(ep *core.EphemeralContainer, c fuzz.Continue) {
|
||||||
c.FuzzNoCustom(ep) // fuzz self without calling this function again
|
c.FuzzNoCustom(ep) // fuzz self without calling this function again
|
||||||
|
Loading…
Reference in New Issue
Block a user