mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Add more strict IPv6 regex
Previous IPv6 regex was too loose, this patchs adds a better and more strict regex for IPv6 addresses and makes the IPv4 and IPv6 regex availables as constants inside the framework pkg
This commit is contained in:
parent
ae4ccc91b2
commit
d528944a03
@ -78,7 +78,7 @@ var _ = Describe("[sig-node] Downward API", func() {
|
|||||||
expectations := []string{
|
expectations := []string{
|
||||||
fmt.Sprintf("POD_NAME=%v", podName),
|
fmt.Sprintf("POD_NAME=%v", podName),
|
||||||
fmt.Sprintf("POD_NAMESPACE=%v", f.Namespace.Name),
|
fmt.Sprintf("POD_NAMESPACE=%v", f.Namespace.Name),
|
||||||
"POD_IP=(?:\\d+\\.\\d+\\.\\d+\\.\\d+|[a-fA-F0-9:]+)",
|
fmt.Sprintf("POD_IP=%v|%v", framework.RegexIPv4, framework.RegexIPv6),
|
||||||
}
|
}
|
||||||
|
|
||||||
testDownwardAPI(f, podName, env, expectations)
|
testDownwardAPI(f, podName, env, expectations)
|
||||||
@ -105,7 +105,7 @@ var _ = Describe("[sig-node] Downward API", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expectations := []string{
|
expectations := []string{
|
||||||
"HOST_IP=(?:\\d+\\.\\d+\\.\\d+\\.\\d+|[a-fA-F0-9:]+)",
|
fmt.Sprintf("HOST_IP=%v|%v", framework.RegexIPv4, framework.RegexIPv6),
|
||||||
}
|
}
|
||||||
|
|
||||||
testDownwardAPI(f, podName, env, expectations)
|
testDownwardAPI(f, podName, env, expectations)
|
||||||
|
@ -62,6 +62,10 @@ const (
|
|||||||
maxNetProxyPodsCount = 10
|
maxNetProxyPodsCount = 10
|
||||||
// Number of checks to hit a given set of endpoints when enable session affinity.
|
// Number of checks to hit a given set of endpoints when enable session affinity.
|
||||||
SessionAffinityChecks = 10
|
SessionAffinityChecks = 10
|
||||||
|
// Regex to match IPv4 addresses
|
||||||
|
RegexIPv4 = "(?:\\d+)\\.(?:\\d+)\\.(?:\\d+)\\.(?:\\d+)"
|
||||||
|
// Regex to match IPv6 addresses
|
||||||
|
RegexIPv6 = "(?:(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-fA-F]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:(?:[0-9a-fA-F]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,1}(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:(?:[0-9a-fA-F]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,2}(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:(?:[0-9a-fA-F]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,3}(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:[0-9a-fA-F]{1,4})):)(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,4}(?:(?:[0-9a-fA-F]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,5}(?:(?:[0-9a-fA-F]{1,4})))?::)(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,6}(?:(?:[0-9a-fA-F]{1,4})))?::))))"
|
||||||
)
|
)
|
||||||
|
|
||||||
var NetexecImageName = imageutils.GetE2EImage(imageutils.Netexec)
|
var NetexecImageName = imageutils.GetE2EImage(imageutils.Netexec)
|
||||||
|
Loading…
Reference in New Issue
Block a user