upgrade clusterset

Signed-off-by: Yang Le <yangle@redhat.com>
This commit is contained in:
Yang Le
2021-09-18 11:10:17 +08:00
parent 4983cfa6c2
commit 9307989329
47 changed files with 2075 additions and 60 deletions

View File

@@ -12,6 +12,7 @@ import (
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
clusterapiv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
"open-cluster-management.io/placement/test/integration/util"
)
@@ -45,7 +46,7 @@ var _ = ginkgo.Describe("Placement", func() {
ginkgo.AfterEach(func() {
ginkgo.By("Delete managedclusterset")
clusterClient.ClusterV1alpha1().ManagedClusterSets().Delete(context.Background(), clusterSet1Name, metav1.DeleteOptions{})
clusterClient.ClusterV1beta1().ManagedClusterSets().Delete(context.Background(), clusterSet1Name, metav1.DeleteOptions{})
ginkgo.By("Delete managedclusters")
clusterClient.ClusterV1().ManagedClusters().DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{
@@ -119,24 +120,24 @@ var _ = ginkgo.Describe("Placement", func() {
assertBindingClusterSet := func(clusterSetName string) {
ginkgo.By("Create clusterset/clustersetbinding")
clusterset := &clusterapiv1alpha1.ManagedClusterSet{
clusterset := &clusterapiv1beta1.ManagedClusterSet{
ObjectMeta: metav1.ObjectMeta{
Name: clusterSetName,
},
}
_, err = clusterClient.ClusterV1alpha1().ManagedClusterSets().Create(context.Background(), clusterset, metav1.CreateOptions{})
_, err = clusterClient.ClusterV1beta1().ManagedClusterSets().Create(context.Background(), clusterset, metav1.CreateOptions{})
gomega.Expect(err).ToNot(gomega.HaveOccurred())
csb := &clusterapiv1alpha1.ManagedClusterSetBinding{
csb := &clusterapiv1beta1.ManagedClusterSetBinding{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: clusterSetName,
},
Spec: clusterapiv1alpha1.ManagedClusterSetBindingSpec{
Spec: clusterapiv1beta1.ManagedClusterSetBindingSpec{
ClusterSet: clusterSetName,
},
}
_, err = clusterClient.ClusterV1alpha1().ManagedClusterSetBindings(namespace).Create(context.Background(), csb, metav1.CreateOptions{})
_, err = clusterClient.ClusterV1beta1().ManagedClusterSetBindings(namespace).Create(context.Background(), csb, metav1.CreateOptions{})
gomega.Expect(err).ToNot(gomega.HaveOccurred())
}

View File

@@ -16,6 +16,7 @@ import (
apiequality "k8s.io/apimachinery/pkg/api/equality"
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
clusterapiv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
controllers "open-cluster-management.io/placement/pkg/controllers"
"open-cluster-management.io/placement/test/integration/util"
)
@@ -199,24 +200,24 @@ var _ = ginkgo.Describe("Placement", func() {
assertBindingClusterSet := func(clusterSetName string) {
ginkgo.By("Create clusterset/clustersetbinding")
clusterset := &clusterapiv1alpha1.ManagedClusterSet{
clusterset := &clusterapiv1beta1.ManagedClusterSet{
ObjectMeta: metav1.ObjectMeta{
Name: clusterSetName,
},
}
_, err = clusterClient.ClusterV1alpha1().ManagedClusterSets().Create(context.Background(), clusterset, metav1.CreateOptions{})
_, err = clusterClient.ClusterV1beta1().ManagedClusterSets().Create(context.Background(), clusterset, metav1.CreateOptions{})
gomega.Expect(err).ToNot(gomega.HaveOccurred())
csb := &clusterapiv1alpha1.ManagedClusterSetBinding{
csb := &clusterapiv1beta1.ManagedClusterSetBinding{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: clusterSetName,
},
Spec: clusterapiv1alpha1.ManagedClusterSetBindingSpec{
Spec: clusterapiv1beta1.ManagedClusterSetBindingSpec{
ClusterSet: clusterSetName,
},
}
_, err = clusterClient.ClusterV1alpha1().ManagedClusterSetBindings(namespace).Create(context.Background(), csb, metav1.CreateOptions{})
_, err = clusterClient.ClusterV1beta1().ManagedClusterSetBindings(namespace).Create(context.Background(), csb, metav1.CreateOptions{})
gomega.Expect(err).ToNot(gomega.HaveOccurred())
}

View File

@@ -36,8 +36,7 @@ var _ = ginkgo.BeforeSuite(func(done ginkgo.Done) {
testEnv = &envtest.Environment{
ErrorIfCRDPathMissing: true,
CRDDirectoryPaths: []string{
filepath.Join(".", "vendor", "open-cluster-management.io", "api", "cluster", "v1"),
filepath.Join(".", "vendor", "open-cluster-management.io", "api", "cluster", "v1alpha1"),
filepath.Join(".", "deploy", "hub"),
},
}