Commit Graph

36 Commits (master)

Author SHA1 Message Date
Moritz Rieger 40b8be288b
support storageclass from annotations (#149)
providing the storage-class via annotations is deprecated but still respected when provided

CLOSES #150
2022-08-11 13:40:23 +02:00
Dylan Scott a8c53040ec
CON-5812 Extend clusterlint to raise an error-level violation when invalid snapshots are found (#143) 2022-07-04 17:53:02 +01:00
Adam Wolfe Gordon 91df975aee Return the correct node names in the node labels and taints check
Previously a loop variable was being used for the node name in the diagnostic
returned from the node labels and taints check. If the offending node wasn't the
last one in the list, the wrong node name would be returned.

Add a test to reproduce the issue, and copy the loop variable to fix it.
2022-02-24 16:16:06 -07:00
Collin Shoop 7f663e5c23 Remove v1beta1 admission/controller webhook checks 2022-01-26 11:20:30 -05:00
Varsha Varadarajan 1a5de2fdc2 dobs-pod-owner: initialize loop iterator variable as we are passing by object details by reference 2021-12-10 10:22:45 -05:00
Timo Reimann d0800c1fc4 Fix webhook test expectations
The beta tests need to use the beta expectations as well.
2021-09-19 16:03:08 +02:00
Adam Wolfe Gordon 5eeabb8136
Support both v1beta1 and v1 admission control webhooks (#124)
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 change covers the following modifications:

- When listing objects, ignore "not found" errors, which mean the cluster 
  doesn't support the resource we're trying to list.
- Duplicate our existing admission control webhook checks for v1beta1, so that 
  older clusters get the same checks as newer clusters. 
- Enhance the errors we return when listing objects fails so that we can tell 
  which resource we failed to list.
- Remove extraneous empty import: client auth plugins are already loaded in 
  objects.go, so no need for the import in object_filter.go. 
- Ensure all object lists are non-nil after fetching objects. (Since we now 
  ignore not found errors, it's possible for some object lists to be nil.) 
- Skip v1beta1 admission control tests when v1 objects exist.

Co-authored-by: Timo Reimann <treimann@digitalocean.com>
2021-09-19 15:47:35 +02:00
Ingo Gottwald 98f22c21a7 Fix webhook timeout diagnostics message
The message now includes all tested criteria.
2021-07-05 13:58:50 +02:00
Varsha Varadarajan ef03e37686 doks - check if pod referencing dobs volumes are owned by a statefulset 2021-01-05 12:41:28 -08:00
Varsha Varadarajan 95e7d57b51 Use admissionregistration/v1 client to fetch webhooks
* Do not fetch unused ComponentStatuses
2020-12-21 12:38:18 -08:00
Varsha Varadarajan 2edf737cb0 webhook-replacement: ensure that the webhook rules are applicable to v1, apps/* 2020-11-05 14:16:51 -08:00
Spencer 99bb81f367 change approach 2020-08-13 19:52:35 +00:00
Spencer Sharkey 973b3f4c54 Fix reference to loop variables in doks admission controllers 2020-08-13 19:44:15 +00:00
Adam Wolfe Gordon a1e68fdd59 Make "details" for the label check stable
The tests for #90 failed because the order of map iteration is
non-deterministic, causing custom labels in the node label check to appear in
random order in the diagnostic details. Sort the slice of labels so that the
output is stable.
2020-08-13 13:09:02 -06:00
Jeremy L. Morris 161c7a1a7c Add comment on why we just continue for nil TimeoutSeconds value 2020-07-07 11:06:27 -04:00
Jeremy L. Morris b3915f299d Update timeout check to account for nil TimeoutSeconds value 2020-06-30 17:44:32 -04:00
Jeremy L. Morris e6ec7b4515 Add webhook check for timeouts
* Update docs to include Admission Controller Webhook Timeout check with fix

 * Update file naming to be more consistent for admission controller webhooks

 * Fix typo in webhook replacement struct name
2020-06-15 12:07:35 -04:00
Varsha Varadarajan aa7e326e5a Update node labels diagnostics to mention persistent node pool labels 2020-05-28 09:15:28 -07:00
Varsha Varadarajan ac38530e46 Add additional details to diagnostics, provide specific labels and taint keys for nodeLabelsTaints check 2020-05-26 15:07:24 -07:00
Nan Zhong 08da1a28bb Introduce basic admission webhook checks to handle error case 2019-11-25 04:57:32 +00:00
Adam Wolfe Gordon 68416bd367 Add check names to diagnostics from the check runner
Rather than relying on each check to fill in its name correctly when
producing diagnostics, fill in the name in the check runner after
running the check. This reduces the likelihood that a check gets its
name wrong or forgets to fill it in.

This also fixes a bug where the admission control webhook check was not
filling in its name at all.
2019-10-28 18:07:01 -06:00
Adam Wolfe Gordon af31dfeada Update the DOKS admission controller webhook check
DOKS has improved handling of webhooks such that the only webhooks that
cause problems are those that:

* Have failurePolicy set to Fail,
* Target a service other than the Kubernetes apiserver, and
* Apply kube-system, and
* Applies to the namespace of the targeted service or are in a
  single-node cluster.

Update the webhook check to reflect this improvement.
2019-10-01 11:18:21 -06:00
Varsha Varadarajan f02cccbb98 Change severity levels for some checks
* If a check causes upgrade or node replacement to break, severity level is error, else warning
2019-09-29 12:13:49 -07:00
Adam Wolfe Gordon d43005ebbc Add a DOKS check for custom node labels and taints
In DOKS labels and taints applied to nodes will be lost when the cluster
is upgraded or a node is otherwise replaced. This can cause problems for
workloads if labels or taints are used for scheduling.

Add a warning if any node in a cluster has custom labels or taints.
2019-09-10 11:19:06 -06:00
Varsha Varadarajan 98cd5d2b7a Filter diagnostics based on enabled checks while writing diagnostics to stdout 2019-07-02 19:20:26 -04:00
Varsha Varadarajan 279004da51 Check if webhook config references a service before throwing an error 2019-07-02 17:39:26 -04:00
Varsha Varadarajan 92e0e9dfe2 Admission webhook check: Add a doks specific error is webhook applies to objects in kube-system namespace 2019-07-02 17:18:05 -04:00
Adam Wolfe Gordon 2b080d1b9a Add license header to all files 2019-07-02 13:30:42 -06:00
Varsha Varadarajan 8bacdc73a0 Change desc assertion in all tests, rename variables to conform to convention 2019-06-26 09:25:07 -04:00
Varsha Varadarajan 695765302e Add level flag to filter output based on severity: error, warning, or suggestion 2019-06-25 14:19:41 -04:00
Varsha Varadarajan 171ba02f4e Remove TypeMeta from Diagnostic.
* The k8s API does not set TypeMeta on objects when the list API is used
2019-06-25 14:19:20 -04:00
Varsha Varadarajan 65ba22e8d8 Use owner references to indicate the objects that refer to the problematic object.
* Change output format to json
2019-06-25 14:19:20 -04:00
Varsha Varadarajan 0320c5633a Introduce Diagnostic struct to store check output 2019-06-25 09:42:27 -04:00
Varsha Varadarajan b2768bdb56 Change assertion order in tests. 2019-06-19 19:19:09 -04:00
Varsha Varadarajan 283bf23c49 Add tests around metadata for each check 2019-06-18 14:06:58 -04:00
Varsha Varadarajan baa0bf739c Add node name check: Checks for pods which use node name in the node selector. 2019-06-16 08:31:25 -04:00