Skip to content

Commit

Permalink
Merge pull request kosmos-io#426 from qiuming520/distribution-policy
Browse files Browse the repository at this point in the history
fix: kosmos scheduler e2e cases
  • Loading branch information
kosmos-robot authored Mar 1, 2024
2 parents 907dc4b + ccac6c3 commit be9af7d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
6 changes: 3 additions & 3 deletions docs/proposals/distributionpolicy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The more the precise, the higher the priority. Defaults to zero which means sche

**PolicyTerms**
1. PolicyTerms is required
2. The current node scheduling policy is divided into three nodeType (host, leaf, mix).
2. The current node scheduling policy is divided into four nodeTypes (host, leaf, mix, adv).
3. Advanced options will be supported in the future. Sure as NodeSelector, Affinity and so on.

## Use cases
Expand Down Expand Up @@ -151,10 +151,10 @@ kosmos-member2-cluster-1 Ready agent 24m v1.21.5-
kosmos-member2-cluster-2 Ready agent 24m v1.21.5-eki.0

# Show the taint information on the virtual node
kubectl describe node kosmos-member2-cluster-1 |grep Tai
kubectl describe node kosmos-member2-cluster-1 |grep Taints
Taints: node.kubernetes.io/unreachable:NoExecute

kubectl describe node kosmos-member2-cluster-2 |grep Tai
kubectl describe node kosmos-member2-cluster-2 |grep Taints
Taints: node.kubernetes.io/unreachable:NoExecute

# Scheduling by the kosmos-scheduler (hybrid scheduling)
Expand Down
20 changes: 4 additions & 16 deletions test/e2e/framework/distribution_policy_sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,8 @@ func NewClusterDistributionPolicy() *kosmosv1alpha1.ClusterDistributionPolicy {

func CreateDistributionPolicy(client versioned.Interface, ns string, dp *kosmosv1alpha1.DistributionPolicy) {
ginkgo.By("Creating DistributionPolicy", func() {
err := client.KosmosV1alpha1().DistributionPolicies(ns).Delete(context.TODO(), dp.Name, metav1.DeleteOptions{})
if err != nil {
klog.Errorf("delete old DistributionPolicy occur error :", err)
gomega.Expect(apierrors.IsNotFound(err)).Should(gomega.Equal(true))
}

_, err = client.KosmosV1alpha1().DistributionPolicies(ns).Create(context.TODO(), dp, metav1.CreateOptions{})
if err != nil {
_, err := client.KosmosV1alpha1().DistributionPolicies(ns).Create(context.TODO(), dp, metav1.CreateOptions{})
if err != nil && !apierrors.IsAlreadyExists(err) {
klog.Errorf("create DistributionPolicy occur error :", err)
gomega.Expect(err).Should(gomega.HaveOccurred())
}
Expand All @@ -175,14 +169,8 @@ func CreateDistributionPolicy(client versioned.Interface, ns string, dp *kosmosv

func CreateClusterDistributionPolicy(client versioned.Interface, cdp *kosmosv1alpha1.ClusterDistributionPolicy) {
ginkgo.By("Creating ClusterDistributionPolicy", func() {
err := client.KosmosV1alpha1().ClusterDistributionPolicies().Delete(context.TODO(), cdp.Name, metav1.DeleteOptions{})
if err != nil {
klog.Errorf("delete old ClusterDistributionPolicy occur error :", err)
gomega.Expect(apierrors.IsNotFound(err)).Should(gomega.Equal(true))
}

_, err = client.KosmosV1alpha1().ClusterDistributionPolicies().Create(context.TODO(), cdp, metav1.CreateOptions{})
if err != nil {
_, err := client.KosmosV1alpha1().ClusterDistributionPolicies().Create(context.TODO(), cdp, metav1.CreateOptions{})
if err != nil && !apierrors.IsAlreadyExists(err) {
klog.Errorf("create ClusterDistributionPolicy occur error :", err)
gomega.Expect(err).Should(gomega.HaveOccurred())
}
Expand Down

0 comments on commit be9af7d

Please sign in to comment.