From dab8d79edb0af76fab2c6bcc9bce6eeac111cbff Mon Sep 17 00:00:00 2001 From: Miciah Masters Date: Thu, 8 Oct 2020 00:27:05 -0400 Subject: [PATCH 1/3] Configure CoreDNS to shut down gracefully This commit is the same as commit f094ddf7edc95dad8398179482687bc2a7a0c15b, which was reverted with commit a96c45e3fa814fee0d9494edd0a433c08df6c4d8, except that this commit does not change DNS pods' termination grace period. This commit is related to bug 1884053. https://bugzilla.redhat.com/show_bug.cgi?id=1884053 * assets/dns/daemonset.yaml: Change the readiness probe to use :8181/ready. * pkg/manifests/bindata.go: Regenerate. * pkg/operator/controller/controller_dns_configmap.go (corefileTemplate): Configure CoreDNS's health plugin to sleep 20 seconds when CoreDNS is shut down. Enable CoreDNS's ready plugin in order to provide a readiness endpoint on :8181/ready, which doesn't report ready until all plugins are initialized and stops reporting ready when CoreDNS is shutting down. * pkg/operator/controller/controller_dns_configmap_test.go (TestDesiredDNSConfigmap): Adjust for changes to corefileTemplate. --- assets/dns/daemonset.yaml | 4 ++-- pkg/manifests/bindata.go | 8 ++++---- pkg/operator/controller/controller_dns_configmap.go | 5 ++++- pkg/operator/controller/controller_dns_configmap_test.go | 5 ++++- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/assets/dns/daemonset.yaml b/assets/dns/daemonset.yaml index 0639dc6d0..9b42248a7 100644 --- a/assets/dns/daemonset.yaml +++ b/assets/dns/daemonset.yaml @@ -26,8 +26,8 @@ spec: protocol: TCP readinessProbe: httpGet: - path: /health - port: 8080 + path: /ready + port: 8181 scheme: HTTP initialDelaySeconds: 10 periodSeconds: 3 diff --git a/pkg/manifests/bindata.go b/pkg/manifests/bindata.go index ce816e669..10c622b0f 100644 --- a/pkg/manifests/bindata.go +++ b/pkg/manifests/bindata.go @@ -2,7 +2,7 @@ // sources: // assets/dns/cluster-role-binding.yaml (223B) // assets/dns/cluster-role.yaml (397B) -// assets/dns/daemonset.yaml (6.385kB) +// assets/dns/daemonset.yaml (6.384kB) // assets/dns/metrics/cluster-role-binding.yaml (279B) // assets/dns/metrics/cluster-role.yaml (246B) // assets/dns/metrics/role-binding.yaml (293B) @@ -118,7 +118,7 @@ func assetsDnsClusterRoleYaml() (*asset, error) { return a, nil } -var _assetsDnsDaemonsetYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x59\x6d\x57\x1b\xb7\xf2\x7f\xcf\xa7\x98\x2e\xfc\x43\xd2\xb0\x60\x92\x90\xe6\xbf\x09\xbd\x75\xc1\x14\x4e\x03\xf8\x60\xa7\x79\xc1\xe1\xfa\xc8\xda\xb1\x57\xd7\x5a\x49\x95\xb4\x6b\xf6\x80\xbf\xfb\x3d\xd2\xfa\x61\xd7\x6b\x68\x73\x9f\x4e\xf3\xc2\xb1\x35\x33\x3f\xcd\x8c\xe6\x49\x62\xc2\x44\x1c\xc1\x29\xc1\x54\x8a\x1e\xda\x2d\xa2\xd8\x6f\xa8\x0d\x93\x22\x02\xa2\x94\x39\xc8\x0f\xb7\xb6\x41\x90\x14\xf7\xfc\xa7\x51\x84\x22\x10\x11\x03\x27\x43\xe4\x06\x88\x46\x30\x68\x81\x58\xd0\x99\xb0\x2c\xc5\x2d\xa3\x90\x46\x5b\x00\x16\x53\xc5\x89\x45\xf7\x1d\x60\xb1\xea\xbf\xa3\xce\x19\xc5\x36\xa5\x32\x13\xf6\x8a\xa4\x18\x41\x2c\xcc\x9c\xaa\x34\x93\x9a\xd9\xe2\x84\x13\x63\x4a\xa2\x29\x8c\xc5\x34\x14\x32\xc6\x90\x6a\x66\x19\x25\x7c\xce\x4d\xa5\xb0\x84\x09\xd4\x66\x81\x1e\x7a\x4d\xab\x88\x00\xdb\xc0\x52\x32\x46\x60\x66\x5d\xdb\x05\x87\xa7\x77\x33\xce\xbb\x92\x33\x5a\x44\x70\x31\xba\x92\xb6\xab\xd1\xa0\xb0\x4b\x2e\x8b\x3a\x65\x82\x58\x26\xc5\x25\x1a\xe3\x44\xe6\xec\x67\x84\xf3\x21\xa1\x93\xbe\xfc\x2c\xc7\xe6\x5a\x74\xb4\x96\x7a\x29\x47\x65\x9a\x12\xe7\xea\x5b\x08\xa8\xd4\x18\x0b\x13\xc0\xdd\x92\x4c\xf4\xd8\x78\x5a\x48\xa5\x18\x05\x7b\x10\x1c\xa0\xa5\x07\x73\xce\x83\x13\xa9\x71\xc4\x38\x56\x45\x72\xc9\xb3\x14\x2f\x9d\x03\x97\x96\xaf\x6c\x77\x30\x6c\x1c\x96\x4c\x4b\x2a\x40\xea\xf8\xbb\xc4\x26\x11\x54\x77\xa8\x70\x68\x24\xf1\xb5\xe0\x45\x04\x56\x67\x2b\x51\x25\x75\x7d\x9f\xa5\xdf\xbb\x52\xdb\x08\x8e\xde\x1e\xbd\xad\xa0\x34\x4f\xc0\x9d\xab\xb4\x92\x4a\x1e\xc1\x97\xd3\xee\xb7\x23\x85\x96\xaa\x8d\x68\xfd\x93\x15\x9a\xd3\x9e\x09\x34\xa6\xab\xe5\x10\xa3\x0a\x7f\x62\xad\xfa\x05\x6d\x75\x09\x40\x95\x9e\x48\x90\x70\x9b\xd4\x29\x5e\x97\x0f\xad\x0f\xad\xda\xb2\xa1\x09\x3a\x7d\xce\xfb\xfd\x6e\x85\xc0\x04\xb3\x8c\xf0\x53\xe4\xa4\xe8\x21\x95\x22\x36\x11\x1c\x56\x45\x15\x6a\x26\xe3\x25\xad\x6a\xa1\xc9\x28\x45\x63\xfa\x89\x46\x93\x48\x1e\x47\x70\x58\xa1\x8e\x08\xe3\x99\xc6\x0a\xb5\x2a\xeb\x42\x58\x66\x76\x03\x2e\x67\x39\xfe\x45\x1c\xf1\xbe\xf5\x8c\xc6\x47\xff\x86\x27\x8e\x2a\xe7\x6e\x64\xa6\x29\x9a\xa8\x16\xca\xbf\x67\x68\xac\xa9\x9b\x4a\x55\x16\xc1\x51\x2b\xad\x2d\xa6\x98\x4a\x5d\x44\xf0\x43\xeb\x92\xad\x95\x91\x49\x36\xc4\x50\x0f\x09\x0d\x95\x96\xf7\xc5\x37\x94\x14\x9f\xd5\x95\x40\x0f\x43\x2e\xc7\x56\x1a\x1b\xa3\xd6\xb5\x75\x83\x34\xd3\x18\x72\x66\x2c\x8a\x90\xc4\xb1\x46\x63\x8e\xa3\xff\x3f\x3c\x7a\x57\xe3\xb3\xdc\x84\x94\xa9\x04\x75\x68\x32\x66\xd1\x1c\xf7\x3f\xf7\x06\x9d\x93\xd3\xf3\xce\xe0\xa6\xd7\x1e\x7c\xbd\xe8\x9f\x0f\xda\x9d\xde\xe0\xf0\xcd\x87\xc1\x2f\x27\x97\x83\xde\x79\xfb\xcd\xd1\xfb\xbd\x15\x57\xe7\xe4\xf4\x0f\xf8\x1a\x38\x27\x3f\x9f\xfc\x29\x9c\x8d\x7c\xcf\xa0\xd5\x2c\xcb\x94\xb1\x1a\x49\x7a\xec\xc2\x33\x3a\x38\x38\x7c\xf3\xc3\x7e\x6b\xbf\xb5\x7f\xe8\x9c\xf0\xf6\xa0\xe9\x05\xd4\x36\x74\x35\xf1\xd8\xd7\x31\xcb\xcd\x81\xd2\x2c\x27\x16\xdd\xf7\x7d\xaa\x6d\x43\x64\x4e\x0f\x27\x58\x3c\x23\x39\xc1\xe2\x4f\x17\xbd\xda\xf9\x2c\x4a\x55\x8a\x56\x33\x6a\xfe\xe5\xd0\x3c\x7c\x22\x34\xdf\xad\x42\xf3\xe9\xea\xbf\x5e\xdf\x2b\xd6\x3d\xa5\xa8\xf3\xcd\x1f\xd5\xff\x4a\x4b\x2d\x9b\xb0\x33\x8a\xe7\xa8\xff\x32\x0d\xd6\x67\x90\x1b\x1a\xa4\xb0\x78\x5f\xab\x6e\xce\x7e\xc6\x71\x8c\xf1\x5a\x4f\x7b\xbe\x85\x26\xd2\x58\xe3\x03\xe5\x99\xfe\xe9\x99\x2a\x4e\x40\x91\xc3\x55\xfb\xb2\xd3\xeb\xdc\xfc\xd6\xb9\xf1\x83\xd2\xc9\xe7\x2f\xbd\x7e\xe7\x66\x70\x7a\x7d\xd9\xbe\xb8\xda\x34\x30\x2d\xc4\x51\xe4\x4d\x35\x1c\xd2\xc5\x49\xa7\x57\x51\x62\x1b\x4e\xdc\x38\x01\x52\x43\x39\x8f\x19\x54\x44\x13\x8b\x31\xb8\x0a\x02\x72\xb4\x98\xb0\x4c\x4d\xea\xea\xba\xdf\x89\xe0\x4c\x6a\x10\x72\xba\x07\x28\x4c\xa6\x11\x6c\x82\x06\xbd\x5a\x1a\x39\xb1\x2c\xc7\x72\xd2\xfb\x08\x23\xa9\x01\x09\x4d\xea\x84\xbd\x1a\x26\x11\x40\x38\x23\x06\xa6\xcc\x26\x0e\x6b\xdd\x5e\x93\x8d\x46\xec\x1e\xa6\x8c\x73\x20\xdc\x48\x18\x22\x90\x38\xc6\x78\xbf\x82\x93\x13\x9e\x61\x04\x81\x8f\x91\x50\xe3\x98\x19\xab\x8b\x7d\xa9\x50\x98\x84\x8d\x6c\xb8\x46\x30\x39\x0d\x1a\xb3\x55\xc5\x75\x07\x43\x26\x0e\x86\xc4\x24\xd5\x22\x40\x2b\x3f\x1e\xab\x46\x7c\xd7\x64\x07\x7f\x46\x61\x26\x41\x31\x85\xae\xf3\x6c\x55\x7b\x98\x26\x0a\x76\xff\x21\x87\x06\x42\x05\x8f\x70\xef\x2a\x3d\x4c\x9c\x89\x8f\x8f\x3e\xc6\x3e\xc2\x94\x30\xfb\x11\xf0\x9e\x59\x68\xed\x42\xbf\x73\x73\x59\x45\xb8\xee\x76\xae\x7a\xe7\x17\x67\xfd\xc1\x65\xfb\xe6\xd7\xce\xcd\x71\xb0\xb2\x75\x8c\x02\xfd\x69\xd6\x53\x2d\xa8\x88\x9f\x5f\xf7\xfa\xbd\xc1\xd9\xc5\xe7\xce\x71\xb0\x8a\xc3\x2a\x47\xbf\x73\xd9\x6d\x30\xec\xdb\x54\x05\x55\x35\x2e\xce\x7a\xc7\xbb\x7b\xb0\xeb\xb3\x1e\x42\x0d\x21\x59\x86\x0e\x7c\xfa\xf4\x09\x82\x9d\x87\x45\x00\xce\x6a\x92\xdb\x70\x49\x26\x08\xc4\x4f\xf9\x52\x13\x5d\x80\x4b\x95\x55\x18\x48\x1e\x97\x29\xe4\xd7\x77\x0d\x10\x6b\x35\x1b\x66\x16\x4d\xf5\xe4\xa9\x82\x70\x04\x61\xb8\xa2\x86\x52\xf0\xc2\x6d\xbc\x32\x72\x16\xb8\xdf\x4b\x93\xea\x9a\x4c\x13\xb7\x6f\xe9\xf4\x58\xd6\x4a\x67\x8c\x94\xbb\xc0\x0e\xdb\x60\x72\x3a\x60\xca\xd4\xc8\x2e\xbe\x4d\x4e\x81\x09\x07\xbf\xb0\xfb\xf6\xa7\xbb\x59\xd0\x80\x72\x16\x9f\xa1\xa5\xc9\xc2\x3f\x70\xd1\x85\x91\x96\x29\x50\x9e\x19\x8b\xda\xd5\x46\x60\x23\x50\x65\x41\xdb\x87\xaf\x08\xa9\x73\x91\xc1\x1c\x35\xe1\x60\x35\x43\xd3\xc0\xb4\x12\x62\x09\xcc\x46\x70\xd1\xcd\xdf\xed\xb9\xcf\xf7\xfe\xf3\x1d\xc8\x1c\xb5\x1b\x6e\x7d\x15\x71\xeb\xcb\x95\x7d\xe8\x27\x08\x76\x2a\x81\x13\x97\xef\x62\x03\xb0\xb3\xdb\x19\x18\xa3\xe2\xb2\x48\x51\xd8\x79\x8e\xfe\x9a\xe9\x42\x83\x14\xee\x84\x50\xc3\xb5\x42\xd1\xb3\x84\x4e\xe0\xe5\x75\xaf\x7b\xf8\xf6\x15\x84\x60\x13\x69\xd0\xe9\x25\xa4\x6d\x00\x9b\x4c\xb9\xbe\xe8\x86\x78\xe0\x92\xc4\x43\xc2\x89\xa0\xa8\x8d\xd7\xd3\x35\x36\xe6\x6b\x09\xa1\x09\x13\x63\x38\xbd\xea\x81\x4d\xb4\xcc\xc6\x89\x57\x7d\x0d\x8f\xa6\xb1\x39\x7e\xb9\x1b\xb3\x31\x84\x16\xda\xf0\x53\xb0\xf3\xb0\x2a\xa0\xb3\x00\x5e\x9b\xc4\xed\xe6\x0e\x28\xa7\xb3\xfd\x9d\x87\x7a\x7d\x99\x05\x8f\x63\x8d\x0a\xc2\x1c\x82\xbf\x7f\x0c\x76\xd7\xe0\xcb\x7f\x4b\xf8\x76\xfb\xbf\xbd\x03\xbc\xb6\x54\xc1\x6b\x8d\x56\x17\xc7\xad\xff\x81\x39\xff\xd9\xfd\x5e\xad\x6d\xe8\x22\x88\xb9\x04\xd9\x79\xf8\xce\x1d\xd5\xed\xf7\x77\xb3\x35\x96\x46\xa2\x00\x30\x65\x8e\x5f\xee\xbc\xc4\x9c\x70\xb7\xb3\x17\x64\x77\xb3\xe0\xd5\x3a\x3c\xb8\x8c\xb9\xbd\x85\x60\xe7\x6f\x01\x84\xf8\x3b\xb4\xe0\xc5\x0b\x27\xb2\xcd\x54\x99\x88\x10\x0a\x84\x16\xdc\xdd\x7d\x74\x55\x45\x6c\xf0\xc7\x3c\xb3\x6f\xe7\x26\x06\x77\xc7\xc1\xce\xc3\x42\x7c\x03\xff\x50\x23\x99\x34\xd6\x47\xac\x61\x96\xc0\xad\xc6\x42\x6d\x65\x1b\xbe\xa8\x98\x58\xac\x8c\x02\xe0\x8b\x17\x1b\xc1\x14\x61\x8c\xd6\x35\x36\x16\x57\x4a\x86\x59\x03\xf8\x8a\x65\x67\x14\xd2\x42\xd6\x00\x9b\x26\x28\x9c\xd9\xda\xcf\x55\xf3\xbb\xfa\x12\x4d\x66\xd6\x4d\x5c\x52\x03\x51\x0c\x32\x41\x72\xc2\x38\x19\x32\xce\x6c\xb1\xb6\x4d\xcf\x12\x8e\x80\xc2\xd7\x20\xa0\x32\xe3\xb1\x6b\x4d\xc6\xba\xa3\xad\x6c\xc8\x46\xbe\x76\x2f\x76\x60\x06\x62\xe4\x68\x31\xde\x6a\x9e\x59\x28\xe6\x51\xe5\xbd\xff\xfd\x5d\x38\x0b\x9e\x3a\xa6\x6d\xf8\x39\x63\x3c\x06\x02\x02\xa7\x95\xae\x50\x16\xd0\xaa\xc1\xae\x40\xc9\x4c\x03\xcd\x8c\x95\xe9\x52\xe3\x11\xe3\x16\x35\xc6\xce\xe6\x35\xec\x65\xf8\x6e\xc3\xce\xc3\x7a\x5b\x2d\x1b\x47\xad\x91\xfc\xf8\x4c\x2b\x29\x75\x6d\x2b\x85\xbe\x92\x95\x7d\x77\xa5\x84\x6b\x17\xcd\xb9\x0a\x1a\x9d\xe4\xbb\x85\x53\x9e\xe8\x24\xf3\xb4\x52\x65\x5e\x2d\x98\xcb\xf0\xbd\x9b\x6d\x14\x00\x40\x9a\x48\xf0\x91\x3d\x2b\x85\x16\xff\x35\x73\x1a\x9e\x70\xc5\x8f\x0d\xdb\xd7\x37\x69\x04\xfd\xa6\xb0\x77\x3e\xea\x5f\x9f\x5e\x47\x1b\xc2\x9f\x58\x99\x32\x4a\x38\x2f\x5c\x67\x23\xb9\x64\x31\x10\x51\x00\x13\x54\x0a\xe3\xaf\xb7\x16\x86\x98\x90\x9c\x55\x86\xf7\x05\xea\x0d\x2a\xee\xe6\xd9\x4d\x11\x91\xca\x98\x8d\x18\xc6\x90\x97\xef\x93\x2e\x0a\x05\x62\xbc\x16\x9b\xae\xa3\xa8\x35\x33\x1b\x31\xf0\xf8\x38\x9f\x3b\x9e\xe7\x6b\x5a\xbd\xe0\x75\x99\xe1\x52\x56\x63\x2a\x73\x8c\x57\xb6\xfa\xa8\xa6\x1a\xdd\x6d\xb2\x4c\x1d\xdf\x15\x57\xd3\x0d\x50\xa9\x0a\xa0\x49\xa6\xeb\x49\xb2\x56\x7f\x0c\x47\x54\xf0\xbe\x05\x2f\xfc\x20\x59\xa3\x65\xc2\xcd\xa6\xcd\x81\xa6\x76\x78\xdf\xfc\x20\xb2\xf9\xd2\xf9\xe6\x70\x79\xe9\x8c\x85\x59\x5c\xc5\x4e\x71\x44\x32\xbe\xd0\xca\x4d\xa9\x3d\xe4\x48\xad\xd4\x2b\xe4\x49\x36\x44\x2d\xd0\x8d\x7b\x4c\x1e\x48\x13\x01\x67\x22\xbb\x2f\x89\x73\xae\xf2\x02\xd6\x78\xb8\xdd\xfc\x78\x59\xae\x5e\x12\x15\x55\xee\x5b\x57\x24\x7d\xee\xce\x09\xc0\x2c\xa6\x35\x7b\x43\x98\x60\x11\xc1\xe2\x49\x75\xc3\x2b\xd8\x1a\xe9\x99\xfb\xa0\x5b\xf2\x97\xc1\xad\x75\x8c\x0d\x97\x43\x00\x5b\x28\x8c\xe0\xac\x09\xbd\xe9\x26\xbe\xed\xae\xb4\x1a\xed\xb3\x16\x5a\xc9\xdd\x55\x81\x49\xb1\xb4\x71\xdb\x4f\x5c\x2e\x33\x8c\x0b\x4b\x9d\x09\x70\x03\x68\x31\x75\x6d\x64\x1f\xfa\xa5\x04\x02\xe1\x1c\x2c\x61\x62\xa9\x61\x08\x52\x39\x92\xd4\x11\x74\x5c\x6f\x70\x84\xb2\x27\xf5\xac\x13\x19\x17\xe5\x1e\xa5\x19\x37\x92\x73\x26\xc6\x65\x09\xf0\xeb\xba\xba\xb2\x52\xe7\x4a\x5a\x8c\xfc\xc0\x1a\xfb\x3f\x33\xf8\x47\x14\xc7\x8b\x1a\xb4\xcc\x84\xd3\x33\x41\x50\xa8\x29\x0a\xdf\xd1\x32\xb5\x14\x7e\x99\x09\xce\x26\xfe\x92\x5a\x99\x64\x2b\x10\x7b\x6e\xfe\x77\x57\xd4\x12\x29\x96\x53\xf1\x6a\x31\x63\xa6\xe4\xfe\xcb\xa2\x2b\x72\x8c\xe0\xb0\xf5\x7f\x5b\xff\x0c\x00\x00\xff\xff\x6f\x9b\x9e\xf3\xf1\x18\x00\x00") +var _assetsDnsDaemonsetYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x59\x6d\x57\x1b\xb7\xf2\x7f\xcf\xa7\x98\x2e\xfc\x43\xd2\xb0\x60\x27\x21\xcd\x7f\x13\x7a\xeb\x82\x29\x9c\x06\xf0\xc1\x4e\xf3\x82\xc3\xe5\xc8\xda\xb1\x57\xd7\x5a\x49\x95\xb4\x6b\xf6\x80\xbf\xfb\x3d\xd2\xfa\x61\xd7\x6b\x68\xd3\xfb\x70\x6e\x5e\x38\xb6\x66\xe6\xa7\x99\xd1\x3c\x49\x4c\x98\x88\x23\x38\x21\x98\x4a\xd1\x47\xbb\x45\x14\xfb\x0d\xb5\x61\x52\x44\x40\x94\x32\x07\x79\x7b\x6b\x1b\x04\x49\x71\xcf\x7f\x1a\x45\x28\x02\x11\x31\x70\x32\x44\x6e\x80\x68\x04\x83\x16\x88\x05\x9d\x09\xcb\x52\xdc\x32\x0a\x69\xb4\x05\x60\x31\x55\x9c\x58\x74\xdf\x01\x16\xab\xfe\x3b\xea\x9c\x51\xec\x50\x2a\x33\x61\x2f\x49\x8a\x11\xc4\xc2\xcc\xa9\x4a\x33\xa9\x99\x2d\x8e\x39\x31\xa6\x24\x9a\xc2\x58\x4c\x43\x21\x63\x0c\xa9\x66\x96\x51\xc2\xe7\xdc\x54\x0a\x4b\x98\x40\x6d\x16\xe8\xa1\xd7\xb4\x8a\x08\xb0\x0d\x2c\x25\x63\x04\x66\xd6\xb5\x5d\x70\x78\x7a\x2f\xe3\xbc\x27\x39\xa3\x45\x04\xe7\xa3\x4b\x69\x7b\x1a\x0d\x0a\xbb\xe4\xb2\xa8\x53\x26\x88\x65\x52\x5c\xa0\x31\x4e\x64\xce\x7e\x4a\x38\x1f\x12\x3a\x19\xc8\xcf\x72\x6c\xae\x44\x57\x6b\xa9\x97\x72\x54\xa6\x29\x71\xae\xbe\x81\x80\x4a\x8d\xb1\x30\x01\xdc\x2e\xc9\x44\x8f\x8d\xa7\x85\x54\x8a\x51\xb0\x07\xc1\x01\x5a\x7a\x30\xe7\x3c\x38\x96\x1a\x47\x8c\x63\x55\x24\x97\x3c\x4b\xf1\xc2\x39\x70\x69\xf9\xca\x76\x07\xc3\xc6\x61\xc9\xb4\xa4\x02\xa4\x8e\xbf\x47\x6c\x12\x41\x75\x87\x0a\x87\x46\x12\x5f\x09\x5e\x44\x60\x75\xb6\x12\x55\x52\xd7\xf7\x59\xfa\xbd\x27\xb5\x8d\xe0\xf0\xed\xe1\xdb\x0a\x4a\xf3\x04\xdc\xb9\x4a\x2b\xa9\xe4\x11\x7c\x39\xe9\x7d\x3b\x52\x68\xa9\xda\x88\x36\x38\x5e\xa1\x39\xed\x99\x40\x63\x7a\x5a\x0e\x31\xaa\xf0\x27\xd6\xaa\x5f\xd0\x56\x97\x00\x54\xe9\x09\x27\x55\xd4\x09\x5e\x95\x0f\xed\x0f\xed\xda\xb2\xa1\x09\x3a\x75\xce\x06\x83\x5e\x85\xc0\x04\xb3\x8c\xf0\x13\xe4\xa4\xe8\x23\x95\x22\x36\x11\xb4\x5b\x55\x6d\x51\x33\x19\x2f\x69\x55\x03\x4d\x46\x29\x1a\x33\x48\x34\x9a\x44\xf2\x38\x82\xea\x9e\x23\xc2\x78\xa6\xb1\x42\xad\xca\xba\x08\x96\x99\xdd\x80\xcb\x59\x8e\xdf\xec\x87\x04\x09\xb7\xc9\x26\x47\xb4\x3e\xb4\xfe\xb2\x23\xde\xb7\x9e\xd1\xf8\xf0\x5f\xf0\xc4\x61\xe5\xd8\x8d\xcc\x34\x45\x13\xd5\x22\xf9\xf7\x0c\x8d\x35\x75\x53\xa9\xca\x22\x38\x6c\xa5\xb5\xc5\x14\x53\xa9\x8b\x08\x7e\x68\x5d\xb0\xb5\x2a\x32\xc9\x86\x18\xea\x21\xa1\xa1\xd2\xf2\xbe\xf8\x86\x8a\xe2\x93\xba\x12\xe7\x61\xc8\xe5\xd8\x4a\x63\x63\xd4\xba\xb6\x6e\x90\x66\x1a\x43\xce\x8c\x45\x11\x92\x38\xd6\x68\xcc\x51\xf4\xff\xed\xc3\x77\x35\x3e\xcb\x4d\x48\x99\x4a\x50\x87\x26\x63\x16\xcd\xd1\xe0\x73\xff\xae\x7b\x7c\x72\xd6\xbd\xbb\xee\x77\xee\xbe\x9e\x0f\xce\xee\x3a\xdd\xfe\x5d\xfb\xcd\x87\xbb\x5f\x8e\x2f\xee\xfa\x67\x9d\x37\x87\xef\xf7\x56\x5c\xdd\xe3\x93\x3f\xe0\x6b\xe0\x1c\xff\x7c\xfc\xa7\x70\x36\xf2\x3d\x83\x56\xb3\x2c\x53\xc6\x6a\x24\xe9\x91\x0b\xcf\xe8\xe0\xa0\xfd\xe6\x87\xfd\xd6\x7e\x6b\xbf\xed\x9c\xf0\xf6\xa0\xe9\x05\xd4\x36\x74\x25\xf1\xc8\x97\x31\xcb\xcd\x81\xd2\x2c\x27\x16\xdd\xf7\x7d\xaa\x6d\x43\x64\x4e\x0f\x27\x58\x3c\x23\x39\xc1\xe2\x4f\xd7\xbc\xda\xf9\x2c\x2a\x55\x8a\x56\x33\x6a\xfe\x72\x68\xb6\x9f\x08\xcd\x77\xab\xd0\x7c\xba\xf8\xaf\x97\xf7\x8a\x75\x4f\x29\xea\x7c\xf3\x47\xe5\xbf\xd2\x51\xcb\x1e\xec\x8c\xe2\x39\xea\xff\x99\xfe\xea\x33\xc8\xcd\x0c\x52\x58\xbc\xaf\x55\x37\x67\x3f\xe3\x38\xc6\x78\xad\xa5\x3d\xdf\x41\x13\x69\xac\xf1\x81\xf2\x4c\xfb\xf4\x4c\x15\x27\xa0\xc8\xe1\xb2\x73\xd1\xed\x77\xaf\x7f\xeb\x5e\xfb\x39\xe9\xf8\xf3\x97\xfe\xa0\x7b\x7d\x77\x72\x75\xd1\x39\xbf\xdc\x34\x2f\x2d\xc4\x51\xe4\x4d\x35\x1c\xd2\xf9\x71\xb7\x5f\x51\x62\x1b\x8e\xdd\x34\x01\x52\x43\x39\x8e\x19\x54\x44\x13\x8b\x31\xb8\x0a\x02\x72\xb4\x18\xb0\x4c\x4d\xea\xf2\x6a\xd0\x8d\xe0\x54\x6a\x10\x72\xba\x07\x28\x4c\xa6\x11\x6c\x82\x06\xbd\x5a\x1a\x39\xb1\x2c\xc7\x72\xd0\xfb\x08\x23\xa9\x01\x09\x4d\xea\x84\xbd\x1a\x26\x11\x40\x38\x23\x06\xa6\xcc\x26\x0e\x6b\xdd\x5e\x93\x8d\x46\xec\x1e\xa6\x8c\x73\x20\xdc\x48\x18\x22\x90\x38\xc6\x78\xbf\x82\x93\x13\x9e\x61\x04\x81\x8f\x91\x50\xe3\x98\x19\xab\x8b\x7d\xa9\x50\x98\x84\x8d\x6c\xb8\x46\x30\x39\x0d\x1a\xa3\x55\xc5\x75\x07\x43\x26\x0e\x86\xc4\x24\xd5\x22\x40\x2b\x3f\x1e\xab\x46\x7c\xd7\x64\x07\x7f\x46\x61\x26\x41\x31\x85\xae\xf3\x6c\x55\x7b\x98\x26\x0a\x76\xff\x21\x87\x06\x42\x05\x8f\x70\xef\x2a\x3d\x4c\x9c\x89\x8f\x8f\x3e\xc6\x3e\xc2\x94\x30\xfb\x11\xf0\x9e\x59\x68\xed\xc2\xa0\x7b\x7d\x51\x45\xb8\xea\x75\x2f\xfb\x67\xe7\xa7\x83\xbb\x8b\xce\xf5\xaf\xdd\xeb\xa3\x60\x65\xeb\x18\x05\xfa\xd3\xac\xa7\x5a\x50\x11\x3f\xbb\xea\x0f\xfa\x77\xa7\xe7\x9f\xbb\x47\xc1\x2a\x0e\xab\x1c\x83\xee\x45\xaf\xc1\xb0\x6f\x53\x15\x54\xd5\x38\x3f\xed\x1f\xed\xee\xc1\xae\xcf\x7a\x08\x35\x84\x64\x19\x3a\xf0\xe9\xd3\x27\x08\x76\x1e\x16\x01\x38\xab\x49\x6e\xc3\x05\x99\x20\x10\x3f\xe4\x4b\x4d\x74\x01\x2e\x55\x56\x61\x20\x79\x5c\xa6\x90\x5f\xdf\x35\x40\xac\xd5\x6c\x98\x59\x34\xd5\x93\xa7\x0a\xc2\x11\x84\xe1\x8a\x1a\x4a\xc1\x0b\xb7\xf1\xca\xc8\x59\xe0\x7e\x2f\x4d\xaa\x6b\x32\x4d\xdc\xbe\xa5\xd3\x63\x59\x2b\x9d\x31\x52\xee\x02\x3b\xec\x80\xc9\xe9\x1d\x53\xa6\x46\x76\xf1\x6d\x72\x0a\x4c\x38\xf8\x85\xdd\x37\x3f\xdd\xce\x82\x06\x94\xb3\xf8\x14\x2d\x4d\x16\xfe\x81\xf3\x1e\x8c\xb4\x4c\x81\xf2\xcc\x58\xd4\xae\x36\x02\x1b\x81\x2a\x0b\xda\x3e\x7c\x45\x48\x9d\x8b\x0c\xe6\xa8\x09\x07\xab\x19\x9a\x06\xa6\x95\x10\x4b\x60\x36\x82\xf3\x5e\xfe\x6e\xcf\x7d\xbe\xf7\x9f\xef\x40\xe6\xa8\xdd\x6c\xeb\xab\x88\x5b\x5f\xae\xec\xc3\x20\x41\xb0\x53\x09\x9c\xb8\x7c\x17\x1b\x80\x9d\xdd\xce\xc0\x18\x15\x97\x45\x8a\xc2\xce\x73\xf4\xd7\x4c\x17\x1a\xa4\x70\x27\x84\x1a\xae\x14\x8a\xbe\x25\x74\x02\x2f\xaf\xfa\xbd\xf6\xdb\x57\x10\x82\x4d\xa4\x41\xa7\x97\x90\xb6\x01\x6c\x32\xe5\xfa\xa2\x9b\xe1\x81\x4b\x12\x0f\x09\x27\x82\xa2\x36\x5e\x4f\xd7\xd8\x98\xaf\x25\x84\x26\x4c\x8c\xe1\xe4\xb2\x0f\x36\xd1\x32\x1b\x27\x5e\xf5\x35\x3c\x9a\xc6\xe6\xe8\xe5\x6e\xcc\xc6\x10\x5a\xe8\xc0\x4f\xc1\xce\xc3\xaa\x80\xce\x02\x78\x6d\x12\xb7\x9b\x3b\xa0\x9c\xce\xf6\x77\x1e\xea\xf5\x65\x16\x3c\x8e\x35\x2a\x08\x73\x08\xfe\xfe\x31\xd8\x5d\x83\x2f\xff\x2d\xe1\x3b\x9d\xff\xf4\x0e\xf0\xda\x52\x05\xaf\x35\x5a\x5d\x1c\xb5\xfe\x0b\xe6\xfc\x7b\xf7\x7b\xb5\xb6\xa1\x8b\x20\xe6\x12\x64\xe7\xe1\x3b\x77\x54\x37\xdf\xdf\xce\xd6\x58\x1a\x89\x02\xc0\x94\x39\x7a\xb9\xf3\x12\x73\xc2\xdd\xce\x5e\x90\xdd\xce\x82\x57\xeb\xf0\xe0\x32\xe6\xe6\x06\x82\x9d\xbf\x05\x10\xe2\xef\xd0\x82\x17\x2f\x9c\xc8\x36\x53\x65\x22\x42\x28\x10\x5a\x70\x7b\xfb\xd1\x55\x15\xb1\xc1\x1f\xf3\xcc\xbe\x99\x9b\x18\xdc\x1e\x05\x3b\x0f\x0b\xf1\x0d\xfc\x43\x8d\x64\xd2\x58\x1f\xb1\x86\x59\x02\xb7\x1a\x0b\xb5\x95\x6d\xf8\xa2\x62\x62\xb1\x32\x0a\x80\x2f\x5e\x6c\x04\x53\x84\x31\x5a\xd7\xd8\x58\x5c\x29\x19\x66\x0d\xe0\x2b\x96\x9d\x51\x48\x0b\x59\x03\x6c\x9a\xa0\x70\x66\x6b\x3f\x57\xcd\xaf\xea\x4b\x34\x99\x59\x37\x71\x49\x0d\x44\x31\xc8\x04\xc9\x09\xe3\x64\xc8\x38\xb3\xc5\xda\x36\x7d\x4b\x38\x02\x0a\x5f\x83\x80\xca\x8c\xc7\xae\x35\x19\xeb\x8e\xb6\xb2\x21\x1b\xf9\xda\xbd\xd8\x81\x19\x88\x91\xa3\xc5\x78\xab\x79\x66\xa1\x98\x47\x95\xf7\xfe\xf7\xb7\xe1\x2c\x78\xea\x98\xb6\xe1\xe7\x8c\xf1\x18\x08\x08\x9c\x56\xba\x42\x59\x40\xab\x06\xbb\x02\x25\x33\x0d\x34\x33\x56\xa6\x4b\x8d\x47\x8c\x5b\xd4\x18\x3b\x9b\xd7\xb0\x97\xe1\xbb\x0d\x3b\x0f\xeb\x6d\xb5\x6c\x1c\xb5\x46\xf2\xe3\x33\xad\xa4\xd4\xb5\xa3\x14\xfa\x4a\x56\xf6\xdd\x95\x12\xae\x5d\x34\xe7\x2a\x68\x74\x92\xef\x16\x4e\x79\xa2\x93\xcc\xd3\x4a\x95\x79\xb5\x60\x2e\xc3\xf7\x76\xb6\x51\x00\x00\x69\x22\xc1\x47\xf6\xac\x14\x5a\xfc\xd7\xcc\x69\x78\xc2\x15\x3f\x36\x6c\x5f\xdf\xa4\x11\xf4\x9b\xc2\xde\xf9\x68\x70\x75\x72\x15\x6d\x08\x7f\x62\x65\xca\x28\xe1\xbc\x70\x9d\x8d\xe4\x92\xc5\x40\x44\x01\x4c\x50\x29\x8c\xbf\xde\x5a\x18\x62\x42\x72\x56\x19\xde\x17\xa8\xd7\xa8\xb8\x9b\x67\x37\x45\x44\x2a\x63\x36\x62\x18\x43\x5e\x3e\x4f\xba\x28\x14\x88\xf1\x5a\x6c\xba\x8e\xa2\xd6\xcc\x6c\xc4\xc0\xe3\xe3\x7c\xee\x78\x9e\xaf\x69\xf5\x82\xd7\x65\x86\x4b\x59\x8d\xa9\xcc\x31\x5e\xd9\xea\xa3\x9a\x6a\x74\xb7\xc9\x32\x75\x7c\x57\x5c\x4d\x37\x40\xa5\x2a\x80\x26\x99\xae\x27\xc9\x5a\xfd\x31\x1c\x51\xc1\xfb\x16\xbc\xf0\x83\x64\x8d\x96\x09\x37\x9b\x36\x07\x9a\xda\xe1\x7d\xf3\x83\xc8\xe6\x4b\xe7\x9b\xf6\xf2\xd2\x19\x0b\xb3\xb8\x8a\x9d\xe0\x88\x64\x7c\xa1\x95\x9b\x52\xfb\xc8\x91\x5a\xa9\x57\xc8\x93\x6c\x88\x5a\xa0\x1b\xf7\x98\x3c\x90\x26\x02\xce\x44\x76\x5f\x12\xe7\x5c\xe5\x05\xac\xf1\x6e\xbb\xf9\xed\xb2\x5c\xbd\x20\x2a\xaa\xdc\xb7\x2e\x49\xfa\xdc\x9d\x13\x80\x59\x4c\x6b\xf6\x86\x30\xc1\x22\x82\xc5\x8b\xea\x86\x57\xb0\x35\xd2\x33\xf7\x41\xb7\xe4\x2f\x83\x5b\xeb\x18\x1b\x2e\x87\x00\xb6\x50\x18\xc1\x69\x13\x7a\xd3\x4d\x7c\xdb\x5d\x69\x35\xda\x67\x2d\xb4\x92\xbb\xab\x02\x93\x62\x69\xe3\xb6\x9f\xb8\x5c\x66\x18\x17\x96\x3a\x13\xe0\x06\xd0\x62\xea\xda\xc8\x3e\x0c\x4a\x09\x04\xc2\x39\x58\xc2\xc4\x52\xc3\x10\xa4\x72\x24\xa9\x23\xe8\xba\xde\xe0\x08\x65\x4f\xea\x5b\x27\x32\x2e\xca\x3d\x4a\x33\xae\x25\xe7\x4c\x8c\xcb\x12\xe0\xd7\x75\x75\x65\xa5\xce\xa5\xb4\x18\xf9\x81\x35\xf6\x7f\x65\xf0\x8f\x28\x8e\x17\x35\x68\x99\x09\xa7\x67\x82\xa0\x50\x53\x14\xbe\xa3\x65\x6a\x29\xfc\x32\x13\x9c\x4d\xfc\x25\xb5\x32\xc9\x56\x20\xf6\xdc\xfc\xef\xae\xa8\x25\x52\x2c\xa7\xe2\xd5\x62\xc6\x4c\xc9\xfd\x97\x45\x57\xe4\x18\x41\xbb\xf5\x7f\x5b\xff\x0c\x00\x00\xff\xff\x68\x77\xec\xed\xf0\x18\x00\x00") func assetsDnsDaemonsetYamlBytes() ([]byte, error) { return bindataRead( @@ -133,8 +133,8 @@ func assetsDnsDaemonsetYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "assets/dns/daemonset.yaml", size: 6385, mode: os.FileMode(420), modTime: time.Unix(1, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x18, 0x97, 0xef, 0xef, 0x5d, 0xc1, 0xe9, 0x24, 0x25, 0x22, 0x38, 0x44, 0xb6, 0xab, 0x59, 0xe1, 0x68, 0xa6, 0x24, 0x3e, 0x82, 0xd4, 0x45, 0x40, 0xe4, 0xe6, 0x8b, 0x9f, 0x96, 0xed, 0x9d, 0x68}} + info := bindataFileInfo{name: "assets/dns/daemonset.yaml", size: 6384, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa2, 0x4d, 0x67, 0xbe, 0xbf, 0xa7, 0x40, 0xda, 0xc1, 0x2f, 0xdb, 0xe, 0xbc, 0x85, 0xc0, 0x8f, 0x57, 0xe1, 0xbc, 0x20, 0xcb, 0x21, 0x4e, 0xe0, 0xe1, 0x31, 0xcf, 0x9c, 0x5b, 0x23, 0x60, 0x11}} return a, nil } diff --git a/pkg/operator/controller/controller_dns_configmap.go b/pkg/operator/controller/controller_dns_configmap.go index f9e765a3f..93a8506bb 100644 --- a/pkg/operator/controller/controller_dns_configmap.go +++ b/pkg/operator/controller/controller_dns_configmap.go @@ -31,7 +31,10 @@ var corefileTemplate = template.Must(template.New("Corefile").Parse(`{{range .Se {{end -}} .:5353 { errors - health + health { + lameduck 20s + } + ready kubernetes {{.ClusterDomain}} in-addr.arpa ip6.arpa { pods insecure upstream diff --git a/pkg/operator/controller/controller_dns_configmap_test.go b/pkg/operator/controller/controller_dns_configmap_test.go index 8a82c0dfe..3fc4632b4 100644 --- a/pkg/operator/controller/controller_dns_configmap_test.go +++ b/pkg/operator/controller/controller_dns_configmap_test.go @@ -43,7 +43,10 @@ bar.com:5353 example.com:5353 { } .:5353 { errors - health + health { + lameduck 20s + } + ready kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure upstream From 2e188c0ea854730f181ec7659b18b3325de0657f Mon Sep 17 00:00:00 2001 From: Miciah Masters Date: Thu, 4 Mar 2021 15:17:27 -0500 Subject: [PATCH 2/3] Delete TestCoreDNSImageUpgrade Delete the TestCoreDNSImageUpgrade CI test. This test is unreliable, and we can achieve sufficient test coverage without it. * test/e2e/operator_test.go (TestCoreDNSImageUpgrade, setVersion, setImage, checkCurrentDNSImage): Delete functions. --- test/e2e/operator_test.go | 133 -------------------------------------- 1 file changed, 133 deletions(-) diff --git a/test/e2e/operator_test.go b/test/e2e/operator_test.go index e53a615e4..775fa9085 100644 --- a/test/e2e/operator_test.go +++ b/test/e2e/operator_test.go @@ -176,139 +176,6 @@ func TestDefaultDNSSteadyConditions(t *testing.T) { } } -func TestCoreDNSImageUpgrade(t *testing.T) { - cl, err := getClient() - if err != nil { - t.Fatal(err) - } - // Override the cluster version to temporarily disable CVO updates to the DNS operator deployment. - deplOverride := configv1.ComponentOverride{ - Kind: "Deployment", - Group: "apps/v1", - Namespace: "openshift-dns-operator", - Name: "dns-operator", - Unmanaged: true, - } - - clusterVersion := &configv1.ClusterVersion{} - cvName := types.NamespacedName{Namespace: "default", Name: "version"} - - if err := cl.Get(context.TODO(), cvName, clusterVersion); err != nil { - t.Fatalf("failed to get cluster version %s/%s: %v", cvName.Namespace, cvName.Name, err) - } - - clusterVersion.Spec.Overrides = []configv1.ComponentOverride{deplOverride} - - if err := cl.Update(context.TODO(), clusterVersion); err != nil { - t.Fatalf("failed to update cluster version %s/%s: %v", cvName.Namespace, cvName.Name, err) - } - - // Remove cluster version override once the test finishes. - defer func() { - if err := cl.Get(context.TODO(), cvName, clusterVersion); err != nil { - t.Fatalf("failed to get cluster version %s/%s: %v", cvName.Namespace, cvName.Name, err) - } - - clusterVersion.Spec.Overrides = []configv1.ComponentOverride{} - - if err := cl.Update(context.TODO(), clusterVersion); err != nil { - t.Fatalf("failed to update cluster version %s/%s: %v", cvName.Namespace, cvName.Name, err) - } - }() - - deployment := &appsv1.Deployment{} - namespacedName := types.NamespacedName{Namespace: "openshift-dns-operator", Name: "dns-operator"} - err = wait.PollImmediate(1*time.Second, 5*time.Minute, func() (bool, error) { - if err := cl.Get(context.TODO(), namespacedName, deployment); err != nil { - t.Logf("failed to get deployment %s/%s: %v", namespacedName.Namespace, namespacedName.Name, err) - return false, nil - } - return true, nil - }) - if err != nil { - t.Errorf("failed to get deployment: %v", err) - } - - var curImage string - for _, env := range deployment.Spec.Template.Spec.Containers[0].Env { - if env.Name == "IMAGE" { - curImage = env.Value - break - } - } - if len(curImage) == 0 { - t.Errorf("env IMAGE not found in the operator deployment") - } - - newImage := "openshift/origin-coredns:latest" - setImage(deployment, newImage) - if err := cl.Update(context.TODO(), deployment); err != nil { - t.Fatalf("failed to update dns operator to new coredns image: %v", err) - } - defer func() { - if err := cl.Get(context.TODO(), namespacedName, deployment); err != nil { - t.Fatalf("failed to get latest deployment: %v", err) - } - setImage(deployment, curImage) - if err := cl.Update(context.TODO(), deployment); err != nil { - t.Fatalf("failed to restore dns operator to old coredns image: %v", err) - } - // Ensure the image change is completely reverted before - // moving on to the next test. - err = checkCurrentDNSImage(t, cl, curImage) - if err != nil { - t.Fatalf("failed to observe restored coredns image: %v", err) - } - }() - - err = checkCurrentDNSImage(t, cl, newImage) - if err != nil { - t.Fatalf("failed to observe updated coredns image: %v", err) - } -} - -func setVersion(deployment *appsv1.Deployment, version string) { - for i, env := range deployment.Spec.Template.Spec.Containers[0].Env { - if env.Name == "RELEASE_VERSION" { - deployment.Spec.Template.Spec.Containers[0].Env[i].Value = version - break - } - } -} - -func setImage(deployment *appsv1.Deployment, image string) { - for i, env := range deployment.Spec.Template.Spec.Containers[0].Env { - if env.Name == "IMAGE" { - deployment.Spec.Template.Spec.Containers[0].Env[i].Value = image - break - } - } -} - -func checkCurrentDNSImage(t *testing.T, cl client.Client, expectedImage string) error { - err := wait.PollImmediate(1*time.Second, 7*time.Minute, func() (bool, error) { - podList := &corev1.PodList{} - if err := cl.List(context.TODO(), podList, client.InNamespace("openshift-dns")); err != nil { - t.Logf("failed to get pod list in openshift-dns namespace: %v", err) - return false, nil - } - - for _, pod := range podList.Items { - for _, container := range pod.Spec.Containers { - if container.Name == "dns" { - if container.Image != expectedImage { - return false, nil - } - break - } - } - } - return true, nil - }) - - return err -} - func TestDNSForwarding(t *testing.T) { cl, err := getClient() if err != nil { From 0b1e8af8aefe5434a60dbe2e45fc4c9e858128dd Mon Sep 17 00:00:00 2001 From: Miciah Masters Date: Fri, 5 Mar 2021 13:13:12 -0500 Subject: [PATCH 3/3] Add TestCoreDNSDaemonSetReconciliation Add an end-to-end test that verifies that the operator reconciles changes to the dns-default daemonset. This new test adds a node selector to the daemonset and verifies that the operator reverts the change. The operator already has unit tests to verify that the daemonset update logic handles changes to image pullspecs and other important fields. Together, the new end-to-end test and the existing unit tests should provide sufficient test coverage for reconciliation of daemonsets. * test/e2e/operator_test.go (TestCoreDNSDaemonSetReconciliation): New test. Verify that the operator reconciles the dns-default daemonset. --- test/e2e/operator_test.go | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/test/e2e/operator_test.go b/test/e2e/operator_test.go index 775fa9085..a4f8001dc 100644 --- a/test/e2e/operator_test.go +++ b/test/e2e/operator_test.go @@ -176,6 +176,66 @@ func TestDefaultDNSSteadyConditions(t *testing.T) { } } +// TestCoreDNSDaemonSetReconciliation verifies that the operator reconciles the +// dns-default daemonset. The test modifies the daemonset and verifies that the +// operator reverts the change. +func TestCoreDNSDaemonSetReconciliation(t *testing.T) { + cl, err := getClient() + if err != nil { + t.Fatal(err) + } + + defaultDNS := &operatorv1.DNS{} + err = wait.PollImmediate(1*time.Second, 5*time.Minute, func() (bool, error) { + if err := cl.Get(context.TODO(), types.NamespacedName{Name: operatorcontroller.DefaultDNSController}, defaultDNS); err != nil { + t.Logf("failed to get dns %q: %v", operatorcontroller.DefaultDNSController, err) + return false, nil + } + return true, nil + }) + if err != nil { + t.Fatalf("failed to get dns %q: %v", operatorcontroller.DefaultDNSController, err) + } + + newNodeSelector := "foo" + namespacedName := operatorcontroller.DNSDaemonSetName(defaultDNS) + err = wait.PollImmediate(1*time.Second, 5*time.Minute, func() (bool, error) { + dnsDaemonSet := &appsv1.DaemonSet{} + if err := cl.Get(context.TODO(), namespacedName, dnsDaemonSet); err != nil { + t.Logf("failed to get daemonset %s: %v", namespacedName, err) + return false, nil + } + dnsDaemonSet.Spec.Template.Spec.NodeSelector[newNodeSelector] = "" + if err := cl.Update(context.TODO(), dnsDaemonSet); err != nil { + t.Logf("failed to update daemonset %s: %v", namespacedName, err) + return false, nil + } + return true, nil + }) + if err != nil { + t.Errorf("failed to update daemonset %s: %v", namespacedName, err) + } + + err = wait.PollImmediate(1*time.Second, 5*time.Minute, func() (bool, error) { + dnsDaemonSet := &appsv1.DaemonSet{} + if err := cl.Get(context.TODO(), namespacedName, dnsDaemonSet); err != nil { + t.Logf("failed to get daemonset %s: %v", namespacedName, err) + return false, nil + } + for k := range dnsDaemonSet.Spec.Template.Spec.NodeSelector { + if k == newNodeSelector { + t.Logf("found %q node selector on daemonset %s: %v", newNodeSelector, namespacedName, err) + return false, nil + } + } + t.Logf("observed absence of %q node selector on daemonset %s: %v", newNodeSelector, namespacedName, err) + return true, nil + }) + if err != nil { + t.Errorf("failed to observe reversion of update to daemonset %s: %v", namespacedName, err) + } +} + func TestDNSForwarding(t *testing.T) { cl, err := getClient() if err != nil {