mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Ensure /etc/hosts has a header always - Fix conformance test
We have 2 scenarios where we copy /etc/hosts
- with host network (we just copy the /etc/hosts from node)
- without host network (create a fresh /etc/hosts from pod info)
We are having trouble figuring out whether a /etc/hosts in a
pod/container has been "fixed-up" or not. And whether we used
host network or a fresh /etc/hosts in the various ways we start
up the tests which are:
- VM/box against a remote cluster
- As a container inside the k8s cluster
- DIND scenario in CI where test runs inside a managed container
Please see previous mis-guided attempt to fix this problem at
ba20e63446 In this commit we revert
the code from there as well.
So we should make sure:
- we always add a header if we touched the file
- we add slightly different headers so we can figure out if we used the
host network or not.
Update the test case to inject /etc/hosts from node to another path
(/etc/hosts-original) as well and use that to compare.
This commit is contained in:
@@ -563,7 +563,8 @@ fe00::1 ip6-allnodes
|
||||
fe00::2 ip6-allrouters
|
||||
123.45.67.89 some.domain
|
||||
`,
|
||||
`# hosts file for testing.
|
||||
`# Kubernetes-managed hosts file (host network).
|
||||
# hosts file for testing.
|
||||
127.0.0.1 localhost
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
fe00::0 ip6-localnet
|
||||
@@ -585,7 +586,8 @@ fe00::1 ip6-allnodes
|
||||
fe00::2 ip6-allrouters
|
||||
12.34.56.78 another.domain
|
||||
`,
|
||||
`# another hosts file for testing.
|
||||
`# Kubernetes-managed hosts file (host network).
|
||||
# another hosts file for testing.
|
||||
127.0.0.1 localhost
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
fe00::0 ip6-localnet
|
||||
@@ -609,7 +611,8 @@ fe00::1 ip6-allnodes
|
||||
fe00::2 ip6-allrouters
|
||||
123.45.67.89 some.domain
|
||||
`,
|
||||
`# hosts file for testing.
|
||||
`# Kubernetes-managed hosts file (host network).
|
||||
# hosts file for testing.
|
||||
127.0.0.1 localhost
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
fe00::0 ip6-localnet
|
||||
@@ -639,7 +642,8 @@ fe00::1 ip6-allnodes
|
||||
fe00::2 ip6-allrouters
|
||||
12.34.56.78 another.domain
|
||||
`,
|
||||
`# another hosts file for testing.
|
||||
`# Kubernetes-managed hosts file (host network).
|
||||
# another hosts file for testing.
|
||||
127.0.0.1 localhost
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
fe00::0 ip6-localnet
|
||||
|
||||
Reference in New Issue
Block a user