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 kubectl ko using ovn-central pod that not in a good status #2676

Merged
merged 3 commits into from
Apr 20, 2023

Conversation

changluyi
Copy link
Collaborator

What type of this PR

Examples of user facing changes:

  • Features
  • Bug fixes
  • Docs
  • Tests

Which issue(s) this PR fixes:

Fixes #2650

WHAT

copilot:summary

copilot:poem

HOW

copilot:walkthrough

@changluyi changluyi requested a review from oilbeater April 19, 2023 02:27
@changluyi changluyi added bug Something isn't working need backport labels Apr 19, 2023
@github-actions
Copy link
Contributor

  • The commit message is missing, it should describe the changes made in the patch.
  • There are no format errors or performance issues in the code.
  • The getOvnCentralPod() function has been modified to check if the pod is running before returning its name. However, the error message for the SB_POD case still says "nb leader not exists", which is misleading. It should be changed to "sb leader not exists".
  • It might be a good idea to add some comments explaining what this function does and how it is used.

@@ -566,13 +566,13 @@ diagnose(){
}

getOvnCentralPod(){
NB_POD=$(kubectl get pod -n $KUBE_OVN_NS -l ovn-nb-leader=true | grep ovn-central | head -n 1 | awk '{print $1}')
NB_POD=$(kubectl get pod -n $KUBE_OVN_NS -l ovn-nb-leader=true | grep ovn-central | head -n 1 | awk '{if($2=="1/1" && $3=="Running") print $1}')
Copy link
Collaborator

Choose a reason for hiding this comment

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

head -n -1 will return only the first line

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@github-actions
Copy link
Contributor

github-actions bot commented Apr 19, 2023

  • The commit message is missing. It's important to have a clear and concise message that describes the changes made in the patch.
  • There are no format errors or performance issues in this code patch.
  • There is a potential bug in the code. In both if statements, the error message says "nb leader not exists" even though the second one should say "sb leader not exists".
  • The getOvnCentralPod function could be improved by combining the two kubectl get pod commands into one command with multiple selectors. This would reduce the number of calls to the Kubernetes API and improve performance.

@github-actions
Copy link
Contributor

  • The commit message should provide more context about the changes made in this patch.
  • There is a typo in the error message for SB_POD, it should say "sb leader not exists" instead of "nb leader not exists".
  • The code could be improved by removing the duplication in the two kubectl commands.

@changluyi changluyi merged commit 3dc36c8 into master Apr 20, 2023
@changluyi changluyi deleted the fix_kubectl_ko_nbctl_use_wrong_pod branch April 20, 2023 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need backport
Projects
None yet
2 participants