@@ -21,17 +21,12 @@ ${FAKE_LISTEN_IP} 99.99.99.99
2121${CUSTOM_HOSTS_FILE } /tmp/hosts23
2222${PODS_HOSTS_FILE } /tmp/hosts/hosts
2323${HOSTNAME } ${EMPTY }
24+ ${SYNC_FREQUENCY } ${EMPTY }
2425${HOSTSFILE_ENABLED } SEPARATOR=\n
2526... ---
2627... dns:
2728... \ \ hosts:
2829... \ \ \ status: Enabled
29- ${HOSTS_CONFIG_CUSTOM } SEPARATOR=\n
30- ... ---
31- ... dns:
32- ... \ \ hosts:
33- ... \ \ \ status: Enabled
34- ... \ \ \ file: ${CUSTOM_HOSTS_FILE }
3530${HOSTSFILE_DISABLED } SEPARATOR=\n
3631... ---
3732... dns:
@@ -48,13 +43,13 @@ Resolve Host from Default Hosts File
4843
4944Resolve Host from Non-Default Hosts File
5045 [Documentation] Resolve host from default hosts file
51- [Setup] Setup With Custom Config ${ HOSTS_CONFIG_CUSTOM } ${ CUSTOM_HOSTS_FILE }
46+ [Setup] Setup With Custom Hosts File
5247 Resolve Host From Pod ${HOSTNAME }
5348 [Teardown] Teardown Hosts File ${HOSTNAME }
5449
5550Dynamic Hosts File Update Without Restart
5651 [Documentation] Verify hosts file changes are reflected without MicroShift or pod restarts
57- [Setup] Setup With Custom Config ${ HOSTS_CONFIG_CUSTOM } ${ CUSTOM_HOSTS_FILE }
52+ [Setup] Setup With Custom Hosts File
5853 Resolve Host From Pod ${HOSTNAME }
5954 ${updated_hostname } = Generate Random HostName
6055 Add Entry To Hosts ${FAKE_LISTEN_IP } ${updated_hostname } ${CUSTOM_HOSTS_FILE }
@@ -73,10 +68,33 @@ Disable CoreDNS Hosts And Verify ConfigMap Removed
7368
7469
7570*** Keywords ***
71+ Get Hosts Config Custom
72+ [Documentation] Build hosts config with optional syncFrequency
73+ ... syncFrequency is configurable in order to speed up the ConfigMap synchronization time
74+ ... for the pods that mount it.
75+ IF "${SYNC_FREQUENCY } " != "${EMPTY } "
76+ ${config } = Catenate SEPARATOR=\n
77+ ... ---
78+ ... kubelet:
79+ ... \ \ syncFrequency: ${SYNC_FREQUENCY }
80+ ... dns:
81+ ... \ \ hosts:
82+ ... \ \ \ status: Enabled
83+ ... \ \ \ file: ${CUSTOM_HOSTS_FILE }
84+ ELSE
85+ ${config } = Catenate SEPARATOR=\n
86+ ... ---
87+ ... dns:
88+ ... \ \ hosts:
89+ ... \ \ \ status: Enabled
90+ ... \ \ \ file: ${CUSTOM_HOSTS_FILE }
91+ END
92+ RETURN ${config }
93+
7694Resolve Host From Pod
7795 [Documentation] Resolve host from pod
7896 [Arguments] ${hostname }
79- Wait Until Keyword Succeeds 40x 2s
97+ Wait Until Keyword Succeeds 40x 5s
8098 ... Router Should Resolve Hostname ${hostname }
8199
82100Router Should Resolve Hostname
@@ -95,6 +113,11 @@ Setup With Custom Config
95113 Drop In MicroShift Config ${config_content } 20 -dns
96114 Restart MicroShift
97115
116+ Setup With Custom Hosts File
117+ [Documentation] Get custom hosts config and setup with it
118+ ${config } = Get Hosts Config Custom
119+ Setup With Custom Config ${config } ${CUSTOM_HOSTS_FILE }
120+
98121Teardown Hosts File
99122 [Documentation] Teardown the hosts file
100123 [Arguments] ${hostname }
0 commit comments