mirror of https://github.com/k3s-io/k3s
add --disable-cloud-controller and --disable-kube-proxy test (#8018)
Signed-off-by: Ian Cardoso <osodracnai@gmail.com>pull/8147/head
parent
e551308db8
commit
53fc3eef0a
|
@ -33,7 +33,7 @@ var _ = BeforeSuite(func() {
|
|||
|
||||
var _ = Describe("create a new cluster with kube-* flags", Ordered, func() {
|
||||
BeforeEach(func() {
|
||||
if testutil.IsExistingServer() && !testutil.ServerArgsPresent(serverArgs) {
|
||||
if testutil.IsExistingServer() {
|
||||
Skip("Test needs k3s server with: " + strings.Join(serverArgs, " "))
|
||||
}
|
||||
})
|
||||
|
@ -108,9 +108,92 @@ var _ = Describe("create a new cluster with kube-* flags", Ordered, func() {
|
|||
return nil
|
||||
}
|
||||
return errors.New("error finding kube-proxy")
|
||||
}, "120s", "15s").Should(Succeed())
|
||||
}, "300s", "15s").Should(Succeed())
|
||||
})
|
||||
When("server is setup without kube-proxy or cloud-controller-manager ", func() {
|
||||
It("kills previous server and clean logs", func() {
|
||||
Expect(testutil.K3sKillServer(server)).To(Succeed())
|
||||
})
|
||||
It("start up with disabled kube-proxy and cloud controller", func() {
|
||||
var err error
|
||||
localServerArgs := []string{
|
||||
"--cluster-init",
|
||||
"--disable-cloud-controller=true",
|
||||
"--disable-kube-proxy=true",
|
||||
}
|
||||
server, err = testutil.K3sStartServer(localServerArgs...)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Pods should not be healthy without kube-proxy
|
||||
Consistently(func() error {
|
||||
return testutil.K3sDefaultDeployments()
|
||||
}, "100s", "5s").Should(HaveOccurred())
|
||||
})
|
||||
It("should not find kube-proxy starting", func() {
|
||||
Consistently(func() error {
|
||||
match, err := testutil.SearchK3sLog(server, "Running kube-proxy")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !match {
|
||||
return nil
|
||||
}
|
||||
return errors.New("found kube-proxy starting")
|
||||
}, "100s", "5s").Should(Succeed())
|
||||
})
|
||||
/* The flag --disable-cloud-controller doesn't stop ccm from running,
|
||||
it appends -cloud-node and -cloud-node-lifecycle to the end of the --controllers flag
|
||||
https://github.com/k3s-io/k3s/blob/master/docs/adrs/servicelb-ccm.md
|
||||
*/
|
||||
It("should find cloud-controller-manager starting with"+
|
||||
"\"--cloud-node,--cloud-node-lifecycle,--secure-port=0\" flags ", func() {
|
||||
Eventually(func() error {
|
||||
match, err := testutil.SearchK3sLog(server, "Running cloud-controller-manager --allocate-node-cidrs=true"+
|
||||
" --authentication-kubeconfig=/var/lib/rancher/k3s/server/cred/cloud-controller.kubeconfig"+
|
||||
" --authorization-kubeconfig=/var/lib/rancher/k3s/server/cred/cloud-controller.kubeconfig --bind-address=127.0.0.1 "+
|
||||
"--cloud-config=/var/lib/rancher/k3s/server/etc/cloud-config.yaml --cloud-provider=k3s --cluster-cidr=10.42.0.0/16 "+
|
||||
"--configure-cloud-routes=false --controllers=*,-route,-cloud-node,-cloud-node-lifecycle --kubeconfig=/var/lib/rancher/k3s/server/cred/cloud-controller.kubeconfig "+
|
||||
"--leader-elect-resource-name=k3s-cloud-controller-manager --node-status-update-frequency=1m0s --profiling=false --secure-port=0")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if match {
|
||||
return nil
|
||||
}
|
||||
return errors.New("found cloud-controller-manager starting with wrong flags")
|
||||
}, "30s", "2s").Should(Succeed())
|
||||
})
|
||||
It("kills previous server and clean logs", func() {
|
||||
Expect(testutil.K3sKillServer(server)).To(Succeed())
|
||||
})
|
||||
It("start up with no problems and fully disabled cloud controller", func() {
|
||||
var err error
|
||||
localServerArgs := []string{
|
||||
"--cluster-init",
|
||||
"--disable-cloud-controller=true",
|
||||
"--disable=servicelb",
|
||||
}
|
||||
server, err = testutil.K3sStartServer(localServerArgs...)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Eventually(func() error {
|
||||
return testutil.K3sDefaultDeployments()
|
||||
}, "180s", "5s").Should(Succeed())
|
||||
|
||||
})
|
||||
It("should not find cloud-controller-manager starting", func() {
|
||||
Consistently(func() error {
|
||||
match, err := testutil.SearchK3sLog(server, "Running cloud-controller-manager")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !match {
|
||||
return nil
|
||||
}
|
||||
return errors.New("found cloud-controller-manager starting")
|
||||
}, "100s", "5s").Should(Succeed())
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue