Kubevious Rules Library
June 13, 2024 ยท View on GitHub
Kubevious Rules Library
This repository represents a library of rules for Kubevious CLI project to validate errors (typos, conflicts, misconfigurations) and violations of compliance and security best practices in Kubernetes and related cloud-native projects.
Kubevious rules are expressed in a domain-specific language called Kubik.

Library Contents
Total Rules: 36
Locations:
- ๐ ARGO-ROLLOUT (1)
- ๐ CERT-MANAGER (2)
- ๐ GCP-CONFIG-CONNECTOR/SQL (3)
- ๐ ISTIO (1)
- ๐ K8S/CONTAINER (7)
- ๐ K8S/GATEWAY-API/GATEWAY (3)
- ๐ K8S/GATEWAY-API/HTTP-ROUTE (2)
- ๐ K8S/HPA (1)
- ๐ K8S/INGRESS (5)
- ๐ K8S/NETWORK-POLICY (1)
- ๐ K8S/POD-SPEC (4)
- ๐ K8S/RBAC (2)
- ๐ K8S/SERVICE (1)
- ๐ K8S/WORKLOAD (1)
- ๐ KONG (2)
Rules:
๐ ARGO-ROLLOUT
๐ Validate Argo Rollout to Analysis Template reference.
- ๐ท๏ธ argo ๐ท๏ธ rollout ๐ท๏ธ analysis ๐ท๏ธ reference
๐ CERT-MANAGER
๐ Validate CertManager Certificate to Issuer reference.
- ๐ท๏ธ cert-manager ๐ท๏ธ certificate ๐ท๏ธ issuer ๐ท๏ธ reference
๐ Validate Ingress to CertManager Issuer reference.
- ๐ท๏ธ cert-manager ๐ท๏ธ ingress ๐ท๏ธ issuer ๐ท๏ธ reference
๐ GCP-CONFIG-CONNECTOR/SQL
๐ Validate GCP Config Connector SQL Database to Instance reference.
- ๐ท๏ธ gcp-config-connector ๐ท๏ธ sql-database ๐ท๏ธ sql-instance ๐ท๏ธ reference
๐ Validate GCP Config Connector SQL User to Instance reference.
- ๐ท๏ธ gcp-config-connector ๐ท๏ธ sql-user ๐ท๏ธ sql-instance ๐ท๏ธ reference
๐ Validate GCP Config Connector SQL User to Password Secret reference.
- ๐ท๏ธ gcp-config-connector ๐ท๏ธ sql-user ๐ท๏ธ secret ๐ท๏ธ reference
๐ ISTIO
๐ Validate Istio VirtualService to IstioGateway reference.
- ๐ท๏ธ istio ๐ท๏ธ virtual-service ๐ท๏ธ istio-gateway ๐ท๏ธ reference
๐ K8S/CONTAINER
๐ Validate ContainerSpec environment variable ConfigMap reference.
- ๐ท๏ธ k8s ๐ท๏ธ container ๐ท๏ธ environment-variable ๐ท๏ธ config-map ๐ท๏ธ reference
๐ Validate ContainerSpec envFrom variables projection ConfigMap reference.
- ๐ท๏ธ k8s ๐ท๏ธ container ๐ท๏ธ environment-variable ๐ท๏ธ config-map ๐ท๏ธ reference
๐ Validate ContainerSpec envFrom variables projection Secret reference.
- ๐ท๏ธ k8s ๐ท๏ธ container ๐ท๏ธ environment-variable ๐ท๏ธ secret ๐ท๏ธ reference
๐ Validate ContainerSpec environment variable Secret reference.
- ๐ท๏ธ k8s ๐ท๏ธ container ๐ท๏ธ environment-variable ๐ท๏ธ secret ๐ท๏ธ reference
๐ Validate ContainerSpec image to have non latest tag.
- ๐ท๏ธ k8s ๐ท๏ธ container ๐ท๏ธ image ๐ท๏ธ latest
๐ Validate ContainerSpec resource requests to be less or equal to the limits.
- ๐ท๏ธ k8s ๐ท๏ธ container ๐ท๏ธ resources ๐ท๏ธ cpu ๐ท๏ธ memory ๐ท๏ธ request ๐ท๏ธ limit
๐ Validate ContainerSpec volume mount to PodSpec volume reference.
- ๐ท๏ธ k8s ๐ท๏ธ container ๐ท๏ธ volume ๐ท๏ธ volume-mount ๐ท๏ธ reference
๐ K8S/GATEWAY-API/GATEWAY
๐ Validate Gateway to Certificate Secret reference.
- ๐ท๏ธ k8s ๐ท๏ธ gateway-api ๐ท๏ธ gateway ๐ท๏ธ certificate ๐ท๏ธ reference
๐ Validate Gateway to GatewayClass reference.
- ๐ท๏ธ k8s ๐ท๏ธ gateway-api ๐ท๏ธ gateway ๐ท๏ธ gateway-class ๐ท๏ธ reference
๐ Validate Gateway to have unique listeners.
- ๐ท๏ธ k8s ๐ท๏ธ gateway-api ๐ท๏ธ gateway ๐ท๏ธ unique-listeners
๐ K8S/GATEWAY-API/HTTP-ROUTE
๐ Validate HTTPRoute to Backend reference.
- ๐ท๏ธ k8s ๐ท๏ธ gateway-api ๐ท๏ธ http-route ๐ท๏ธ backend ๐ท๏ธ reference
๐ Validate HTTPRoute to Gateway reference.
- ๐ท๏ธ k8s ๐ท๏ธ gateway-api ๐ท๏ธ http-route ๐ท๏ธ gateway ๐ท๏ธ reference
๐ K8S/HPA
๐ Validate HorizontalPodAutoscaler to scale target reference.
- ๐ท๏ธ k8s ๐ท๏ธ hpa ๐ท๏ธ target ๐ท๏ธ reference
๐ K8S/INGRESS
๐ Validate Ingress (extension) to Service reference.
- ๐ท๏ธ k8s ๐ท๏ธ ingress ๐ท๏ธ ingress-extension ๐ท๏ธ service ๐ท๏ธ reference
๐ Validate Ingress to Service reference.
- ๐ท๏ธ k8s ๐ท๏ธ ingress ๐ท๏ธ service ๐ท๏ธ reference
๐ Validate Ingress TLS and rule domain match.
- ๐ท๏ธ k8s ๐ท๏ธ ingress ๐ท๏ธ ingress-extension ๐ท๏ธ tls ๐ท๏ธ domain
๐ Validate Ingresses to have unique routing rules.
- ๐ท๏ธ k8s ๐ท๏ธ ingress ๐ท๏ธ ingress-extension ๐ท๏ธ unique-route
๐ Validate IngressClasses to have at most only one default.
- ๐ท๏ธ k8s ๐ท๏ธ ingress-class ๐ท๏ธ unique-default
๐ K8S/NETWORK-POLICY
๐ Validate NetworkPolicy to PodSpec reference.
- ๐ท๏ธ k8s ๐ท๏ธ network-policy ๐ท๏ธ pod-spec ๐ท๏ธ reference
๐ K8S/POD-SPEC
๐ Validate PodSpec to ServiceAccount reference.
- ๐ท๏ธ k8s ๐ท๏ธ pod-spec ๐ท๏ธ service-account ๐ท๏ธ reference
๐ Validate PodSpec volume mount ConfigMap reference.
- ๐ท๏ธ k8s ๐ท๏ธ pod-spec ๐ท๏ธ config-map ๐ท๏ธ volume ๐ท๏ธ reference
๐ Validate PodSpec volume mount PersistentVolumeClaim reference.
- ๐ท๏ธ k8s ๐ท๏ธ pod-spec ๐ท๏ธ pvc ๐ท๏ธ volume ๐ท๏ธ reference
๐ Validate PodSpec volume mount Secret reference.
- ๐ท๏ธ k8s ๐ท๏ธ pod-spec ๐ท๏ธ secret ๐ท๏ธ volume ๐ท๏ธ reference
๐ K8S/RBAC
๐ Validate RoleBinding and ClusterRoleBinding to Role and ClusterRole reference.
- ๐ท๏ธ k8s ๐ท๏ธ rbac ๐ท๏ธ binding ๐ท๏ธ role ๐ท๏ธ reference
๐ Validate RoleBinding and ClusterRoleBinding to ServiceAccount subject reference.
- ๐ท๏ธ k8s ๐ท๏ธ rbac ๐ท๏ธ binding ๐ท๏ธ service-account ๐ท๏ธ reference
๐ K8S/SERVICE
๐ Validate Service to PodSpec label selector reference.
- ๐ท๏ธ k8s ๐ท๏ธ service ๐ท๏ธ pod-spec ๐ท๏ธ reference
๐ K8S/WORKLOAD
๐ Checks Deployments to have min/max replicas - with or without HPAs.
- ๐ท๏ธ k8s ๐ท๏ธ deployment ๐ท๏ธ replica-count
๐ KONG
๐ Validate KongConsumer to Credential Secret reference.
- ๐ท๏ธ kong ๐ท๏ธ consumer ๐ท๏ธ credential ๐ท๏ธ secret ๐ท๏ธ reference
๐ Validate Ingress and Service to Kong Plugin reference
- ๐ท๏ธ kong ๐ท๏ธ ingress ๐ท๏ธ service ๐ท๏ธ plugin ๐ท๏ธ reference
Contributing
To submit your rules to the library follow the steps:
- Find the right place for the rule under root directory.
- Index the library using:
$ kubevious index-library .
- Submit a pull request.