Match regexes for kubernetes api resources

* Grabbed a list of resources with the cmd:
    kubectl api-resources -o name | xargs '-I{}' -n 1 echo -n '{}|'

  * Removed plural endings for resources
    (this matches the format of the clusters I interact with)

Note: I would like to add an optional "match an optional s" to handle
cases where the resources are pluralized, although I *think*
the way kubernetes names resources, they don't appear as plural
when doing `kubectl get all` which is what the hinting is designed
for. But I'm not super experienced with awk so I haven't figured
that one out yet.
This commit is contained in:
Ryan Kemper 2018-08-07 23:40:28 -07:00 committed by Jorge Morante
parent 15dba3f6a7
commit 89baccf950
1 changed files with 1 additions and 0 deletions

View File

@ -56,6 +56,7 @@ PATTERNS_LIST=(
"([0-9a-f]{7,40})"
"((https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&()*+-]*)"
"([[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3})"
"(deployment.app|binding|componentstatuse|configmap|endpoint|event|limitrange|namespace|node|persistentvolumeclaim|persistentvolume|pod|podtemplate|replicationcontroller|resourcequota|secret|serviceaccount|service|mutatingwebhookconfiguration.admissionregistration.k8s.io|validatingwebhookconfiguration.admissionregistration.k8s.io|customresourcedefinition.apiextension.k8s.io|apiservice.apiregistration.k8s.io|controllerrevision.apps|daemonset.apps|deployment.apps|replicaset.apps|statefulset.apps|tokenreview.authentication.k8s.io|localsubjectaccessreview.authorization.k8s.io|selfsubjectaccessreviews.authorization.k8s.io|selfsubjectrulesreview.authorization.k8s.io|subjectaccessreview.authorization.k8s.io|horizontalpodautoscaler.autoscaling|cronjob.batch|job.batch|certificatesigningrequest.certificates.k8s.io|events.events.k8s.io|daemonset.extensions|deployment.extensions|ingress.extensions|networkpolicies.extensions|podsecuritypolicies.extensions|replicaset.extensions|networkpolicie.networking.k8s.io|poddisruptionbudget.policy|clusterrolebinding.rbac.authorization.k8s.io|clusterrole.rbac.authorization.k8s.io|rolebinding.rbac.authorization.k8s.io|role.rbac.authorization.k8s.io|storageclasse.storage.k8s.io)[[:alnum:]_#$%&+=/@-]+"
)
IFS=$'\n'