mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 01:45:44 +03:00
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:
committed by
Tim Gross
parent
fea846189f
commit
ad1e597796
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user