stateful deployments: validate there are no sticky per_alloc volume requests (#24714)

This changeset adds an additional validation that prevents users from setting
per_alloc and sticky flags on volume requests.

Ref: #24479
This commit is contained in:
Piotr Kazmierczak
2024-12-19 15:20:09 +01:00
committed by Tim Gross
parent fea846189f
commit ad1e597796
2 changed files with 14 additions and 0 deletions

View File

@@ -165,6 +165,9 @@ func (v *VolumeRequest) Validate(jobType string, taskGroupCount, canaries int) e
if canaries > 0 {
addErr("volume cannot be per_alloc when canaries are in use")
}
if v.Sticky {
addErr("volume cannot be per_alloc and sticky at the same time")
}
}
switch v.Type {

View File

@@ -85,6 +85,17 @@ func TestVolumeRequest_Validate(t *testing.T) {
PerAlloc: true,
},
},
{
name: "per_alloc sticky",
expected: []string{
"volume cannot be per_alloc and sticky at the same time",
},
req: &VolumeRequest{
Type: VolumeTypeCSI,
PerAlloc: true,
Sticky: true,
},
},
}
for _, tc := range testCases {