Skip to content

Commit

Permalink
fix(agent): remove "toleration for all taints"
Browse files Browse the repository at this point in the history
Ref: Longhorn-5614

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang committed Mar 22, 2023
1 parent 3f05542 commit eb310ac
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,30 +397,25 @@ func (m *SupportBundleManager) getTaintToleration() []v1.Toleration {
}
taintToleration = append(taintToleration, *toleration)
}

if len(taintToleration) == 0 {
return []v1.Toleration{{Operator: v1.TolerationOpExists}}
}
return taintToleration
}

func parseToleration(taintToleration string) (*v1.Toleration, error) {
toleration := &v1.Toleration{}

// The schema should be `key=value:effect` or `key:effect`
parts := strings.Split(taintToleration, ":")
if len(parts) != 2 {
return nil, fmt.Errorf("missing key/value and effect pair")
}

keyValue := parts[0]
key, value, operator, err := parseTolerationKeyAndValue(keyValue)
key, value, operator, err := parseTolerationKeyAndValue(parts[0])
if err != nil {
return nil, err
}
toleration.Key = key
toleration.Value = value
toleration.Operator = operator
toleration := &v1.Toleration{
Key: key,
Value: value,
Operator: operator,
}
toleration.Effect, err = parseTaintEffect(parts[1])
if err != nil {
return nil, err
Expand Down

0 comments on commit eb310ac

Please sign in to comment.