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

add pod datastore to introspect, add logs for pod events #414

Merged
merged 3 commits into from
Apr 30, 2024

Conversation

sushrk
Copy link
Contributor

@sushrk sushrk commented Apr 23, 2024

Issue #, if available:
N/A

Description of changes:

  1. Adding handler for pod datastore operations to the introspect API
curl http://localhost:22775/datastore/all
{
	"PodDatastore": {
		"PodList": [
			"default/sgp-cronjob-28573380-9jmwf",
			"default/sgp-cronjob-28573380-jp8qj",
			"default/sgp-cronjob-28573380-crpdd",
			"default/hello-world-sgp-767766588-5fx78",
			"default/sgp-cronjob-28573200-4zdkm",
			"default/sgp-cronjob-28573200-h6wrj",
			"kube-system/kube-proxy-hgtjm",
...

sh-4.2$ curl http://localhost:22775/datastore/node/ip-xxx
{
	"ip-xxx": {
		"Pods": {
			"PodList": [
				"default/sgp-cronjob-28573980-w2v5h",
				"default/sgp-cronjob-28574040-z7hdf",
				"default/sgp-cronjob-28573920-zzrp8",
				"default/sgp-cronjob-28574040-mw8kg",
				"default/sgp-cronjob-28574040-r27fs",
				"default/sgp-cronjob-28574040-wdx54",
				"kube-system/kube-proxy-fwfhb",
				"default/sgp-cronjob-28573980-s2fbn",
				"default/sgp-cronjob-28574040-9klss",
				"default/sgp-cronjob-28574040-9mjdt",
				"default/sgp-cronjob-28573920-fzhhl",
				"default/sgp-cronjob-28573920-htd5k",
				"default/sgp-cronjob-28573980-msfln",
				"default/sgp-cronjob-28573980-rwsxj",
				"default/sgp-cronjob-28574040-qbq5j",
				"default/sgp-cronjob-28574040-smwdw",
				"default/sgp-cronjob-28573920-nplkt",
				"default/sgp-cronjob-28574040-dx9r9",
				"default/sgp-cronjob-28574040-rplhd",
				"default/sgp-cronjob-28573980-ktpcl",
				"default/sgp-cronjob-28573920-dkgfx",
				"default/sgp-cronjob-28573920-gt7cd",
				"default/sgp-cronjob-28574040-l7cqp",
				"default/sgp-cronjob-28573920-4z2dq",
				"default/sgp-cronjob-28573980-2wzpk",
				"default/sgp-cronjob-28574040-khzml",
				"default/sgp-cronjob-28573980-jcz6r",
				"default/sgp-cronjob-28574040-58jvz",
				"default/sgp-cronjob-28574040-dgn9x",
				"kube-system/aws-node-s2996",
				"default/sgp-cronjob-28574040-z78kl",
				"default/sgp-cronjob-28573920-mzxq2",
				"default/sgp-cronjob-28574040-2fld4",
				"default/sgp-cronjob-28574040-4vrhf",
				"default/sgp-cronjob-28574040-9mcqv",
				"default/sgp-cronjob-28574040-jbcdt",
				"default/sgp-cronjob-28574040-sp7rf",
				"default/sgp-cronjob-28574040-crrxd",
				"default/sgp-cronjob-28574040-gfj4v",
				"default/sgp-cronjob-28574040-nrhdg",
				"default/sgp-cronjob-28574040-wbftb",
				"default/sgp-cronjob-28574040-7kjg5",
				"default/sgp-cronjob-28573920-xfcq4",
				"default/sgp-cronjob-28573980-fds7l",
				"default/sgp-cronjob-28574040-2gbt6",
				"default/sgp-cronjob-28574040-6dkxv",
				"default/sgp-cronjob-28574040-hxsf9",
				"default/sgp-cronjob-28574040-npcdh",
				"default/sgp-cronjob-28574040-xc54l"
			]
		},
		"RunningPods": {
			"PodList": [
				"kube-system/kube-proxy-fwfhb",
				"default/sgp-cronjob-28574040-rplhd",
				"kube-system/aws-node-s2996",
				"default/sgp-cronjob-28574040-9mcqv"
			]
		}
	}

  1. Added logs to debug the pod events received by the handler
{"level":"info","timestamp":"2024-04-23T19:00:00.291Z","logger":"controllers.Pod Reconciler.custom pod controller","msg":"processing item","objName":"sgp-cronjob-28564980-mvcbh","deltaType":"Updated"}
{"level":"info","timestamp":"2024-04-23T19:00:00.328Z","logger":"controllers.Pod Reconciler.custom pod controller","msg":"processing item","objName":"sgp-cronjob-28564980-cccxf","deltaType":"Added"}
{"level":"info","timestamp":"2024-04-29T11:15:05.384Z","logger":"controllers.Pod Reconciler.custom pod controller","msg":"processing item","objName":"sgp-cronjob-28573020-dbrcc","deltaType":"Deleted"}

{"level":"info","timestamp":"2024-04-29T15:14:16.420Z","logger":"controllers.Pod Reconciler.custom pod controller","msg":"deleting item","objName":"sgp-cronjob-28573200-ffvlk","namespace":"default"}
  1. Use GetRunningPodsOnNode in NodeReconcile to be ensure we only track branch ENIs for active pods.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sushrk sushrk requested a review from a team as a code owner April 23, 2024 19:14
pkg/resource/introspect.go Outdated Show resolved Hide resolved
pkg/resource/introspect.go Outdated Show resolved Hide resolved
pkg/resource/introspect.go Outdated Show resolved Hide resolved
Copy link

@jayanthvn jayanthvn left a comment

Choose a reason for hiding this comment

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

except for the logs comment, rest lgtm

@sushrk
Copy link
Contributor Author

sushrk commented Apr 30, 2024

Added a single path for node, updated the PR details.

Copy link
Contributor

@haouc haouc left a comment

Choose a reason for hiding this comment

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

lgtm

@sushrk sushrk merged commit 71d1142 into aws:debug-leakedENI Apr 30, 2024
4 checks passed
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.

None yet

4 participants