From 5e9e7d0b21d15e4556ca1578e007f1a9c42820ca Mon Sep 17 00:00:00 2001 From: Stefan Midjich Date: Fri, 25 Mar 2022 10:23:26 +0100 Subject: [PATCH 1/3] Template syntax to retrieve values with dashes (-) in their key names This template syntax was not obvious to me until someone pointed it out on stackexchange, it should be in the cheatsheet for future users. Because trying to retrieve a value with dashes in its key-name using the normal template syntax will result in an error. --- content/en/docs/reference/kubectl/cheatsheet.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index 3eaeb17ca9f..95985c09af2 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -177,6 +177,9 @@ kubectl get pods --selector=app=cassandra -o \ kubectl get configmap myconfig \ -o jsonpath='{.data.ca\.crt}' +# Retrieve a value with dashes instead of underscores. +kubectl get secret mysecret --template='{{index .data "key-name-with-dashes"}}' + # Get all worker nodes (use a selector to exclude results that have a label # named 'node-role.kubernetes.io/master') kubectl get node --selector='!node-role.kubernetes.io/master' From 95dd0b33abdfa770b3c3381fd5a3d99838dd4858 Mon Sep 17 00:00:00 2001 From: Stefan Midjich Date: Tue, 14 Jun 2022 21:17:03 +0200 Subject: [PATCH 2/3] Update content/en/docs/reference/kubectl/cheatsheet.md Co-authored-by: Rey Lejano --- content/en/docs/reference/kubectl/cheatsheet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index 95985c09af2..4ec1327886c 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -178,7 +178,7 @@ kubectl get configmap myconfig \ -o jsonpath='{.data.ca\.crt}' # Retrieve a value with dashes instead of underscores. -kubectl get secret mysecret --template='{{index .data "key-name-with-dashes"}}' +kubectl get secret my-secret --template='{{index .data "key-name-with-dashes"}}' # Get all worker nodes (use a selector to exclude results that have a label # named 'node-role.kubernetes.io/master') From dd9061e3269113dfdc2756395f61c501714256f8 Mon Sep 17 00:00:00 2001 From: Stefan Midjich Date: Fri, 17 Jun 2022 19:41:52 +0200 Subject: [PATCH 3/3] clarify that the value is base64 encoded Co-authored-by: Rey Lejano --- content/en/docs/reference/kubectl/cheatsheet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index 4ec1327886c..24beed3c4e0 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -177,7 +177,7 @@ kubectl get pods --selector=app=cassandra -o \ kubectl get configmap myconfig \ -o jsonpath='{.data.ca\.crt}' -# Retrieve a value with dashes instead of underscores. +# Retrieve a base64 encoded value with dashes instead of underscores. kubectl get secret my-secret --template='{{index .data "key-name-with-dashes"}}' # Get all worker nodes (use a selector to exclude results that have a label