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

feat: cli to display ipcache by labels #35275

Merged
merged 1 commit into from
Nov 5, 2024
Merged

feat: cli to display ipcache by labels #35275

merged 1 commit into from
Nov 5, 2024

Conversation

vasu-dasari
Copy link
Contributor

Added new CLI to display ipcache entries by cidr and labels.

Display IP Cache information

Usage:
cilium-dbg ip get ( <cidr> |-l <identity labels> ) [flags]

Flags: -h, --help help for get
-l, --labels strings list of labels
-o, --output string json| yaml| jsonpath='{}'
-v, --verbose Print all fields of ipcache

Fixes: #34632
Signed-off-by: Vasu Dasari [email protected]

introducing a new CLI option to display ipcache information by labels or cidr

@vasu-dasari vasu-dasari requested review from a team as code owners October 7, 2024 13:09
@maintainer-s-little-helper
Copy link

Commit 5a5b83b does not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

@maintainer-s-little-helper maintainer-s-little-helper bot added dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Oct 7, 2024
@vasu-dasari
Copy link
Contributor Author

CLI display from my testing:
Help text:

root@gke-vasudasari-cilium-1-default-pool-4a9bc11f-kzys:/home/cilium# cilium-dbg ip get -h
Display IP Cache information

Usage:
  cilium-dbg ip get ( <cidr> |-l <identity labels> ) [flags]

Flags:
  -h, --help             help for get
  -l, --labels strings   list of labels
  -o, --output string    json| yaml| jsonpath='{}'
  -v, --verbose          Print all fields of ipcache

Global Flags:
      --config string   Config file (default is $HOME/.cilium.yaml)
  -D, --debug           Enable debug messages
  -H, --host string     URI to server-side API

Query by CIDR:

root@gke-vasudasari-cilium-1-default-pool-4a9bc11f-kzys:/home/cilium# cilium-dbg ip get 10.168.0.12/32
IP               IDENTITY        SOURCE
10.168.0.12/32   reserved:host
root@gke-vasudasari-cilium-1-default-pool-4a9bc11f-kzys:/home/cilium# cilium-dbg ip get -l k8s:io.kubernetes.pod.namespace=default
===========================
Labels:
    k8s:io.kubernetes.pod.namespace=default
===========================
IP                HOST          IDENTITY   POD                           NAMESPACE
10.80.0.2/32      10.168.0.13   76103      rebel-base-55756c47d5-kzdsr   default
10.80.0.99/32     10.168.0.13   74181      x-wing-6bb767fcb8-757wc       default
10.80.3.4/32      10.168.0.12   74181      x-wing-6bb767fcb8-4jwsk       default
10.80.3.203/32    10.168.0.12   76103      rebel-base-55756c47d5-gjhm5   default
10.100.1.23/32    10.168.0.16   183733     rebel-base-55756c47d5-f4rv6   default
10.100.1.54/32    10.168.0.16   157998     x-wing-6bb767fcb8-2whv5       default
10.100.3.140/32   10.168.0.15   157998     x-wing-6bb767fcb8-947rj       default
10.100.3.206/32   10.168.0.15   183733     rebel-base-55756c47d5-sf8c5   default

@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Oct 7, 2024
@maintainer-s-little-helper
Copy link

Commits 5a5b83b, 5d73957 do not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

@nathanjsweet
Copy link
Member

@vasu-dasari Please sign-off your first commit and remove the last empty commit. Thanks 🙂 !

@nathanjsweet nathanjsweet added the release-note/minor This PR changes functionality that users may find relevant to operating Cilium. label Oct 9, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Oct 9, 2024
@nathanjsweet
Copy link
Member

@vasu-dasari Pinging you on getting this merged. Please sign-off your first commit and remove the empty last commit from your PR. Thanks! 🙂

cilium-dbg/cmd/ip_get.go Outdated Show resolved Hide resolved
Copy link
Contributor

@doniacld doniacld left a comment

Choose a reason for hiding this comment

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

One nit otherwise lgtm!

@derailed
Copy link
Contributor

@vasu-dasari Could you take another look when you get a chance? Thank you!

@maintainer-s-little-helper
Copy link

Commits 5a5b83b, 5d73957, 3e11c1f do not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

1 similar comment
@maintainer-s-little-helper
Copy link

Commits 5a5b83b, 5d73957, 3e11c1f do not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

Copy link
Contributor Author

@vasu-dasari vasu-dasari left a comment

Choose a reason for hiding this comment

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

Added Signed-off-by to my commit. And addressed comment from @doniacld

cilium-dbg/cmd/ip_get.go Outdated Show resolved Hide resolved
@maintainer-s-little-helper
Copy link

Commits 5a5b83b, 5d73957, 3e11c1f, 5776676 do not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

1 similar comment
@maintainer-s-little-helper
Copy link

Commits 5a5b83b, 5d73957, 3e11c1f, 5776676 do not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

@maintainer-s-little-helper
Copy link

Commit 3aa5c9a does not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

@maintainer-s-little-helper
Copy link

Commit 9f19d48 does not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

Added new CLI to display ipcache entries by cidr and labels.

Display IP Cache information

Usage:
cilium-dbg ip get ( <cidr> |-l <identity labels> ) [flags]

Flags: -h, --help help for get
-l, --labels strings list of labels
-o, --output string json| yaml| jsonpath='{}'
-v, --verbose Print all fields of ipcache

Fixes: cilium#34632
Signed-off-by: Vasu Dasari <[email protected]>
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Nov 4, 2024
@aanm aanm enabled auto-merge November 4, 2024 10:32
@aanm
Copy link
Member

aanm commented Nov 4, 2024

/test

@aanm aanm requested a review from doniacld November 4, 2024 10:32
Copy link
Contributor

@doniacld doniacld left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the change

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Nov 5, 2024
@aanm aanm added this pull request to the merge queue Nov 5, 2024
@julianwiedmann julianwiedmann added the cilium-cli This PR contains changes related with cilium-cli label Nov 5, 2024
Merged via the queue into cilium:main with commit 0580541 Nov 5, 2024
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cilium-cli This PR contains changes related with cilium-cli kind/community-contribution This was a contribution made by a community member. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/minor This PR changes functionality that users may find relevant to operating Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CFP: Provide cilium ip get command enhancements to filter output by CIDR or labels.
7 participants