mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Merge pull request #54204 from Lion-Wei/ipvs-valid
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. add ProxyModeIPVS in proxy mode validation **What this PR does / why we need it**: Currently didn't add "ipvs" in proxy mode check, then if we use "ipvs" mode, will get this error: 'error: KubeProxyConfiguration.Mode.ProxyMode: Invalid value: "ipvs": must be userspace,iptables or blank (blank means the best-available proxy (currently iptables)' So I added it. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
f01bfd4580
@ -120,9 +120,10 @@ func validateProxyMode(mode componentconfig.ProxyMode, fldPath *field.Path) fiel
|
||||
switch mode {
|
||||
case componentconfig.ProxyModeUserspace:
|
||||
case componentconfig.ProxyModeIPTables:
|
||||
case componentconfig.ProxyModeIPVS:
|
||||
case "":
|
||||
default:
|
||||
modes := []string{string(componentconfig.ProxyModeUserspace), string(componentconfig.ProxyModeIPTables)}
|
||||
modes := []string{string(componentconfig.ProxyModeUserspace), string(componentconfig.ProxyModeIPTables), string(componentconfig.ProxyModeIPVS)}
|
||||
errMsg := fmt.Sprintf("must be %s or blank (blank means the best-available proxy (currently iptables)", strings.Join(modes, ","))
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("ProxyMode"), string(mode), errMsg))
|
||||
}
|
||||
|
@ -374,6 +374,7 @@ func TestValidateProxyMode(t *testing.T) {
|
||||
successCases := []componentconfig.ProxyMode{
|
||||
componentconfig.ProxyModeUserspace,
|
||||
componentconfig.ProxyModeIPTables,
|
||||
componentconfig.ProxyModeIPVS,
|
||||
componentconfig.ProxyMode(""),
|
||||
}
|
||||
|
||||
|
@ -158,6 +158,7 @@ type ProxyMode string
|
||||
const (
|
||||
ProxyModeUserspace ProxyMode = "userspace"
|
||||
ProxyModeIPTables ProxyMode = "iptables"
|
||||
ProxyModeIPVS ProxyMode = "ipvs"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
Loading…
Reference in New Issue
Block a user