diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 356c0da15..004a47be6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,12 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + - name: turn off swap + run: sudo swapoff -a + + - name: Set netfilter conntrack max + run: sudo sysctl -w net.netfilter.nf_conntrack_max=131072 + - name: Set up Go uses: actions/setup-go@v2 with: diff --git a/Makefile b/Makefile index 8bc7ac61f..ce4ab3b4b 100644 --- a/Makefile +++ b/Makefile @@ -56,21 +56,6 @@ all: build HOST_AGENT_DIR ?= agent -# Run tests -test: generate fmt vet manifests test-coverage - -test-coverage: - source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; ginkgo --randomizeAllSpecs -r --cover --coverprofile=cover.out --outputdir=. --skipPackage=test . - -agent-test: - source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; ginkgo --randomizeAllSpecs -r $(HOST_AGENT_DIR) -coverprofile cover.out - -controller-test: - source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; ginkgo --randomizeAllSpecs controllers/infrastructure -coverprofile cover.out - -webhook-test: - source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; ginkgo apis/infrastructure/v1beta1 -coverprofile cover.out - ##@ General # The help target prints out all targets with their descriptions organized @@ -127,6 +112,22 @@ prepare-byoh-docker-host-image: prepare-byoh-docker-host-image-dev: docker build test/e2e -f docs/BYOHDockerFileDev -t ${BYOH_BASE_IMG_DEV} + +# Run tests +test: generate fmt vet manifests test-coverage + +test-coverage: prepare-byoh-docker-host-image + source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; ginkgo --randomizeAllSpecs -r --cover --coverprofile=cover.out --outputdir=. --skipPackage=test . + +agent-test: prepare-byoh-docker-host-image + source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; ginkgo --randomizeAllSpecs -r $(HOST_AGENT_DIR) -coverprofile cover.out + +controller-test: + source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; ginkgo --randomizeAllSpecs controllers/infrastructure -coverprofile cover.out + +webhook-test: + source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; ginkgo apis/infrastructure/v1beta1 -coverprofile cover.out + test-e2e: take-user-input docker-build prepare-byoh-docker-host-image $(GINKGO) cluster-templates-e2e ## Run the end-to-end tests $(GINKGO) -v -trace -tags=e2e -focus="$(GINKGO_FOCUS)" $(_SKIP_ARGS) -nodes=$(GINKGO_NODES) --noColor=$(GINKGO_NOCOLOR) $(GINKGO_ARGS) test/e2e -- \ -e2e.artifacts-folder="$(ARTIFACTS)" \ diff --git a/agent/host_agent_suite_test.go b/agent/host_agent_suite_test.go index ebb24b96c..78e853682 100644 --- a/agent/host_agent_suite_test.go +++ b/agent/host_agent_suite_test.go @@ -5,6 +5,7 @@ package main import ( + "context" "go/build" "io/ioutil" "os" @@ -12,10 +13,14 @@ import ( "testing" "time" + dockertypes "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" + dClient "github.com/docker/docker/client" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" infrastructurev1beta1 "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/apis/infrastructure/v1beta1" + "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/test/e2e" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -30,7 +35,19 @@ var ( kubeconfigFile *os.File k8sClient client.Client tmpFilePrefix = "kubeconfigFile-" + defaultByoMachineName = "my-byomachine" + agentLogFile = "/tmp/agent-integration.log" + fakeKubeConfig = "fake-kubeconfig-path" + fakeDownloadPath = "fake-download-path" + fakeBootstrapSecret = "fake-bootstrap-secret" testEnv *envtest.Environment + dockerClient *dClient.Client +) + +const ( + bundleLookupBaseRegistry = "projects.registry.vmware.com/cluster_api_provider_bringyourownhost" + BundleLookupTag = "v0.1.0_alpha.2" + K8sVersion = "v1.22.3" ) func TestHostAgent(t *testing.T) { @@ -52,6 +69,7 @@ var _ = BeforeSuite(func() { CRDDirectoryPaths: []string{ filepath.Join("..", "config", "crd", "bases"), filepath.Join(build.Default.GOPATH, "pkg", "mod", "sigs.k8s.io", "cluster-api@v1.0.4", "config", "crd", "bases"), + filepath.Join(build.Default.GOPATH, "pkg", "mod", "sigs.k8s.io", "cluster-api@v1.0.4", "bootstrap", "kubeadm", "config", "crd", "bases"), }, ErrorIfCRDPathMissing: true, @@ -74,10 +92,14 @@ var _ = BeforeSuite(func() { k8sClient, err = client.New(cfg, client.Options{Scheme: scheme}) Expect(err).NotTo(HaveOccurred()) - writeKubeConfig() + + dockerClient, err = dClient.NewClientWithOpts(dClient.FromEnv) + Expect(err).NotTo(HaveOccurred()) pathToHostAgentBinary, err = gexec.Build("github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent") Expect(err).NotTo(HaveOccurred()) + + writeKubeConfig() }) var _ = AfterSuite(func() { @@ -110,3 +132,42 @@ func writeKubeConfig() { _, err = getKubeConfig().Write(kubeConfigData) Expect(err).NotTo(HaveOccurred()) } + +func setupTestInfra(ctx context.Context, hostname, kubeconfig string, namespace *corev1.Namespace) *e2e.ByoHostRunner { + byohostRunner := e2e.ByoHostRunner{ + Context: ctx, + Namespace: namespace.Name, + PathToHostAgentBinary: pathToHostAgentBinary, + DockerClient: dockerClient, + NetworkInterface: "host", + ByoHostName: hostname, + Port: testEnv.ControlPlane.APIServer.Port, + CommandArgs: map[string]string{ + "--kubeconfig": "/mgmt.conf", + "--namespace": namespace.Name, + "-v": "1", + }, + KubeconfigFile: kubeconfig, + } + + return &byohostRunner +} + +func cleanup(ctx context.Context, byoHostContainer *container.ContainerCreateCreatedBody, namespace *corev1.Namespace, agentLogFile string) { + err := dockerClient.ContainerStop(ctx, byoHostContainer.ID, nil) + Expect(err).NotTo(HaveOccurred()) + + err = dockerClient.ContainerRemove(ctx, byoHostContainer.ID, dockertypes.ContainerRemoveOptions{}) + Expect(err).NotTo(HaveOccurred()) + + err = k8sClient.Delete(ctx, namespace) + Expect(err).NotTo(HaveOccurred(), "failed to delete test namespace") + + _, err = os.Stat(agentLogFile) + if err == nil { + err = os.Remove(agentLogFile) + if err != nil { + e2e.Showf("error removing log file %s: %v", agentLogFile, err) + } + } +} diff --git a/agent/host_agent_test.go b/agent/host_agent_test.go index f96dc497b..cf722ebf9 100644 --- a/agent/host_agent_test.go +++ b/agent/host_agent_test.go @@ -7,24 +7,27 @@ package main import ( "context" "fmt" - "io/ioutil" "net" "os" "os/exec" "runtime" + "strings" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - + dockertypes "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "github.com/jackpal/gateway" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/onsi/gomega/gbytes" "github.com/onsi/gomega/gexec" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/version" infrastructurev1beta1 "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/apis/infrastructure/v1beta1" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/test/builder" + "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/test/e2e" corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/cluster-api/util/conditions" + "sigs.k8s.io/cluster-api/util/patch" ) var _ = Describe("Agent", func() { @@ -32,25 +35,29 @@ var _ = Describe("Agent", func() { Context("When the host is unable to register with the API server", func() { var ( ns *corev1.Namespace + ctx context.Context err error hostName string - fakedKubeConfig = "fake-kubeconfig-path" - fakeDownloadPath = "fake-download-path" - session *gexec.Session + runner *e2e.ByoHostRunner + byoHostContainer *container.ContainerCreateCreatedBody ) BeforeEach(func() { ns = builder.Namespace("testns").Build() + ctx = context.TODO() Expect(k8sClient.Create(context.TODO(), ns)).NotTo(HaveOccurred(), "failed to create test namespace") hostName, err = os.Hostname() Expect(err).NotTo(HaveOccurred()) + runner = setupTestInfra(ctx, hostName, getKubeConfig().Name(), ns) + + byoHostContainer, err = runner.SetupByoDockerHost() + Expect(err).NotTo(HaveOccurred()) + }) AfterEach(func() { - err = k8sClient.Delete(context.TODO(), ns) - Expect(err).NotTo(HaveOccurred(), "failed to delete test namespace") - session.Terminate().Wait() + cleanup(runner.Context, byoHostContainer, ns, agentLogFile) }) It("should not error out if the host already exists", func() { @@ -70,17 +77,54 @@ var _ = Describe("Agent", func() { } Expect(k8sClient.Create(context.TODO(), byoHost)).NotTo(HaveOccurred()) - command := exec.Command(pathToHostAgentBinary, "--kubeconfig", kubeconfigFile.Name(), "--namespace", ns.Name, "--downloadpath", fakeDownloadPath) - session, err = gexec.Start(command, GinkgoWriter, GinkgoWriter) + runner.CommandArgs["--downloadpath"] = fakeDownloadPath + output, _, err := runner.ExecByoDockerHost(byoHostContainer) Expect(err).NotTo(HaveOccurred()) - Consistently(session).ShouldNot(gexec.Exit(0)) + + defer output.Close() + f := e2e.WriteDockerLog(output, agentLogFile) + defer func() { + deferredErr := f.Close() + if deferredErr != nil { + e2e.Showf("error closing file %s: %v", agentLogFile, deferredErr) + } + }() + Consistently(func() (done bool) { + _, err := os.Stat(agentLogFile) + if err == nil { + data, err := os.ReadFile(agentLogFile) + if err == nil && strings.Contains(string(data), "\"msg\"=\"error\"") { + return true + } + } + return false + }).Should(BeFalse()) }) It("should return an error when invalid kubeconfig is passed in", func() { - command := exec.Command(pathToHostAgentBinary, "--kubeconfig", fakedKubeConfig) - session, err = gexec.Start(command, GinkgoWriter, GinkgoWriter) + + runner.CommandArgs["--kubeconfig"] = fakeKubeConfig + output, _, err := runner.ExecByoDockerHost(byoHostContainer) Expect(err).NotTo(HaveOccurred()) - Eventually(session).Should(gexec.Exit(0)) + defer output.Close() + + f := e2e.WriteDockerLog(output, agentLogFile) + defer func() { + deferredErr := f.Close() + if deferredErr != nil { + e2e.Showf("error closing file %s: %v", agentLogFile, deferredErr) + } + }() + Eventually(func() (done bool) { + _, err := os.Stat(agentLogFile) + if err == nil { + data, err := os.ReadFile(agentLogFile) + if err == nil && strings.Contains(string(data), "\"msg\"=\"error getting kubeconfig\"") { + return true + } + } + return false + }).Should(BeTrue()) }) }) @@ -88,35 +132,35 @@ var _ = Describe("Agent", func() { var ( ns *corev1.Namespace - session *gexec.Session - err error - workDir string + ctx context.Context hostName string fakeDownloadPath = "fake-download-path" + runner *e2e.ByoHostRunner + byoHostContainer *container.ContainerCreateCreatedBody + output dockertypes.HijackedResponse ) BeforeEach(func() { ns = builder.Namespace("testns").Build() Expect(k8sClient.Create(context.TODO(), ns)).NotTo(HaveOccurred(), "failed to create test namespace") - + ctx = context.TODO() + var err error hostName, err = os.Hostname() Expect(err).NotTo(HaveOccurred()) - command := exec.Command(pathToHostAgentBinary, "--kubeconfig", kubeconfigFile.Name(), "--namespace", ns.Name, "--label", "site=apac", "--downloadpath", fakeDownloadPath) + runner = setupTestInfra(ctx, hostName, getKubeConfig().Name(), ns) + runner.CommandArgs["--label"] = "site=apac" + runner.CommandArgs["--downloadpath"] = fakeDownloadPath - session, err = gexec.Start(command, GinkgoWriter, GinkgoWriter) + byoHostContainer, err = runner.SetupByoDockerHost() Expect(err).NotTo(HaveOccurred()) - workDir, err = ioutil.TempDir("", "host-agent-ut") + output, _, err = runner.ExecByoDockerHost(byoHostContainer) Expect(err).NotTo(HaveOccurred()) }) AfterEach(func() { - err = k8sClient.Delete(context.TODO(), ns) - Expect(err).NotTo(HaveOccurred()) - err = os.RemoveAll(workDir) - Expect(err).NotTo(HaveOccurred()) - session.Terminate().Wait() + cleanup(runner.Context, byoHostContainer, ns, agentLogFile) }) It("should register the BYOHost with the management cluster", func() { @@ -189,7 +233,88 @@ var _ = Describe("Agent", func() { byoHost := builder.ByoHost(ns.Name, "random-second-host").Build() Expect(k8sClient.Create(context.TODO(), byoHost)).NotTo(HaveOccurred(), "failed to create byohost") - Consistently(session.Err, "10s").ShouldNot(gbytes.Say(byoHost.Name)) + defer output.Close() + + f := e2e.WriteDockerLog(output, agentLogFile) + defer func() { + deferredErr := f.Close() + if deferredErr != nil { + e2e.Showf("error closing file %s: %v", agentLogFile, deferredErr) + } + }() + Consistently(func() (done bool) { + _, err := os.Stat(agentLogFile) + if err == nil { + data, err := os.ReadFile(agentLogFile) + if err == nil && strings.Contains(string(data), byoHost.Name) { + return true + } + } + return false + }, 10, 1).ShouldNot(BeTrue()) + }) + Context("when machineref & bootstrap secret is assigned", func() { + var ( + byoMachine *infrastructurev1beta1.ByoMachine + namespace types.NamespacedName + ) + BeforeEach(func() { + byoMachine = builder.ByoMachine(ns.Name, defaultByoMachineName).Build() + Expect(k8sClient.Create(ctx, byoMachine)).Should(Succeed()) + byoHost := &infrastructurev1beta1.ByoHost{} + namespace = types.NamespacedName{Name: hostName, Namespace: ns.Name} + Eventually(func() (err error) { + err = k8sClient.Get(ctx, namespace, byoHost) + return err + }).Should(BeNil()) + + patchHelper, _ := patch.NewHelper(byoHost, k8sClient) + byoHost.Status.MachineRef = &corev1.ObjectReference{ + APIVersion: byoMachine.APIVersion, + Kind: byoMachine.Kind, + Namespace: byoMachine.Namespace, + Name: byoMachine.Name, + UID: byoMachine.UID, + } + byoHost.Annotations = map[string]string{} + byoHost.Annotations[infrastructurev1beta1.K8sVersionAnnotation] = K8sVersion + byoHost.Annotations[infrastructurev1beta1.BundleLookupBaseRegistryAnnotation] = bundleLookupBaseRegistry + byoHost.Annotations[infrastructurev1beta1.BundleLookupTagAnnotation] = BundleLookupTag + + fakeBootstrapSecret := builder.Secret(ns.Name, fakeBootstrapSecret).Build() + err := k8sClient.Create(ctx, fakeBootstrapSecret) + Expect(err).ToNot(HaveOccurred()) + byoHost.Spec.BootstrapSecret = &corev1.ObjectReference{ + Kind: "Secret", + Namespace: byoMachine.Namespace, + Name: fakeBootstrapSecret.Name, + } + + Expect(patchHelper.Patch(ctx, byoHost, patch.WithStatusObservedGeneration{})).NotTo(HaveOccurred()) + }) + + It("should install k8s components", func() { + + defer output.Close() + f := e2e.WriteDockerLog(output, agentLogFile) + defer func() { + deferredErr := f.Close() + if deferredErr != nil { + e2e.Showf("error closing file %s: %v", agentLogFile, deferredErr) + } + }() + updatedByoHost := &infrastructurev1beta1.ByoHost{} + Eventually(func() (condition corev1.ConditionStatus) { + err := k8sClient.Get(ctx, namespace, updatedByoHost) + if err == nil { + kubeInstallStatus := conditions.Get(updatedByoHost, infrastructurev1beta1.K8sComponentsInstallationSucceeded) + if kubeInstallStatus != nil { + return kubeInstallStatus.Status + } + } + return corev1.ConditionFalse + }, 60).Should(Equal(corev1.ConditionTrue)) + }) }) }) @@ -231,4 +356,61 @@ var _ = Describe("Agent", func() { Expect(output).Should(Equal(expected)) }) }) + + Context("When the host agent is executed with --skip-installation flag", func() { + var ( + ns *corev1.Namespace + ctx context.Context + err error + hostName string + agentLogFile = "/tmp/agent-integration.log" + fakeDownloadPath = "fake-download-path" + runner *e2e.ByoHostRunner + byoHostContainer *container.ContainerCreateCreatedBody + ) + + BeforeEach(func() { + ns = builder.Namespace("testns").Build() + ctx = context.TODO() + Expect(k8sClient.Create(context.TODO(), ns)).NotTo(HaveOccurred(), "failed to create test namespace") + + hostName, err = os.Hostname() + Expect(err).NotTo(HaveOccurred()) + runner = setupTestInfra(ctx, hostName, getKubeConfig().Name(), ns) + + byoHostContainer, err = runner.SetupByoDockerHost() + Expect(err).NotTo(HaveOccurred()) + + }) + + AfterEach(func() { + cleanup(runner.Context, byoHostContainer, ns, agentLogFile) + }) + + It("should skip installation of k8s components", func() { + runner.CommandArgs["--downloadpath"] = fakeDownloadPath + runner.CommandArgs["--skip-installation"] = "" + output, _, err := runner.ExecByoDockerHost(byoHostContainer) + Expect(err).NotTo(HaveOccurred()) + + defer output.Close() + f := e2e.WriteDockerLog(output, agentLogFile) + defer func() { + deferredErr := f.Close() + if deferredErr != nil { + e2e.Showf("error closing file %s: %v", agentLogFile, deferredErr) + } + }() + Eventually(func() (done bool) { + _, err := os.Stat(agentLogFile) + if err == nil { + data, err := os.ReadFile(agentLogFile) + if err == nil && strings.Contains(string(data), "\"msg\"=\"skip-installation flag set, skipping installer initialisation\"") { + return true + } + } + return false + }, 30).Should(BeTrue()) + }) + }) }) diff --git a/docs/troubleshooting_guide.md b/docs/troubleshooting_guide.md new file mode 100644 index 000000000..ff5e918eb --- /dev/null +++ b/docs/troubleshooting_guide.md @@ -0,0 +1,111 @@ +# Troubleshooting Tips for Kubernetes Cluster API Provider Bring Your Own Host (BYOH) +This section includes tips to help you to troubleshoot common problems that you might encounter when installing Kubernetes Cluster API Provider BYOH. + +## Failed installation, pre-requisite not installed on the host: socat +### Probem +Trying to install BYOH successfully detects OS but fails on pre-requisite package precheck for the package socat. +``` +I0307 05:49:30.561917 13907 installer.go:104] "msg"="Detected" "OS"="Ubuntu_20.04.2_x86-64" +E0307 05:49:30.562132 13907 checks.go:38] "msg"="Failed pre-requisite packages precheck" "error"="required package(s): [socat] not found" +E0307 05:49:30.562195 13907 cli-dev.go:141] "msg"="unable to create installer" "error"="precheck failed" +``` +### Solution +To solve the problem the package socat needs to be installed on the host. +Example for ubuntu with apt-get: +``` +sudo apt-get install socat +``` + +## Failed installation, pre-requisite not installed on the host: ethtool +### Probem +Trying to install BYOH successfully detects OS but fails on pre-requisite pagackage precheck for the package ethtool. +``` +I0307 05:49:30.561917 13907 installer.go:104] "msg"="Detected" "OS"="Ubuntu_20.04.2_x86-64" +E0307 05:49:30.562132 13907 checks.go:38] "msg"="Failed pre-requisite packages precheck" "error"="required package(s): [ethtool] not found" +E0307 05:49:30.562195 13907 cli-dev.go:141] "msg"="unable to create installer" "error"="precheck failed" +``` +### Solution +To solve the problem the package ethtool needs to be installed on the host. +Example for ubuntu with apt-get: +``` +sudo apt-get install ethtool +``` + +## Failed installation, pre-requisite not installed on the host: conntrack +### Probem +Trying to install BYOH successfully detects OS but fails on pre-requisite pagackage precheck for the package conntrack. +``` +I0307 05:55:40.203851 15309 installer.go:104] "msg"="Detected" "OS"="Ubuntu_20.04.2_x86-64" +E0307 05:55:40.204188 15309 checks.go:38] "msg"="Failed pre-requisite packages precheck" "error"="required package(s): [conntrack] not found" +E0307 05:55:40.204260 15309 cli-dev.go:141] "msg"="unable to create installer" "error"="precheck failed" +``` +### Solution +To solve the problem the package conntrack needs to be installed on the host. +Example for ubuntu with apt-get: +``` +sudo apt-get install conntrack +``` + +## Failed installation, pre-requisite not installed on the host: ebtables +### Probem +Trying to install BYOH successfully detects OS but fails during installation. +``` +I0307 06:11:32.069667 16169 installer.go:244] "msg"="dpkg: dependency problems prevent configuration of kubelet:\n kubelet depends on ebtables; however:\n Package ebtables is not installed.\n\ndpkg: error processing package kubelet (--install):\n dependency problems - leaving unconfigured\nErrors were encountered while processing:\n kubelet\n" +I0307 06:11:32.069772 16169 installer.go:244] "msg"="exit status 1" +``` +### Solution +To solve the problem the package ebtables needs to be installed on the host. +Example for ubuntu with apt-get: +``` +sudo apt-get install ebtables +``` + +## Failed installation, multiple pre-requisites not installed on the host +### Problem +Trying to install BYOH successfully detects OS but fails on pre-requisite pagackage precheck for multiple packages. If there is more than one pre-requisite no installed on the host, all will be written in the brackets like in this example when socat, ethtool and conntrack are no found. +``` +I0307 05:49:30.561917 13907 installer.go:104] "msg"="Detected" "OS"="Ubuntu_20.04.2_x86-64" +E0307 05:49:30.562132 13907 checks.go:38] "msg"="Failed pre-requisite packages precheck" "error"="required package(s): [socat ethtool conntrack] not found" +E0307 05:49:30.562195 13907 cli-dev.go:141] "msg"="unable to create installer" "error"="precheck failed" +``` +### Solution +All of the missing required packages need to be installed. +Example for this case where socat, ethtool and conntrack are not installed: +``` +sudo apt-get install socat ethtool conntrack +``` + +## Error downloading bundle +### Problem +After successful pre-requisite package prechecks when the bundle is not found locally the installer will try to download it from the given repo but can fail with error `Error downloading bundle`. +``` +I0307 06:15:24.903253 19079 installer.go:104] "msg"="Detected" "OS"="Ubuntu_20.04.2_x86-64" +I0307 06:15:24.903551 19079 installer.go:175] "msg"="Current OS will be handled as" "OS"="Ubuntu_20.04.1_x86-64" +I0307 06:15:24.903807 19079 bundle_downloader.go:69] "msg"="Cache miss" "path"="projects.registry.vmware.com.cluster_api_provider_bringyourownhost/v1.22.3-v0.1.0_alpha.2" +I0307 06:15:24.904267 19079 bundle_downloader.go:95] "msg"="Downloading bundle" "from"="projects.registry.vmware.com/cluster_api_provider_bringyourownhost/byoh-bundle-ubuntu_20.04.1_x86-64_k8s_v1.22.3:v0.1.0_alpha.2" +E0307 06:15:29.452444 19079 cli-dev.go:151] "msg"="error installing/uninstalling" "error"="Error downloading bundle" +``` + +### Solution +Check your internet connection and if you can reach the repo. + +Another thing that can be attempted is to download the bundle manually using docker with the command + +`docker pull /:` + +where each element with brackets needs to be replaced with the corresponding string: +``` + - The address of the repo + - The name of the BYOH bundle + - The tag of the BYOH bundle +``` + +## Error installing/uninstalling, No k8s support for OS +### Problem +After successful pre-requisite package prechecks, the installer cannot find the BYOH bundle for the given combination of OS and K8s version. +``` +I0308 05:18:54.733467 11351 installer.go:104] "msg"="Detected" "OS"="Ubuntu_20.04.2_x86-64" +E0308 05:18:54.733622 11351 cli-dev.go:151] "msg"="error installing/uninstalling" "error"="No k8s support for OS" +``` +### Solution +Sometimes it may happen that the OS and K8s version combination used is not supported by `BYOH` out of the box. This will require manually installing all the dependencies and using the `--skip-installation` flag. This flag will skip k8s installation attempt on the host. diff --git a/go.mod b/go.mod index bdca187c7..056925490 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,9 @@ go 1.16 replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.0.4 require ( - github.com/containerd/containerd v1.5.9 // indirect + github.com/containerd/containerd v1.5.10 // indirect github.com/cppforlife/go-cli-ui v0.0.0-20200716203538-1e47f820817f - github.com/docker/cli v20.10.12+incompatible + github.com/docker/cli v20.10.13+incompatible github.com/docker/docker v20.10.12+incompatible github.com/docker/docker-credential-helpers v0.6.4 // indirect github.com/go-logr/logr v0.4.0 @@ -20,7 +20,7 @@ require ( github.com/onsi/gomega v1.18.1 github.com/opencontainers/runc v1.0.3 // indirect github.com/pkg/errors v0.9.1 - github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/pflag v1.0.5 github.com/theupdateframework/notary v0.7.0 // indirect k8s.io/api v0.22.2 k8s.io/apimachinery v0.22.2 diff --git a/go.sum b/go.sum index 92eb99135..2bc79baeb 100644 --- a/go.sum +++ b/go.sum @@ -259,8 +259,8 @@ github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09Zvgq github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= github.com/containerd/containerd v1.5.2/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= -github.com/containerd/containerd v1.5.9 h1:rs6Xg1gtIxaeyG+Smsb/0xaSDu1VgFhOCKBXxMxbsF4= -github.com/containerd/containerd v1.5.9/go.mod h1:fvQqCfadDGga5HZyn3j4+dx56qj2I9YwBrlSdalvJYQ= +github.com/containerd/containerd v1.5.10 h1:3cQ2uRVCkJVcx5VombsE7105Gl9Wrl7ORAO3+4+ogf4= +github.com/containerd/containerd v1.5.10/go.mod h1:fvQqCfadDGga5HZyn3j4+dx56qj2I9YwBrlSdalvJYQ= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -365,8 +365,8 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUn github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/cli v20.10.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/cli v20.10.12+incompatible h1:lZlz0uzG+GH+c0plStMUdF/qk3ppmgnswpR5EbqzVGA= -github.com/docker/cli v20.10.12+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v20.10.13+incompatible h1:o/STAn7e+b/pQ6keReGRoewVmAgXUkZAMQ8st4vHdKg= +github.com/docker/cli v20.10.13+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=