Commit bf984aa3 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #42120 from kevin-wangzefeng/kubectl-taint-respect-noexecute

Automatic merge from submit-queue (batch tested with PRs 41116, 41804, 42104, 42111, 42120) make kubectl taint command respect effect NoExecute **What this PR does / why we need it**: Part of feature forgiveness implementation, make kubectl taint command respect effect NoExecute. **Which issue this PR fixes**: Related Issue: #1574 Related PR: #39469 **Special notes for your reviewer**: **Release note**: ```release-note make kubectl taint command respect effect NoExecute ```
parents be724ba3 f4d33396
...@@ -43,7 +43,7 @@ func ParseTaint(st string) (v1.Taint, error) { ...@@ -43,7 +43,7 @@ func ParseTaint(st string) (v1.Taint, error) {
return taint, fmt.Errorf("invalid taint spec: %v, %s", st, strings.Join(errs, "; ")) return taint, fmt.Errorf("invalid taint spec: %v, %s", st, strings.Join(errs, "; "))
} }
if effect != v1.TaintEffectNoSchedule && effect != v1.TaintEffectPreferNoSchedule { if effect != v1.TaintEffectNoSchedule && effect != v1.TaintEffectPreferNoSchedule && effect != v1.TaintEffectNoExecute {
return taint, fmt.Errorf("invalid taint spec: %v, unsupported taint effect", st) return taint, fmt.Errorf("invalid taint spec: %v, unsupported taint effect", st)
} }
......
...@@ -47,6 +47,10 @@ func TestTaintsVar(t *testing.T) { ...@@ -47,6 +47,10 @@ func TestTaintsVar(t *testing.T) {
{Key: "bing", Value: "bang", Effect: api.TaintEffectPreferNoSchedule}, {Key: "bing", Value: "bang", Effect: api.TaintEffectPreferNoSchedule},
}, },
}, },
{
f: "--t=dedicated-for=user1:NoExecute",
t: []api.Taint{{Key: "dedicated-for", Value: "user1", Effect: "NoExecute"}},
},
} }
for i, c := range cases { for i, c := range cases {
......
...@@ -1467,6 +1467,24 @@ var _ = framework.KubeDescribe("Kubectl client", func() { ...@@ -1467,6 +1467,24 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
} }
checkOutput(output, requiredStrings) checkOutput(output, requiredStrings)
noExecuteTaint := v1.Taint{
Key: testTaint.Key,
Value: "testing-taint-value-no-execute",
Effect: v1.TaintEffectNoExecute,
}
By("adding NoExecute taint " + noExecuteTaint.ToString() + " to the node")
runKubectlRetryOrDie("taint", "nodes", nodeName, noExecuteTaint.ToString())
defer framework.RemoveTaintOffNode(f.ClientSet, nodeName, noExecuteTaint)
By("verifying the node has the taint " + noExecuteTaint.ToString())
output = runKubectlRetryOrDie("describe", "node", nodeName)
requiredStrings = [][]string{
{"Name:", nodeName},
{"Taints:"},
{noExecuteTaint.ToString()},
}
checkOutput(output, requiredStrings)
By("removing all taints that have the same key " + testTaint.Key + " of the node") By("removing all taints that have the same key " + testTaint.Key + " of the node")
runKubectlRetryOrDie("taint", "nodes", nodeName, testTaint.Key+"-") runKubectlRetryOrDie("taint", "nodes", nodeName, testTaint.Key+"-")
By("verifying the node doesn't have the taints that have the same key " + testTaint.Key) By("verifying the node doesn't have the taints that have the same key " + testTaint.Key)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment