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

update priority range in htb qos #1688

Merged
merged 1 commit into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/qos.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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