From db0a5cfdf31a13d7b473b0af5cac0884a054cbd5 Mon Sep 17 00:00:00 2001 From: Pantelis Karamolegkos Date: Sat, 11 Mar 2023 15:41:42 +0200 Subject: [PATCH 1/4] List pods images by app label --- specs/kubernetes/list_pod_images_by_app.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 specs/kubernetes/list_pod_images_by_app.yaml diff --git a/specs/kubernetes/list_pod_images_by_app.yaml b/specs/kubernetes/list_pod_images_by_app.yaml new file mode 100644 index 00000000..5aca4602 --- /dev/null +++ b/specs/kubernetes/list_pod_images_by_app.yaml @@ -0,0 +1,15 @@ +--- +name: List images by app label of pods +command: > + kubectl get pods -l app={{app}} -o jsonpath='{range .items[*]}{"\n"}{range .spec.containers[*]}{.name}{"\t"}{.image}{"\n"}{end}{end}' +tags: + - kubernetes +description: Lists the images of pods fetched by app label +arguments: + - name: app + description: The value of the app label + default_value: ~ +source_url: "https://stackoverflow.com/questions/51931113/kubectl-get-events-only-for-a-pod" +author: pkaramol +author_url: "https://www.linkedin.com/in/pkaramol/" +shells: [] \ No newline at end of file From d15794a66c02d74a0e957cec6c1e324608136c8e Mon Sep 17 00:00:00 2001 From: Pantelis Karamolegkos Date: Sat, 11 Mar 2023 15:49:10 +0200 Subject: [PATCH 2/4] Setting correct source_url --- specs/kubernetes/list_pod_images_by_app.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/kubernetes/list_pod_images_by_app.yaml b/specs/kubernetes/list_pod_images_by_app.yaml index 5aca4602..926ebeef 100644 --- a/specs/kubernetes/list_pod_images_by_app.yaml +++ b/specs/kubernetes/list_pod_images_by_app.yaml @@ -9,7 +9,7 @@ arguments: - name: app description: The value of the app label default_value: ~ -source_url: "https://stackoverflow.com/questions/51931113/kubectl-get-events-only-for-a-pod" +source_url: "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/" author: pkaramol author_url: "https://www.linkedin.com/in/pkaramol/" shells: [] \ No newline at end of file From fd7507cfb630cc6f7771846cddfcc1b6601e0e46 Mon Sep 17 00:00:00 2001 From: Pantelis Karamolegkos Date: Sat, 11 Mar 2023 16:31:39 +0200 Subject: [PATCH 3/4] Update list_pod_images_by_app.yaml --- specs/kubernetes/list_pod_images_by_app.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/kubernetes/list_pod_images_by_app.yaml b/specs/kubernetes/list_pod_images_by_app.yaml index 926ebeef..28c628ce 100644 --- a/specs/kubernetes/list_pod_images_by_app.yaml +++ b/specs/kubernetes/list_pod_images_by_app.yaml @@ -1,7 +1,7 @@ --- name: List images by app label of pods command: > - kubectl get pods -l app={{app}} -o jsonpath='{range .items[*]}{"\n"}{range .spec.containers[*]}{.name}{"\t"}{.image}{"\n"}{end}{end}' + kubectl get pods -l app={{app}} -o jsonpath='{range .items[*]}{"\n"}{range .spec.containers[*]}{.name}{"\t"}{.image}{"\n"}{end}{end}' | sort | uniq tags: - kubernetes description: Lists the images of pods fetched by app label @@ -12,4 +12,4 @@ arguments: source_url: "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/" author: pkaramol author_url: "https://www.linkedin.com/in/pkaramol/" -shells: [] \ No newline at end of file +shells: [] From b9984a30c2687033bb5f2d00e7d5d604b10d3cbb Mon Sep 17 00:00:00 2001 From: Pantelis Karamolegkos Date: Sat, 8 Apr 2023 10:45:22 +0300 Subject: [PATCH 4/4] Changing soure_url and renaming flow to sth more specific as suggested --- specs/kubernetes/list_pod_images_by_app.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/kubernetes/list_pod_images_by_app.yaml b/specs/kubernetes/list_pod_images_by_app.yaml index 926ebeef..3b578821 100644 --- a/specs/kubernetes/list_pod_images_by_app.yaml +++ b/specs/kubernetes/list_pod_images_by_app.yaml @@ -1,5 +1,5 @@ --- -name: List images by app label of pods +name: List all Kubernetes pods by app label command: > kubectl get pods -l app={{app}} -o jsonpath='{range .items[*]}{"\n"}{range .spec.containers[*]}{.name}{"\t"}{.image}{"\n"}{end}{end}' tags: @@ -9,7 +9,7 @@ arguments: - name: app description: The value of the app label default_value: ~ -source_url: "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/" +source_url: "https://kubernetes.io/docs/reference/kubectl/jsonpath/" author: pkaramol author_url: "https://www.linkedin.com/in/pkaramol/" shells: [] \ No newline at end of file