digitalocean / clusterlint

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

CON-5812 Extend clusterlint to raise an error-level violation when invalid snapshots are found #143

Closed dylanrhysscott closed 2 years ago

dylanrhysscott commented 2 years ago

Deployed a prod cluster and created artificially labelled snapshots / contents - running clusterlint correctly raised following errors:

./clusterlint --kubeconfig ~/Downloads/test-cluster-kubeconfig.yaml run
W0624 16:55:38.126204   46310 warnings.go:70] batch/v1beta1 CronJob is deprecated in v1.21+, unavailable in v1.25+; use batch/v1 CronJob
[error] /volume snapshot content/snapcontent-72d9a349-aacd-42d2-a240-d775650d2455: Snapshot content has been marked as invalid by CSI validation - check volumeHandle and snapshotHandle are not both set
[error] default/volume snapshot/new-snapshot-demo: Snapshot has been marked as invalid by CSI validation - check persistentVolumeClaimName and volumeSnapshotContentName are not both set

Validation errors will be raised with the following labels:

May want to adjust messaging from clusterlint but these errors conform to https://github.com/kubernetes-csi/external-snapshotter/tree/eb447544376eaf7115cfe70bd143a40e7718262a#validating-webhook

khayyamsaleem commented 2 years ago

LGTM, but is there anything we want to add to the messaging to indicate a sensible solution, like upgrading backing up / converting their snapshot?