Last active
February 3, 2021 12:57
-
-
Save marcosborges/85e7db30cc62ed5c7696815e29c27a85 to your computer and use it in GitHub Desktop.
Kubectl e Jq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Lista de deployments que tem o nome inicado com: | |
kubectl get deployments -n [NAMESPACE] -o json | jq '.items[].metadata.name|startswith("[DEPLOYMENT_NAME]")' | |
# Lista de deployments que contem em seu nome o termo: | |
kubectl get deployments -n [NAMESPACE] -o json | jq '.items[].metadata.name|contains("[DEPLOYMENT_NAME]")' | |
# Lista de deployments que satisfaça o REGEX: | |
kubectl get deployments -n [NAMESPACE] -o json | jq '.items[].metadata.name|test("[DEPLOYMENT_NAME]-([0-9a-zA-Z]{7})")' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment