kubecfg icon indicating copy to clipboard operation
kubecfg copied to clipboard

Expose basic cluster information to jsonnet

Open anguslees opened this issue 8 years ago • 2 comments

This change adds two new jsonnet native functions:

  • kubernetesVersion returns (eg) [1, 7] for a K8s 1.7 server.
  • kubernetesGroupVersionSupported returns a bool indicating whether a given GroupVersion is supported by the current server

Note the latter does not provide a way to iterate over all supported GroupVersions, for privacy.

anguslees avatar Sep 11 '17 08:09 anguslees

Discuss. In particular:

  • I'm not crazy about the length of the name kubernetesGroupVersionSupported

  • I made kubernetesVersion return [int, int] (rather than the native [str, str] which k8s exposes) since I thought doing less-than/greater-than comparisons would be common. The problem with this is that it's actually [float, float] because jsonnet inherits json's types - and I'm mildly concerned this is theoretically not comparable for equality (also a common expected operation).

Obviously this opens up a whole lot of interesting possibilities for portable configs.

anguslees avatar Sep 11 '17 08:09 anguslees

oh, and the first of the two commits rewrites show_test.go as an integration test. Fixes #99

anguslees avatar Sep 11 '17 08:09 anguslees