From 7578210f1d0c1ebfa180fc6f4db00923f1d52e47 Mon Sep 17 00:00:00 2001 From: Mateusz Gozdek Date: Wed, 18 Nov 2020 10:36:36 +0100 Subject: [PATCH] Fix controlplane running as DaemonSet on single node clusters This commit fixes passed 'control_plane_replicas' value to Kubernetes Helm chart which caused kube-scheduler and kube-controller-manager to run as DaemonSet on single controlplane node clusters, which breaks the ability to update it gracefully. It also adds tests that controlplane is using right resource type on different controlplane sizes and that both can be gracefully updated without breaking cluster functionality. Closes #1097 Closes #90 Signed-off-by: Mateusz Gozdek --- assets/terraform-modules/bootkube/assets.tf | 2 +- pkg/assets/generated_assets.go | 4 +- test/components/coredns/coredns_test.go | 35 --------- .../kubernetes/controller-manager_test.go | 35 --------- .../controlplane-multi-node_test.go | 73 +++++++++++++++++++ .../controlplane-single-node_test.go | 71 ++++++++++++++++++ .../kubernetes/controlplane_test.go | 22 ++++++ 7 files changed, 169 insertions(+), 73 deletions(-) delete mode 100644 test/components/coredns/coredns_test.go delete mode 100644 test/components/kubernetes/controller-manager_test.go create mode 100644 test/components/kubernetes/controlplane-multi-node_test.go create mode 100644 test/components/kubernetes/controlplane-single-node_test.go create mode 100644 test/components/kubernetes/controlplane_test.go diff --git a/assets/terraform-modules/bootkube/assets.tf b/assets/terraform-modules/bootkube/assets.tf index 17a312bca..17ca7454b 100644 --- a/assets/terraform-modules/bootkube/assets.tf +++ b/assets/terraform-modules/bootkube/assets.tf @@ -69,7 +69,7 @@ resource "local_file" "kubernetes" { kube_scheduler_image = var.container_images["kube_scheduler"] kube_proxy_image = var.container_images["kube_proxy"] coredns_image = "${var.container_images["coredns"]}${var.container_arch}" - control_plane_replicas = max(2, length(var.etcd_servers)) + control_plane_replicas = length(var.etcd_servers) cloud_provider = var.cloud_provider pod_cidr = var.pod_cidr service_cidr = var.service_cidr diff --git a/pkg/assets/generated_assets.go b/pkg/assets/generated_assets.go index 6453aef29..583913009 100644 --- a/pkg/assets/generated_assets.go +++ b/pkg/assets/generated_assets.go @@ -5712,9 +5712,9 @@ var vfsgenAssets = func() http.FileSystem { "/terraform-modules/bootkube/assets.tf": &vfsgen۰CompressedFileInfo{ name: "assets.tf", modTime: time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC), - uncompressedSize: 8325, + uncompressedSize: 8317, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x59\x4d\x6f\xdb\x3c\x12\xbe\xfb\x57\x0c\x94\x16\xb1\x17\xfe\x48\xbb\xdd\x5d\x34\x80\x51\xec\x69\x51\x6c\x0f\x45\xd1\x3d\x05\x81\x40\x53\x63\x9b\x1b\x99\xd4\x92\x54\x9a\x20\xf0\x7f\x5f\x90\xd4\x07\x25\x51\x96\x62\x37\xef\x9b\x4b\x2b\x71\xe6\xe1\x70\xe6\xd1\x33\xc3\x44\xa2\x12\xb9\xa4\x08\x51\x2a\x28\x49\xe3\x2d\x4b\x31\x82\x68\x23\x84\x56\x5a\x92\x6c\x41\x32\xa6\x50\x3e\xa2\x8c\xe0\x65\x02\x60\xd6\x39\x39\x20\xac\x21\x7a\xf7\xf2\x48\xe4\x92\x28\x85\x3a\x4e\x98\x3c\xae\x6a\xaf\x03\xe1\x6c\x8b\x4a\xab\x55\x00\x69\xf9\x4c\x0e\x69\x34\x01\xa0\x82\x6b\xe4\x1a\xd6\xa0\xf1\x90\xa5\x44\xa3\x81\x9f\x46\xef\x5e\x32\xa2\xf7\xcb\x83\x48\xf2\x14\x8f\xab\x32\x46\xf5\xba\x0d\xe6\x36\x60\x80\x87\x7c\x83\x71\xb5\x16\xb3\x03\xd9\x99\xf0\x4d\xec\x26\x00\xc2\x78\xf9\x56\xdd\x45\x4d\xe3\xe8\xde\x22\xd0\x54\xe4\x49\x9c\x49\xf1\xc8\x12\x94\xe0\x7e\x0a\x84\xc6\x92\xb5\x46\x4d\x93\xd8\xf9\x2b\x80\xca\xfa\xbf\x82\xf1\x69\x34\x8f\xe6\xb0\x15\xf2\x40\x74\xca\x94\x9e\x46\x7b\xad\x33\x75\xbb\x5a\xbd\x57\xb7\x1f\xff\xfa\x8f\xcf\xd1\xdc\xa2\xfa\x10\xb3\x99\x45\x35\x4f\x8c\x62\x4c\x59\x22\x3d\x54\x63\xed\x2f\x59\x5b\x2d\x73\xa5\x31\x89\x29\x4a\xad\x4c\x69\x6a\xdb\xce\x92\x0b\x99\x93\x4d\x8a\xb1\x4e\x55\x5c\xa5\xb3\x70\x08\x2d\x4d\x00\x8e\xb3\xc9\x71\x32\x19\x64\x8f\x49\xb0\x14\x69\x8a\xd2\x54\x8c\xec\x7e\x03\x8d\xba\x90\x6f\xc5\xa7\xbe\x9d\x1a\xc4\xaa\x8d\xe2\xc2\x68\x0c\xc3\xba\x5e\x05\xd5\x32\x91\x34\x4b\xdc\xf8\x71\x98\xa5\x4d\x3f\x2f\x86\x08\x12\x24\x74\xcb\x29\xc0\xec\x20\xaf\x5a\x6e\x21\x82\x8d\x24\x8b\xa2\x7b\x34\x15\xba\x9c\x23\x15\xd2\x5b\x51\xa3\xb5\x41\x83\x11\xd5\xda\x18\x22\xd4\x67\xbe\x1f\x4a\x94\xb1\x7f\x95\x1c\xd3\x3d\x91\x5a\xad\xac\x9f\x7a\x56\x1a\x0f\xab\x26\xc6\xf9\xd9\xf1\xa1\x5f\x23\xbb\x1e\xbd\xc6\x49\x6f\x50\x4c\x7f\x8b\xa0\xf6\x7e\x03\xbd\xf4\xef\xfd\xd4\x5e\x23\xc3\x43\x52\x4c\x89\x7d\x11\xfa\x94\x37\x44\xe1\xdf\x3f\x21\xa7\x22\xc1\xa9\x11\x64\x85\xe9\x36\x56\x6c\xc7\x0b\x94\xa5\xad\x07\x25\x4b\xf3\x10\x67\x78\x70\x27\xad\x8b\xf0\x80\xcf\x03\x90\x99\x64\x8f\x44\xa3\xb1\x5c\xd6\x85\xf5\xde\x86\x60\x5b\x01\x07\x60\x2d\x91\xd3\xe7\x46\xb0\x35\x7c\x33\xdc\x22\x8f\x84\x52\x91\x73\x1d\x67\xf9\x66\x5c\xb8\x85\xdf\xa2\x70\x5c\x66\xf9\x26\x65\xb4\x19\xb3\xe5\x41\x28\xc5\x63\xb2\x6b\x9c\xbb\xd9\x75\x90\x29\x43\xae\x9b\xb0\x23\xd3\xe0\x5c\x4f\x80\x36\x8a\x36\x90\x83\x02\x2c\x58\xaf\xa2\x93\x93\xdd\x4e\xe2\x8e\x68\x26\x78\x83\x8e\xdd\x65\x57\xe5\xfa\xb9\x99\xb8\x3e\x2f\x58\xaf\x0d\xf3\x11\xbe\x34\x43\x75\x9f\x2b\x44\x73\x08\x26\xd7\x43\x30\x39\xfe\x4b\x9d\x90\x19\xdc\x42\x14\x75\x83\xf1\x53\x7e\x59\x30\x41\x76\xfa\xf1\xb8\xac\x8e\x8e\xc9\x55\xec\xb2\x98\x1a\x1f\x62\x28\x96\x76\x8d\xbd\x90\x24\x66\x29\xa3\x44\x05\x34\x24\x45\xbe\xd3\xfb\x69\x47\x13\x1d\x43\x9e\xb4\x24\xf1\x36\x25\x3b\xd5\xf6\x33\x0e\x2d\x45\xf7\xac\xfb\x87\xc8\x0e\x53\xda\x83\x24\x00\xdb\x71\x21\x31\x7e\xfa\xdb\xcd\xe7\x98\xf2\x98\xee\x91\x3e\x78\x7e\xa1\xe5\xa1\x56\x99\x89\x64\x61\x0d\x33\xc1\xb8\x3e\xb7\x59\xb6\x51\x2e\x6e\x97\x61\xc0\xb2\x61\xda\xb1\xce\x5b\x1d\x18\x1f\xda\xe6\xde\x00\x71\x05\xdf\x45\x96\x9b\xb8\x6c\x17\x96\x1c\x35\x2a\xb0\x41\xc0\x23\x49\x73\x54\x36\x17\x60\x92\x91\x78\x26\x36\x9e\xe5\xa9\xf9\xc3\xd9\x9d\x3f\x7b\x78\xfb\x5c\x3a\x77\xf8\x50\x6f\x39\x91\x07\x67\xba\xd6\x97\x31\x6a\xb8\x2b\xa0\x32\x29\x9e\x9e\xdb\x30\x83\x50\xd6\xab\xbc\x8e\x0a\x89\x09\x57\x21\x0c\x0b\x53\x54\xa3\x8b\x54\x38\x46\xf7\xc7\xb6\x05\x91\x74\x7f\x8c\x0a\x74\x9b\x88\x38\x4b\x09\xc7\xb8\x2d\x25\x6b\x38\x90\xa7\xe9\xc7\x79\xaf\x90\x0c\x0c\x57\xfe\x49\xbb\x13\xd6\x1f\x75\xfb\x31\x83\x97\x8c\x13\x71\x20\x8c\xc7\x2a\xdf\x6e\xd9\x53\x27\xb8\x80\x4d\xd3\x9b\xab\xb8\x84\x66\x59\xed\x6d\xb6\xd9\x0b\xa5\xa7\xed\xbd\xe7\xf0\xe1\x66\x76\xd1\x3d\xea\xc4\x74\x58\x78\x9e\x3b\x22\x52\xd2\x9e\x0d\x07\x70\xfd\xf6\x54\x42\x06\xa7\x0e\xc7\x8b\x7e\x64\x37\xbb\x37\xe6\xf6\xf7\xaa\x98\xda\x49\xc6\x4a\x5e\xdd\xdd\xdc\x17\x93\xfc\x93\x46\xc9\x49\xea\x35\xa2\x4c\x48\x1d\x1c\x1d\x5f\x37\xee\x76\xe6\xc7\xe0\x10\x65\xb8\x8e\x3c\xb1\xa2\xdb\x69\xb0\xeb\xfa\xb2\x51\xd9\x9c\xee\x8d\xbe\xdb\xa9\xdf\xb4\x58\x25\x56\x56\xe6\xaa\xc5\x58\x21\x95\xa8\xd5\xab\xe5\xd3\xbb\xc7\x3a\x84\xa6\x8a\xd6\x1b\x68\xf1\x80\xdc\xe0\xdf\x4d\x5c\xa4\x5b\x21\xc1\xbe\x04\xc6\x6d\xd0\x1d\xdb\xdb\xc2\xf2\x65\x52\x9e\xce\x2e\xc4\x2c\x29\x8e\x6a\x1f\x97\xe5\xcb\x96\x95\x8b\xa7\x65\xe5\x5e\x16\x96\x47\xfb\x6f\xb0\xd7\x75\x8e\xd5\xdb\xf2\xc2\x09\xe8\xed\x7c\x1d\x73\xd7\x00\x2d\x4d\x4e\x14\xcf\x1b\xf4\x3e\xc0\x2d\xdc\x4c\xce\x68\x9a\x3d\xa5\xf2\x7a\xa7\x19\xea\x4c\xb0\xcb\x0e\x2f\x5a\xbc\x31\xb0\x29\x96\x01\x27\x4c\xd9\x88\xad\x40\x18\xbd\xc2\x24\xae\x2c\xd6\xb0\x25\xa9\xaa\x03\x07\xb8\x82\x1f\xc8\x8d\x94\x17\x36\x36\x0c\x4b\x87\xd2\xc9\x06\x5f\x6f\x13\x5f\xd2\xdb\xcb\x0d\x1a\x8d\xdd\x80\x76\xba\x6f\x6f\xaf\x6b\x78\x44\xf7\xc7\xc5\xa9\x96\x17\x96\xf4\x51\x5a\xde\xd3\x4c\x86\xba\x48\x8f\x20\x0c\x29\x41\x91\x5f\x2a\xf8\x96\xed\xe2\xb3\x53\x5d\x63\x2c\x0a\x8c\x2a\xd3\xad\x3b\xde\xb9\x0d\xa5\x0a\xcd\x60\x8d\xbc\x09\x97\x95\x0f\x23\x59\x31\x1f\xd1\x89\x0c\xc2\x70\x27\xfa\xad\x8d\xa7\x53\x18\x92\x1c\x18\xbf\xa8\x2c\x16\xa1\x2a\x8a\x55\x8c\x66\xb7\x28\xa9\x65\x96\xfe\xec\xc2\xd9\x60\x2f\x28\x9b\xf3\xbf\xa4\x68\x4e\x01\xbd\xb2\xc5\x65\xb9\x46\xd6\xaf\x7b\x6b\xaa\x34\xad\xe7\xca\x54\x6a\xd4\xc9\xfb\x92\xf9\xb2\x1a\xbd\xc2\x05\x5a\x2c\x4d\x9a\x32\xee\x7e\x01\x10\xcd\xe1\xce\xe8\x2a\x33\x2d\x56\x12\xbe\xc3\xe9\xcd\x1c\x3e\x98\xeb\x7d\xc3\xb9\xa4\xd7\xfd\xec\xcc\xbb\x58\x25\xb2\xee\xf0\xff\x42\x8e\x92\xe8\xe2\x74\x8e\x86\x56\xe0\xff\xed\x6c\xd5\xa9\x73\xb6\xc4\xa4\x38\x72\xab\x41\xf5\x2b\xd7\xd0\x09\x48\xae\xf7\x21\xd1\x6a\x47\x6e\x89\xe4\xc7\x3f\x35\xfa\x69\x9e\x41\xe2\xff\x72\x26\x51\x01\xd3\xb0\x41\x20\x1a\x5a\xa0\xb3\xc9\x15\x94\xb4\xda\x31\xbd\xcf\x37\x4b\x2a\xfc\x5b\xeb\x82\x71\x9a\x6f\x88\x16\x72\x55\xa2\xae\x36\xa9\xd8\xac\x0e\xc4\x7c\x89\xab\xec\x61\xe7\x2d\x14\xff\x59\xee\xc4\xd5\xb7\x4f\x1f\x47\xe4\xce\x7d\xf1\x83\x99\x6b\x48\xcb\x2b\xf3\x36\x9c\x2f\xc6\x81\xf8\x44\x27\x5b\x8d\x12\xf4\x1e\xcb\x3e\x37\xf6\x20\x0b\xeb\xff\x16\xc7\x29\xfa\xb8\x27\x7f\xc7\x45\xe3\x78\x5f\xb7\x6d\x0d\xaf\xc4\x00\x98\xe2\xd7\x1a\x14\xea\x39\xe4\x0a\xdb\x76\xcb\xc9\x15\xfc\xdc\x33\x05\x4c\x59\xe6\xab\x3c\x33\x12\xc1\xf8\x0e\x14\x66\xc4\xe4\x0c\xfe\xf9\xfd\x6b\x29\x4a\xff\xf9\xf1\xcd\xd9\x55\xf0\xee\x97\x73\xca\xa5\x71\x43\xe8\xc3\x2f\x22\x93\x05\x15\x87\x8c\x68\xb6\x49\x11\x7e\x91\x67\xb7\x09\xda\xfd\xc5\x16\x54\x96\x32\x3d\x9d\x01\xe1\x89\x13\x80\x19\xec\x51\xa2\x09\x61\x83\x94\x18\xab\x9f\x28\x25\x31\xca\x77\xad\x4c\x2e\x13\xa6\x99\x30\xbb\x89\xcc\x94\x51\x48\x98\x5e\x7f\xb9\x9e\x01\x25\x9c\x0b\x43\xee\xc9\x95\x01\x4f\xe0\x17\xd3\x7b\x48\x99\xd2\x6a\xe9\xcf\x81\xc1\xc4\xac\x8b\x40\xec\xdf\x53\xea\xbf\xac\xf4\x25\x72\x66\x66\xc4\x28\x82\x2f\xfd\xb6\x46\xb0\x46\x00\x19\xe9\xfd\x7f\x00\x00\x00\xff\xff\xa5\x84\x4a\xd6\x85\x20\x00\x00"), + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x59\x5d\x6f\xdb\xb8\x12\x7d\xf7\xaf\x18\x28\x2d\x62\x5f\xf8\x23\xed\xed\xbd\x8b\x06\x08\x8a\x7d\x5a\x14\xdb\x87\xa2\xe8\x3e\x05\x81\x40\x53\x63\x9b\x1b\x99\xd4\x92\x54\x9a\x20\xf0\x7f\x5f\x90\xd4\x07\x25\x51\x96\x62\x37\xbb\x79\x69\x25\xce\x1c\x0e\x67\x8e\xce\x0c\x13\x89\x4a\xe4\x92\x22\x44\xa9\xa0\x24\x8d\x37\x2c\xc5\x08\xa2\xb5\x10\x5a\x69\x49\xb2\x05\xc9\x98\x42\xf9\x80\x32\x82\xe7\x09\x80\x59\xe7\x64\x8f\x70\x03\xd1\x9b\xe7\x07\x22\x97\x44\x29\xd4\x71\xc2\xe4\x61\x55\x7b\xed\x09\x67\x1b\x54\x5a\xad\x02\x48\xcb\x27\xb2\x4f\xa3\x09\x00\x15\x5c\x23\xd7\x70\x03\x1a\xf7\x59\x4a\x34\x1a\xf8\x69\xf4\xe6\x39\x23\x7a\xb7\xdc\x8b\x24\x4f\xf1\xb0\x2a\x63\x54\x2f\xdb\x60\x6e\x03\x06\xb8\xcf\xd7\x18\x57\x6b\x31\xdb\x93\xad\x09\xdf\xc4\x6e\x02\x20\x8c\x97\x6f\xd5\x6d\xd4\x34\x8e\xee\x2c\x02\x4d\x45\x9e\xc4\x99\x14\x0f\x2c\x41\x09\xee\xa7\x40\x68\x2c\x59\x6b\xd4\x34\x89\x9d\xbf\x02\xa8\xac\xff\x14\x8c\x4f\xa3\x79\x34\x87\x8d\x90\x7b\xa2\x53\xa6\xf4\x34\xda\x69\x9d\xa9\xeb\xd5\xea\xad\xba\x7e\xff\xdf\x5f\x3e\x46\x73\x8b\xea\x43\xcc\x66\x16\xd5\x3c\x31\x8a\x31\x65\x89\xf4\x50\x8d\xb5\xbf\x64\x6d\xb5\xcc\x95\xc6\x24\xa6\x28\xb5\x32\xa5\xa9\x6d\x3b\x4b\x2e\x64\x4e\xd6\x29\xc6\x3a\x55\x71\x95\xce\xc2\x21\xb4\x34\x01\x38\xcc\x26\x87\xc9\x64\x90\x3d\x26\xc1\x52\xa4\x29\x4a\x53\x31\xb2\xfd\x09\x34\xea\x42\xbe\x16\x9f\xfa\x76\x6a\x10\xab\x36\x8a\x0b\xa3\x31\x0c\xeb\x7a\x15\x54\xcb\x44\xd2\x2c\x71\xe3\xc7\x61\x96\x36\xfd\xbc\x18\x22\x48\x90\xd0\x2d\xa7\x00\xb3\x83\xbc\x6a\xb9\x85\x08\x36\x92\x2c\x8a\xee\xd0\x54\xe8\x7c\x8e\x54\x48\xaf\x45\x8d\xd6\x06\x0d\x46\x54\x6b\x63\x88\x50\x9f\xf9\x6e\x28\x51\xc6\xfe\x45\x72\x4c\x77\x44\x6a\xb5\xb2\x7e\xea\x49\x69\xdc\xaf\x9a\x18\xa7\x67\xc7\x87\x7e\x89\xec\x7a\xf4\x1a\x27\xbd\x41\x31\xfd\x29\x82\xda\xfb\x0d\xf4\xd2\xbf\xf7\x53\x7b\x89\x0c\x0f\x49\x31\x25\xf6\x45\xe8\x53\x5e\x13\x85\xff\xff\x80\x9c\x8a\x04\xa7\x46\x90\x15\xa6\x9b\x58\xb1\x2d\x2f\x50\x96\xb6\x1e\x94\x2c\xcd\x43\x9c\xe1\xde\x9d\xb4\x2e\xc2\x3d\x3e\x0d\x40\x66\x92\x3d\x10\x8d\xc6\x72\x59\x17\xd6\x7b\x1b\x82\x6d\x05\x1c\x80\xb5\x44\x4e\x9f\x1a\xc1\xd6\xf0\xcd\x70\x8b\x3c\x12\x4a\x45\xce\x75\x9c\xe5\xeb\x71\xe1\x16\x7e\x8b\xc2\x71\x99\xe5\xeb\x94\xd1\x66\xcc\x96\x07\xa1\x14\x8f\xc9\xae\x71\xee\x66\xd7\x41\xa6\x0c\xb9\x6e\xc2\x8e\x4c\x83\x73\x3d\x02\xda\x28\xda\x40\x0e\x0a\xb0\x60\xbd\x8a\x4e\x4e\xb6\x5b\x89\x5b\xa2\x99\xe0\x0d\x3a\x76\x97\x5d\x95\xeb\xe7\x66\xe2\xfa\xbc\xe0\xe6\xc6\x30\x1f\xe1\x53\x33\x54\xf7\xb9\x42\x34\x87\x60\x72\x3d\x04\x93\xe3\xff\xd4\x09\x99\xc1\x35\x44\x51\x37\x18\x3f\xe5\xe7\x05\x13\x64\xa7\x1f\x8f\xcb\xea\xe8\x98\x5c\xc5\xce\x8b\xa9\xf1\x21\x86\x62\x69\xd7\xd8\x0b\x49\x62\x96\x32\x4a\x54\x40\x43\x52\xe4\x5b\xbd\x9b\x76\x34\xd1\x31\xe4\x51\x4b\x12\x6f\x52\xb2\x55\x6d\x3f\xe3\xd0\x52\x74\xcf\xba\x7f\x88\xec\x30\xa5\x3d\x48\x02\xb0\x2d\x17\x12\xe3\xc7\xff\x5d\x7d\x8c\x29\x8f\xe9\x0e\xe9\xbd\xe7\x17\x5a\x1e\x6a\x95\x99\x48\x16\xd6\x30\x13\x8c\xeb\x53\x9b\x65\x1b\xe5\xec\x76\x19\x06\x2c\x1b\xa6\x1d\xeb\xbc\xd5\x81\xf1\xa1\x6d\xee\x0d\x10\x17\xf0\x55\x64\xb9\x89\xcb\x76\x61\xc9\x51\xa3\x02\x1b\x04\x3c\x90\x34\x47\x65\x73\x01\x26\x19\x89\x67\x62\xe3\x59\x1e\x9b\x3f\x9c\xdd\xe9\xb3\x87\xb7\xcf\xb9\x73\x87\x0f\xf5\x9a\x13\x79\x70\xa6\x6b\x7d\x19\xa3\x86\xbb\x02\x2a\x93\xe2\xf1\xa9\x0d\x33\x08\x65\xbd\xca\xeb\xa8\x90\x98\x70\x15\xc2\xb0\x30\x45\x35\xba\x48\x85\x63\x74\x77\x68\x5b\x10\x49\x77\x87\xa8\x40\xb7\x89\x88\xb3\x94\x70\x8c\xdb\x52\x32\xa0\x20\x27\x5e\x2c\xfe\xa9\x5b\x8f\x19\xb8\x64\x9c\x88\x3d\x61\x3c\x56\xf9\x66\xc3\x1e\x3b\xc1\x05\x6c\x9a\xde\x5c\xc5\x25\x34\xcb\x6a\x6f\xb3\xcd\x4e\x28\x3d\x6d\xef\x3d\x87\x77\x57\xb3\xb3\xee\x4f\x47\xa6\xc2\xc2\xf3\xd4\xd1\x90\x92\xf6\x4c\x38\x80\xeb\xb7\xa5\x12\x32\x38\x6d\x38\x5a\xf4\x23\xbb\x99\xbd\x31\xaf\xbf\x55\xc5\xb4\x4e\x32\x56\xd2\xea\xf6\xea\xae\x98\xe0\x1f\x35\x4a\x4e\x52\xaf\x01\x65\x42\xea\xe0\xc8\xf8\xb2\x31\xb7\x33\x37\x06\x87\x27\x43\x75\xe4\x89\x15\xdb\x4e\x63\xbd\xa9\x2f\x19\x95\xcd\xf1\x9e\xe8\xbb\x1d\xfb\x0d\x8b\x55\x60\x65\xe5\xad\x5a\x8c\x15\x52\x89\x5a\xbd\x58\x36\xbd\xfb\xab\x43\x68\xaa\x67\xbd\x81\x16\xf7\xc8\x0d\xfe\xed\xc4\x45\xba\x11\x12\xec\x4b\x60\xdc\x06\xdd\xb1\xbd\x2e\x2c\x9f\x27\xe5\xe9\xec\x42\xcc\x92\xe2\xa8\xf6\x71\x59\xbe\x6c\x59\xb9\x78\x5a\x56\xee\x65\x61\x79\xb0\xff\x06\x7b\x5c\xe7\x58\xbd\xad\x2e\x9c\x80\xde\x8e\xd7\x31\x77\x8d\xcf\xd2\xe4\x48\xf1\xbc\x01\xef\x1d\x5c\xc3\xd5\xe4\x84\x66\xd9\x53\x2a\xaf\x67\x1a\x29\x36\xc1\x2e\x3b\xbc\x68\xf1\xc6\xc0\xa6\x58\x06\x9c\x30\x65\x23\xb6\x02\x61\xf4\x0a\x93\xb8\xb2\xb8\x81\x0d\x49\x55\x1d\x38\xc0\x05\x7c\x43\x6e\xa4\xbc\xb0\xb1\x61\x58\x3a\x94\x4e\x36\xf8\x7a\x9b\xf8\x9c\x9e\x5e\x6e\xd0\x68\xe8\x06\xb4\xd3\x75\x7b\x7b\x5c\xc3\x23\xba\x3b\x2c\x8e\xb5\xba\xb0\xa4\x8f\xd2\xf2\x9e\x66\x32\xd4\x45\x7a\x04\x61\x48\x09\x8a\xfc\x52\xc1\x37\x6c\x1b\x9f\x9c\xea\x1a\x63\x51\x60\x54\x99\x6e\xdd\xed\x4e\x6d\x28\x55\x68\x06\x6b\xe4\x0d\xb8\xac\x7c\x18\xc9\x8a\xf9\x88\x4e\x64\x10\x86\x3b\xd1\x4f\x6d\x3c\x9d\xc2\x90\x64\xcf\xf8\x59\x65\xb1\x08\x55\x51\xac\x62\x34\xbb\x45\x49\x2d\xb3\xf4\x6f\x17\xce\x06\x7b\x46\xd9\x9c\xff\x39\x45\x73\x0a\xe8\x95\x2d\x2e\xcb\x35\xb2\x7e\xdd\xdb\x52\xa5\x69\x3d\x57\xa5\x52\xa3\x8e\xde\x93\xcc\x97\xd5\xe8\x15\x2e\xd0\x62\x69\xd2\x94\x71\x77\xf1\x8f\xe6\x70\x6b\x74\x95\x99\x16\x2b\x09\xdf\xe2\xf4\x6a\x0e\xef\xcc\xb5\xbe\xe1\x5c\xd2\xeb\x6e\x76\xe2\x1d\xac\x12\x59\x77\xf8\xdf\x90\xa3\x24\xba\x38\x9d\xa3\xa1\x15\xf8\xdf\x9d\xad\x3a\x76\xce\x96\x98\x14\x47\x6e\x35\xa8\x7e\xe5\x1a\x3a\x01\xc9\xf5\x2e\x24\x5a\xed\xc8\x2d\x91\xfc\xf8\xa7\x46\x3f\xcd\x33\x48\xfc\x2b\x67\x12\x15\x30\x0d\x6b\x04\xa2\xa1\x05\x3a\x9b\x5c\x40\x49\xab\x2d\xd3\xbb\x7c\xbd\xa4\xc2\xbf\xad\x2e\x18\xa7\xf9\x9a\x68\x21\x57\x25\xea\x6a\x9d\x8a\xf5\x6a\x4f\xcc\x97\xb8\xca\xee\xb7\xde\x42\xf1\x9f\xe5\x56\x5c\x7c\xf9\xf0\x7e\x44\xee\xdc\x17\x3f\x98\xb9\x86\xb4\xbc\x30\x6f\xc3\xf9\x62\x1c\x88\x4f\x74\xb2\xd1\x28\x41\xef\xb0\xec\x73\x63\x0f\xb2\xb0\xfe\xaf\x71\x9c\xa2\x8f\x7b\xf2\x77\x58\x34\x8e\xf7\x79\xd3\xd6\xf0\x4a\x0c\x80\x29\x7e\xa9\x41\xa1\x9e\x43\xae\xb0\x6d\xb7\x9c\x5c\xc0\xf7\x1d\x53\xc0\x94\x65\xbe\xca\x33\x23\x11\x8c\x6f\x41\x61\x46\x4c\xce\xe0\xd7\xaf\x9f\x4b\x51\xfa\xe3\xdb\x17\x67\x57\xc1\xbb\x5f\xca\x29\x97\xc6\x35\xa1\xf7\x3f\x88\x4c\x16\x54\xec\x33\xa2\xd9\x3a\x45\xf8\x41\x9e\xdc\x26\x68\xf7\x17\x1b\x50\x59\xca\xf4\x74\x06\x84\x27\x4e\x00\x66\xb0\x43\x89\x26\x84\x35\x52\x62\xac\xbe\xa3\x94\xc4\x28\xdf\xa5\x32\xb9\x4c\x98\x66\xc2\xec\x26\x32\x53\x46\x21\x61\x7a\xf9\xe9\x72\x06\x94\x70\x2e\x0c\xb9\x27\x17\x06\x3c\x81\x1f\x4c\xef\x20\x65\x4a\xab\xa5\x3f\x07\x06\x13\x73\x53\x04\x62\xff\x8e\x52\xff\x45\xa5\x2f\x91\x33\x33\x23\x46\x11\x7c\xea\xb7\x35\x82\x35\x02\xc8\x48\xef\xdf\x01\x00\x00\xff\xff\x3e\x30\x75\x27\x7d\x20\x00\x00"), }, "/terraform-modules/bootkube/conditional.tf": &vfsgen۰CompressedFileInfo{ name: "conditional.tf", diff --git a/test/components/coredns/coredns_test.go b/test/components/coredns/coredns_test.go deleted file mode 100644 index d5f541a03..000000000 --- a/test/components/coredns/coredns_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2020 The Lokomotive Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build aws aws_edge packet -// +build e2e - -package coredns - -import ( - "testing" - - testutil "github.com/kinvolk/lokomotive/test/components/util" -) - -func TestCoreDNSDaemonSet(t *testing.T) { - t.Parallel() - - namespace := "kube-system" - daemonset := "coredns" - - client := testutil.CreateKubeClient(t) - - testutil.WaitForDaemonSet(t, client, namespace, daemonset, testutil.RetryInterval, testutil.Timeout) -} diff --git a/test/components/kubernetes/controller-manager_test.go b/test/components/kubernetes/controller-manager_test.go deleted file mode 100644 index ff2267ec9..000000000 --- a/test/components/kubernetes/controller-manager_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2020 The Lokomotive Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build aws aws_edge packet -// +build e2e - -package kubernetes - -import ( - "testing" - - testutil "github.com/kinvolk/lokomotive/test/components/util" -) - -func TestControllerManagerDaemonSet(t *testing.T) { - t.Parallel() - - namespace := "kube-system" - daemonset := "kube-controller-manager" - - client := testutil.CreateKubeClient(t) - - testutil.WaitForDaemonSet(t, client, namespace, daemonset, testutil.RetryInterval, testutil.Timeout) -} diff --git a/test/components/kubernetes/controlplane-multi-node_test.go b/test/components/kubernetes/controlplane-multi-node_test.go new file mode 100644 index 000000000..25270454e --- /dev/null +++ b/test/components/kubernetes/controlplane-multi-node_test.go @@ -0,0 +1,73 @@ +// Copyright 2020 The Lokomotive Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build aws aws_edge +// +build disruptivee2e + +package kubernetes_test + +import ( + "context" + "testing" + "time" + + testutil "github.com/kinvolk/lokomotive/test/components/util" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func Test_Controlplane_components_are_DaemonSets_on_multi_controller_node_cluster(t *testing.T) { + client := testutil.CreateKubeClient(t) + + for c := range components() { + c := c + + t.Run(c, func(t *testing.T) { + t.Parallel() + + testutil.WaitForDaemonSet(t, client, namespace, c, testutil.RetryInterval, testutil.Timeout) + }) + } +} + +func Test_Controlplane_components_DaemonSets_can_be_gracefully_updated(t *testing.T) { + client := testutil.CreateKubeClient(t) + deployClient := client.AppsV1().DaemonSets(namespace) + + components := components() + components["kube-proxy"] = testutil.RetryInterval + + for c, waitTime := range components { + c := c + waitTime := waitTime + + t.Run(c, func(t *testing.T) { + deploy, err := deployClient.Get(context.TODO(), c, metav1.GetOptions{}) + if err != nil { + t.Fatalf("Getting DaemonSet %q: %v", c, err) + } + + // Use current time to have different value on each test run. + deploy.Spec.Template.Annotations["update-test"] = time.Now().String() + + if _, err := deployClient.Update(context.TODO(), deploy, metav1.UpdateOptions{}); err != nil { + t.Fatalf("Updating DaemonSet %q: %v", c, err) + } + + // Wait a bit to let Kubernetes trigger pod updates. + time.Sleep(waitTime) + + testutil.WaitForDaemonSet(t, client, namespace, c, testutil.RetryInterval, testutil.Timeout) + }) + } +} diff --git a/test/components/kubernetes/controlplane-single-node_test.go b/test/components/kubernetes/controlplane-single-node_test.go new file mode 100644 index 000000000..f7b9f7e5f --- /dev/null +++ b/test/components/kubernetes/controlplane-single-node_test.go @@ -0,0 +1,71 @@ +// Copyright 2020 The Lokomotive Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build packet baremetal +// +build disruptivee2e + +package kubernetes_test + +import ( + "context" + "testing" + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + testutil "github.com/kinvolk/lokomotive/test/components/util" +) + +func Test_Controlplane_components_are_Deployments_on_single_controller_node_cluster(t *testing.T) { + client := testutil.CreateKubeClient(t) + + for c := range components() { + c := c + + t.Run(c, func(t *testing.T) { + t.Parallel() + + testutil.WaitForDeployment(t, client, namespace, c, testutil.RetryInterval, testutil.Timeout) + }) + } +} + +func Test_Controlplane_components_Deployments_can_be_gracefully_updated(t *testing.T) { + client := testutil.CreateKubeClient(t) + deployClient := client.AppsV1().Deployments(namespace) + + for c, waitTime := range components() { + c := c + waitTime := waitTime + + t.Run(c, func(t *testing.T) { + deploy, err := deployClient.Get(context.TODO(), c, metav1.GetOptions{}) + if err != nil { + t.Fatalf("Getting Deployment %q: %v", c, err) + } + + // Use current time to have different value on each test run. + deploy.Spec.Template.Annotations["update-test"] = time.Now().String() + + if _, err := deployClient.Update(context.TODO(), deploy, metav1.UpdateOptions{}); err != nil { + t.Fatalf("Updating Deployment %q: %v", c, err) + } + + // Wait a bit to let Kubernetes trigger pod updates. + time.Sleep(waitTime) + + testutil.WaitForDeployment(t, client, namespace, c, testutil.RetryInterval, testutil.Timeout) + }) + } +} diff --git a/test/components/kubernetes/controlplane_test.go b/test/components/kubernetes/controlplane_test.go new file mode 100644 index 000000000..f4b10873c --- /dev/null +++ b/test/components/kubernetes/controlplane_test.go @@ -0,0 +1,22 @@ +package kubernetes_test + +import ( + "time" + + testutil "github.com/kinvolk/lokomotive/test/components/util" +) + +const ( + namespace = "kube-system" +) + +func components() map[string]time.Duration { + return map[string]time.Duration{ + // If we kill active kube-controller-manager, it takes time for new one to kick in + // so we need to wait longer. + "kube-controller-manager": 1 * time.Minute, + "kube-scheduler": testutil.RetryInterval, + "kube-apiserver": testutil.RetryInterval, + "coredns": testutil.RetryInterval, + } +}