mirror of https://github.com/k3s-io/k3s
ut test load ipvs config
parent
2a9c8df2ec
commit
8487b1653e
|
@ -292,7 +292,7 @@ ipvs:
|
|||
syncPeriod: 60s
|
||||
kind: KubeProxyConfiguration
|
||||
metricsBindAddress: "%s"
|
||||
mode: "iptables"
|
||||
mode: "%s"
|
||||
oomScoreAdj: 17
|
||||
portRange: "2-7"
|
||||
resourceContainer: /foo
|
||||
|
@ -301,20 +301,23 @@ udpTimeoutMilliseconds: 123ms
|
|||
|
||||
testCases := []struct {
|
||||
name string
|
||||
mode string
|
||||
bindAddress string
|
||||
clusterCIDR string
|
||||
healthzBindAddress string
|
||||
metricsBindAddress string
|
||||
}{
|
||||
{
|
||||
name: "IPv4 config",
|
||||
name: "iptables mode, IPv4 config",
|
||||
mode: "iptables",
|
||||
bindAddress: "9.8.7.6",
|
||||
clusterCIDR: "1.2.3.0/24",
|
||||
healthzBindAddress: "1.2.3.4:12345",
|
||||
metricsBindAddress: "2.3.4.5:23456",
|
||||
},
|
||||
{
|
||||
name: "IPv6 config",
|
||||
name: "ipvs mode, IPv6 config",
|
||||
mode: "ipvs",
|
||||
bindAddress: "2001:db8::1",
|
||||
clusterCIDR: "fd00:1::0/64",
|
||||
healthzBindAddress: "[fd00:1::5]:12345",
|
||||
|
@ -355,12 +358,11 @@ udpTimeoutMilliseconds: 123ms
|
|||
SyncPeriod: metav1.Duration{Duration: 60 * time.Second},
|
||||
},
|
||||
MetricsBindAddress: tc.metricsBindAddress,
|
||||
Mode: "iptables",
|
||||
// TODO: IPVS
|
||||
OOMScoreAdj: utilpointer.Int32Ptr(17),
|
||||
PortRange: "2-7",
|
||||
ResourceContainer: "/foo",
|
||||
UDPIdleTimeout: metav1.Duration{Duration: 123 * time.Millisecond},
|
||||
Mode: componentconfig.ProxyMode(tc.mode),
|
||||
OOMScoreAdj: utilpointer.Int32Ptr(17),
|
||||
PortRange: "2-7",
|
||||
ResourceContainer: "/foo",
|
||||
UDPIdleTimeout: metav1.Duration{Duration: 123 * time.Millisecond},
|
||||
}
|
||||
|
||||
options, err := NewOptions()
|
||||
|
@ -368,7 +370,7 @@ udpTimeoutMilliseconds: 123ms
|
|||
|
||||
yaml := fmt.Sprintf(
|
||||
yamlTemplate, tc.bindAddress, tc.clusterCIDR,
|
||||
tc.healthzBindAddress, tc.metricsBindAddress)
|
||||
tc.healthzBindAddress, tc.metricsBindAddress, tc.mode)
|
||||
config, err := options.loadConfig([]byte(yaml))
|
||||
assert.NoError(t, err, "unexpected error for %s: %v", tc.name, err)
|
||||
if !reflect.DeepEqual(expected, config) {
|
||||
|
|
Loading…
Reference in New Issue