Skip to content

Commit

Permalink
update priority range in htb qos (#1688)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Jul 14, 2022
1 parent 41bdcd0 commit 48d914e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions docs/qos.md
Expand Up @@ -40,7 +40,7 @@ spec:
type: object
properties:
priority:
type: string # Value in range 0 to 4,294,967,295.
type: string # Value in range 0 to 7.
scope: Cluster
names:
plural: htbqoses
Expand All @@ -54,9 +54,9 @@ The spec parameter has only one field, `htbqoses.spec.priority`, which value rep
```
mac@bogon kube-ovn % kubectl get htbqos
NAME PRIORITY
htbqos-high 100
htbqos-low 300
htbqos-medium 200
htbqos-high 1
htbqos-low 5
htbqos-medium 3
```
Specific priority values are unimportant, only relative ordering matters. The smaller the priority value, the higher the QoS priority.

Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/init.go
Expand Up @@ -743,11 +743,11 @@ func (c *Controller) initHtbQos() error {

switch qosName {
case util.HtbQosHigh:
priority = "100"
priority = "1"
case util.HtbQosMedium:
priority = "200"
priority = "3"
case util.HtbQosLow:
priority = "300"
priority = "5"
default:
klog.Errorf("qos %s is not default defined", qosName)
}
Expand Down
14 changes: 7 additions & 7 deletions test/e2e/qos/qos.go
Expand Up @@ -231,7 +231,7 @@ var _ = Describe("[Qos]", func() {
Spec: kubeovn.SubnetSpec{
CIDRBlock: cidr,
Protocol: util.CheckProtocol(cidr),
HtbQos: util.HtbQosHigh,
HtbQos: util.HtbQosLow,
Namespaces: []string{namespace},
},
}
Expand All @@ -243,7 +243,7 @@ var _ = Describe("[Qos]", func() {

subnet, err := f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
Expect(subnet.Spec.HtbQos).To(Equal(util.HtbQosHigh))
Expect(subnet.Spec.HtbQos).To(Equal(util.HtbQosLow))

autoMount := false
oriPod := &corev1.Pod{
Expand Down Expand Up @@ -282,11 +282,11 @@ var _ = Describe("[Qos]", func() {
time.Sleep(3 * time.Second)
priority, _, err := framework.GetPodHtbQosPara(name, namespace)
Expect(err).NotTo(HaveOccurred())
Expect(priority).To(Equal("100"))
Expect(priority).To(Equal("5"))

By("Annotate pod with priority")
pod := oriPod.DeepCopy()
pod.Annotations[util.PriorityAnnotation] = "60"
pod.Annotations[util.PriorityAnnotation] = "2"

patch, err := util.GenerateStrategicMergePatchPayload(oriPod, pod)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -296,13 +296,13 @@ var _ = Describe("[Qos]", func() {

pod, err = f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
Expect(pod.Annotations[util.PriorityAnnotation]).To(Equal("60"))
Expect(pod.Annotations[util.PriorityAnnotation]).To(Equal("2"))

By("Check Ovs Qos Para")
time.Sleep(3 * time.Second)
priority, _, err = framework.GetPodHtbQosPara(name, namespace)
Expect(err).NotTo(HaveOccurred())
Expect(priority).To(Equal("60"))
Expect(priority).To(Equal("2"))

By("Delete Pod priority annotation")
testPod := pod.DeepCopy()
Expand All @@ -321,7 +321,7 @@ var _ = Describe("[Qos]", func() {
time.Sleep(3 * time.Second)
priority, _, err = framework.GetPodHtbQosPara(name, namespace)
Expect(err).NotTo(HaveOccurred())
Expect(priority).To(Equal("100"))
Expect(priority).To(Equal("5"))

By("Delete pod")
err = f.KubeClientSet.CoreV1().Pods(namespace).Delete(context.Background(), pod.Name, metav1.DeleteOptions{})
Expand Down

0 comments on commit 48d914e

Please sign in to comment.