Consolidate all cluster capability queries in one place

Summary

Currently we use a series of scattered functions to query the capabilities of the cluster, e.g. IsOpenShift, IsGroupVersionSupported, etc. Apart from their inefficient implementation (for example every time IsGroupVersionSupported is called it rereads and reloads KUBECONFIG) they are barely testable. Consolidating them into an interface makes implementation and mocking easier an more efficient.

References

Acceptance criteria

  • Define a Capabilities interface and refactor individual query functions and consolidate them into an implementation.
  • Devise a mechanism to pass the cluster capabilities to controllers and its methods (possibly via a global variable or runtime context).
  • Change all the references to these query functions and use the replacement mechanism
  • Relocate the Capabilities interface and its implementation(s) to /pkg directory under settings package.
Edited by Mitchell Nielsen