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

Fix priority class flag use #1031

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

pkharat
Copy link
Contributor

@pkharat pkharat commented Sep 21, 2023

No description provided.

@pkharat
Copy link
Contributor Author

pkharat commented Oct 3, 2023

1. Testing on ocp esx

noiro@oshift3-ext-rtr:~$ oc get nodes -owide
NAME             STATUS   ROLES                  AGE   VERSION           INTERNAL-IP    EXTERNAL-IP    OS-IMAGE                                                       KERNEL-VERSION                 CONTAINER-RUNTIME
ocp413-master1   Ready    control-plane,master   48d   v1.26.6+73ac561   192.168.53.3   192.168.53.3   Red Hat Enterprise Linux CoreOS 413.92.202307311416-0 (Plow)   5.14.0-284.25.1.el9_2.x86_64   cri-o://1.26.4-2.rhaos4.13.git7b43407.el9
ocp413-master2   Ready    control-plane,master   48d   v1.26.6+73ac561   192.168.53.4   192.168.53.4   Red Hat Enterprise Linux CoreOS 413.92.202307311416-0 (Plow)   5.14.0-284.25.1.el9_2.x86_64   cri-o://1.26.4-2.rhaos4.13.git7b43407.el9
ocp413-master3   Ready    control-plane,master   48d   v1.26.6+73ac561   192.168.53.5   192.168.53.5   Red Hat Enterprise Linux CoreOS 413.92.202307311416-0 (Plow)   5.14.0-284.25.1.el9_2.x86_64   cri-o://1.26.4-2.rhaos4.13.git7b43407.el9
ocp413-worker1   Ready    worker                 48d   v1.26.6+73ac561   192.168.53.6   192.168.53.6   Red Hat Enterprise Linux CoreOS 413.92.202307311416-0 (Plow)   5.14.0-284.25.1.el9_2.x86_64   cri-o://1.26.4-2.rhaos4.13.git7b43407.el9
ocp413-worker2   Ready    worker                 48d   v1.26.6+73ac561   192.168.53.7   192.168.53.7   Red Hat Enterprise Linux CoreOS 413.92.202307311416-0 (Plow)   5.14.0-284.25.1.el9_2.x86_64   cri-o://1.26.4-2.rhaos4.13.git7b43407.el9

When set "use_system_node_priority_class: True", then priority class system-node-critical is set for controller, host, openvswitch pods.

noiro@oshift3-ext-rtr:~$ oc get pods -n aci-containers-system aci-containers-controller-575f7b867d-zr2kf -oyaml | grep priority
priority: 2000001000
priorityClassName: system-node-critical
noiro@oshift3-ext-rtr:~$ oc get pods -n aci-containers-system aci-containers-host-5rdrx -oyaml | grep priority
priority: 2000001000
priorityClassName: system-node-critical
noiro@oshift3-ext-rtr:~$ 
noiro@oshift3-ext-rtr:~$ oc get pods -n aci-containers-system aci-containers-openvswitch-gdqb6 -oyaml | grep priority
priority: 2000001000
priorityClassName: system-node-critical

When did not set any flag related to priority class, then priority class acicni-priority is set for controller, host, openvswitch pods

noiro@oshift3-ext-rtr:~$ oc get pods -n aci-containers-system aci-containers-controller-8458455cdd-l7wc5 -oyaml | grep priority
priority: 1000000000
priorityClassName: acicni-priority
noiro@oshift3-ext-rtr:~$ 
noiro@oshift3-ext-rtr:~$ oc get pods -n aci-containers-system aci-containers-host-54vjb -oyaml | grep priority
priority: 1000000000
priorityClassName: acicni-priority
noiro@oshift3-ext-rtr:~$ oc get pods -n aci-containers-system aci-containers-openvswitch-2pncj -oyaml | grep priority
priority: 1000000000
priorityClassName: acicni-priority

2. Testing on k8s hyperflex

noiro@k8s16-ext-rtr:~$ kubectl get nodes  -owide
NAME           STATUS   ROLES                  AGE     VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
k8s16-node-1   Ready    control-plane,master   7d1h    v1.26.9   192.168.16.2   <none>        Ubuntu 22.04.3 LTS   5.15.0-84-generic   cri-o://1.25.1
k8s16-node-2   Ready    worker                 6d23h   v1.26.9   192.168.16.3   <none>        Ubuntu 22.04.3 LTS   5.15.0-84-generic   cri-o://1.25.1
k8s16-node-3   Ready    worker                 6d23h   v1.26.9   192.168.16.4   <none>        Ubuntu 22.04.3 LTS   5.15.0-84-generic   cri-o://1.25.1
k8s16-node-4   Ready    worker                 6d23h   v1.26.9   192.168.16.5   <none>        Ubuntu 22.04.3 LTS   5.15.0-84-generic   cri-o://1.25.1
k8s16-node-5   Ready    worker                 6d23h   v1.26.9   192.168.16.6   <none>        Ubuntu 22.04.3 LTS   5.15.0-84-generic   cri-o://1.25.1

When set "use_system_node_priority_class: True", then as expected, priority class system-node-critical is set for controller, host, openvswitch pods

noiro@k8s16-ext-rtr:~$ kubectl get pod -n aci-containers-system aci-containers-controller-fd874d9d-g6cj9  -oyaml | grep priority
        f:priorityClassName: {}
  priority: 2000001000
  priorityClassName: system-node-critical

noiro@k8s16-ext-rtr:~$ kubectl get pod -n aci-containers-system aci-containers-host-bp5d2  -oyaml | grep priority
        f:priorityClassName: {}
  priority: 2000001000
  priorityClassName: system-node-critical

noiro@k8s16-ext-rtr:~$ kubectl get pod -n aci-containers-system aci-containers-openvswitch-8pgbv -oyaml | grep priority
        f:priorityClassName: {}
  priority: 2000001000
  priorityClassName: system-node-critical

When did not set any flag related to priority class, then priority class system-node-critical is set for controller pod and priority class system-cluster-criticial is set for host, openvswitch pods

noiro@k8s16-ext-rtr:~$ kubectl get pod -n aci-containers-system aci-containers-controller-fd874d9d-58tr6 -oyaml | grep priority
        f:priorityClassName: {}
  priority: 2000001000 
  priorityClassName: system-node-critical

noiro@k8s16-ext-rtr:~$ kubectl get pod -n aci-containers-system aci-containers-host-6gnf7 -oyaml | grep priority
        f:priorityClassName: {}
  priority: 2000000000 
  priorityClassName: system-cluster-critical

noiro@k8s16-ext-rtr:~$ kubectl get pod -n aci-containers-system aci-containers-openvswitch-2nlz7 -oyaml | grep priority
        f:priorityClassName: {}
  priority: 2000000000 
  priorityClassName: system-cluster-critical

@pkharat pkharat marked this pull request as ready for review October 3, 2023 08:03
@pkharat
Copy link
Contributor Author

pkharat commented Oct 30, 2023

Since the PR would be merged after 6.0.3.2 release, marking it as draft PR

@pkharat pkharat marked this pull request as draft October 30, 2023 05:15
@pkharat pkharat force-pushed the fix-priority-class-flag-use branch 3 times, most recently from 76ca0f1 to f82db32 Compare February 2, 2024 13:26
@pkharat pkharat marked this pull request as ready for review February 5, 2024 13:24
@@ -2442,7 +2442,7 @@ spec:
{% if config.kube_config.use_system_node_priority_class %}
priorityClassName: system-node-critical
{% else %}
{% if not config.kube_config.no_priority_class %}
{% if config.kube_config.no_priority_class %}
Copy link
Contributor

@abhis2112 abhis2112 Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why this change is needed - here it is saying that the no_priority_class is true we use system-cluster-critical but ideally when it is false then we use the priorityclass. Is this a valid check ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purpose of this flag is to set priority class for k8s platform.

  1. Either we can continue to use the same name (to go with minimal changes) or
  2. Use different flag name and replace 'no_priority_class' flag with the new name at all the places in
    k8s etc flavors / wherever required

@abhis2112 @snaiksat

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkharat - the question is not about name - no_priority_class , its about the if check logic. The earlier logic was mentioning that if no_priority_class field is not mentioned in kube_config we use the default priorityClassName system-cluster-critical . However now we are making no_priority_class field a mandatory field in kube_config. So in case we don't mention anything e.g. use_system_node_priority_class/no_priority_class/use_acicni_priority_class we will end up with no priorityClassName, which breaks the original functionality, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abhis2112 Only use_system_node_priority_class is expected from user, other two no_priority_class and use_acicni_priority_class are coming from flavors.yaml and its always going to be present.

When a new flavor is added it's expected and mandatory to add no_priority_class(for k8s) / use_acicni_priority_class (for ocp). If it's not added then it's an error and must be resolved during the flavor addition itself. Other than this I don't see any issue.

If I am correct, you are suggesting we add a default priority class if no option provided at all (we have to decide which one is common across all platforms), but do we really need that with above mentioned approach ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if I deduce it right , in case of k8s flavor if the mandatory field is added (no_priority_class) then according to old logic the if check will always be false since no_priority_class will always be present as per flavor then we will end up with no priority class name configuration.

With the new change, the logic makes it default - with no_priority_class (always set) use system_cluster_critical priorityclassname . So the question to you is - is there a default priorityclass earlier for k8s or is it expected with this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no default priority class earlier also.

Logic used to set priority class for k8s and ocp flavours is little confusing.

  1. for k8s - not adding flag no_priority_class is the way

    flavors.yaml ->

Screenshot 2024-02-29 at 8 40 59 PM

aci-containers.yaml (https://github.com/noironetworks/acc-provision/blob/master/provision/acc_provision/templates/aci-containers.yaml#L2474)

{% if not config.kube_config.no_priority_class %}
      priorityClassName: system-cluster-critical
{% endif %}

  1. for ocp - setting both no_priority_class and use_acicni_priority_class is the way

    flavors.yaml ->

Screenshot 2024-02-29 at 8 42 42 PM

aci-containers.yaml (https://github.com/noironetworks/acc-provision/blob/master/provision/acc_provision/templates/aci-containers.yaml#L2477)

      {% if config.kube_config.use_acicni_priority_class %}
      priorityClassName: acicni-priority
      {% endif %}

Setting both the flags to determine ocp flavor and then not setting any flag to determine k8s flavors is confusing. So straight forward logic should be you set the flag itself for corresponding flavor.

Copy link
Contributor

@abhis2112 abhis2112 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment

Copy link
Contributor

@abhis2112 abhis2112 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting Info

1) Use priority class "system-node-critical" when flag
'use_system_node_priority_class: true' is configured in acc provision
input file

2) Use priority class "acicni-priority" when flag
"use_acicni_priority_class: true" is set and this is set by default in
flavors.yaml for OCP. Remove redundant flag "no_priority_class:True" from
all OCP flavors where already "use_acicni_priority_class: True"
is set. (Exception - openshift-3.9, openshift-3.10, openshift-3.11
has only "no_priority_class:True" so not touching those flavors)

3) If priority class flag is not set in acc provision or flavors.yaml
then internally its "no_priority_class: true" and accordingly
priority class is set for
pod aci-containers-host, aci-containers-openvswith -> "system-cluster-critical"
pod aci-containers-controller -> "system-node-critical"
@pkharat pkharat force-pushed the fix-priority-class-flag-use branch from 0866834 to 2f397e2 Compare March 1, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants