From 89baccf9506e0c7dd724dd7fd99256050374435f Mon Sep 17 00:00:00 2001 From: Ryan Kemper Date: Tue, 7 Aug 2018 23:40:28 -0700 Subject: [PATCH] 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. --- scripts/config.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/config.sh b/scripts/config.sh index d8400aa..1987dcc 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -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'