Skip to content

Commit

Permalink
fix: Effect must be 'NoExecute' when tolerationSeconds is set (#1740)
Browse files Browse the repository at this point in the history
effect must be 'NoExecute' when tolerationSeconds is set

Co-authored-by: guozhi.li <guozhi.li@daocloud.io>
  • Loading branch information
jiuker and guozhi.li authored Aug 24, 2023
1 parent 619699e commit c5b7586
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/tenant-handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,12 @@ func parseTenantPoolRequest(poolParams *models.Pool) (*miniov2.Pool, error) {
if elem.TolerationSeconds != nil {
// elem.TolerationSeconds.Seconds is allowed to be nil
tolerationSeconds = elem.TolerationSeconds.Seconds

if tolerationSeconds != nil {
if corev1.TaintEffect(elem.Effect) != corev1.TaintEffectNoExecute {
return nil, fmt.Errorf(`Invalid value: "%s": effect must be 'NoExecute' when tolerationSeconds is set`, elem.Effect)
}
}
}

toleration := corev1.Toleration{
Expand Down

0 comments on commit c5b7586

Please sign in to comment.