digitalocean / clusterlint

A best practices checker for Kubernetes clusters. 🤠
Apache License 2.0
547 stars 45 forks source link

Support both v1beta1 and v1 admission control webhooks #124

Closed adamwg closed 3 years ago

adamwg commented 3 years ago

We have a number of checks that operate on admission control webhook configuration. Older clusters support only v1beta1 of admission control, while newer clusters support v1. Currently clusterlint fails to run on these older clusters because we can't fetch v1 admission control objects from them.

This PR makes two changes to fix this:

  1. When listing objects, ignore "not found" errors, which mean the cluster doesn't support the resource we're trying to list.
  2. Duplicate our existing admission control webhook checks for v1beta1, so that older clusters get the same checks as newer clusters.

While we're here, enhance the errors we return when listing objects fails so that we can tell which resource we failed to list.