Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): disable bootstrap app test #2276

Merged
merged 1 commit into from
May 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
147 changes: 72 additions & 75 deletions test/e2e_installer/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ package cluster_test

import (
"context"
"fmt"
"os"
"time"

"k8s.io/klog"
v1 "tkestack.io/tke/api/application/v1"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
Expand Down Expand Up @@ -155,85 +150,87 @@ var _ = Describe("cluster", func() {
Expect(cls.Spec.Machines).Should(HaveLen(1), "Cluster node num is wrong")
})

It("Cluster bootstrap application", func() {
zhangzhangzf marked this conversation as resolved.
Show resolved Hide resolved
nodes, err := provider.CreateInstances(1)
Expect(err).Should(BeNil(), "Create instances failed")

cls = testTKE.ClusterTemplate(nodes[0])
cls.Spec.BootstrapApps = []platformv1.BootstrapApp{
{
App: platformv1.App{
ObjectMeta: metav1.ObjectMeta{
Namespace: "kube-system",
},
Spec: v1.AppSpec{
Type: "HelmV3",
TenantID: "default",
Name: "demo1",
TargetCluster: "",
TargetNamespace: "",
Chart: v1.Chart{
ChartName: "tke-resilience",
ChartGroupName: "public",
ChartVersion: "1.0.0",
TenantID: "default",
/*
It("Cluster bootstrap application", func() {
nodes, err := provider.CreateInstances(1)
Expect(err).Should(BeNil(), "Create instances failed")

cls = testTKE.ClusterTemplate(nodes[0])
cls.Spec.BootstrapApps = []platformv1.BootstrapApp{
{
App: platformv1.App{
ObjectMeta: metav1.ObjectMeta{
Namespace: "kube-system",
},
Values: v1.AppValues{
RawValues: "key2: val2-override",
Spec: v1.AppSpec{
Type: "HelmV3",
TenantID: "default",
Name: "demo1",
TargetCluster: "",
TargetNamespace: "",
Chart: v1.Chart{
ChartName: "tke-resilience",
ChartGroupName: "public",
ChartVersion: "1.0.0",
TenantID: "default",
},
Values: v1.AppValues{
RawValues: "key2: val2-override",
},
},
},
},
},
{
App: platformv1.App{
ObjectMeta: metav1.ObjectMeta{
Namespace: "kube-public",
},
Spec: v1.AppSpec{
Name: "demo2",
Type: "HelmV3",
TenantID: "default",
TargetCluster: "",
TargetNamespace: "kube-public",
Chart: v1.Chart{
ChartName: "tke-resilience",
ChartGroupName: "public",
ChartVersion: "1.0.0",
TenantID: "default",
{
App: platformv1.App{
ObjectMeta: metav1.ObjectMeta{
Namespace: "kube-public",
},
Values: v1.AppValues{
RawValues: "key2: val2-override",
Spec: v1.AppSpec{
Name: "demo2",
Type: "HelmV3",
TenantID: "default",
TargetCluster: "",
TargetNamespace: "kube-public",
Chart: v1.Chart{
ChartName: "tke-resilience",
ChartGroupName: "public",
ChartVersion: "1.0.0",
TenantID: "default",
},
Values: v1.AppValues{
RawValues: "key2: val2-override",
},
},
},
},
},
}
cls, err = testTKE.CreateClusterInternal(cls)
Expect(err).To(BeNil(), "Create cluster failed")

By("验证bootstrap app已创建")
verifyApp := func(namespace, appName string) error {
apps, err := testTKE.TkeClient.ApplicationV1().Apps(namespace).List(context.Background(), metav1.ListOptions{})
if err != nil {
return fmt.Errorf("list apps in namespace %v failed", namespace)
}
klog.Infof("Apps in %v: %v", namespace, len(apps.Items))
for _, app := range apps.Items {
klog.Info(app.Name)
}
appFullName := fmt.Sprintf("bootstrapapp-%v-%v", namespace, appName)
_, err = testTKE.TkeClient.ApplicationV1().Apps(namespace).Get(context.Background(), appFullName, metav1.GetOptions{})
if err != nil {
err = fmt.Errorf("get app %v failed", appFullName)
}
return err
}
Eventually(func() error {
err = verifyApp("kube-system", "demo1")
if err != nil {
cls, err = testTKE.CreateClusterInternal(cls)
Expect(err).To(BeNil(), "Create cluster failed")

By("验证bootstrap app已创建")
verifyApp := func(namespace, appName string) error {
apps, err := testTKE.TkeClient.ApplicationV1().Apps(namespace).List(context.Background(), metav1.ListOptions{})
if err != nil {
return fmt.Errorf("list apps in namespace %v failed", namespace)
}
klog.Infof("Apps in %v: %v", namespace, len(apps.Items))
for _, app := range apps.Items {
klog.Info(app.Name)
}
appFullName := fmt.Sprintf("bootstrapapp-%v-%v", namespace, appName)
_, err = testTKE.TkeClient.ApplicationV1().Apps(namespace).Get(context.Background(), appFullName, metav1.GetOptions{})
if err != nil {
err = fmt.Errorf("get app %v failed", appFullName)
}
return err
}
return verifyApp("kube-public", "demo2")
}, time.Minute, time.Second).Should(BeNil())
})
Eventually(func() error {
err = verifyApp("kube-system", "demo1")
if err != nil {
return err
}
return verifyApp("kube-public", "demo2")
}, time.Minute, time.Second).Should(BeNil())
})
*/
})