Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Expose basic cluster information to jsonnet #124

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

anguslees
Copy link
Contributor

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
Copy link
Contributor Author

anguslees commented Sep 11, 2017

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
Copy link
Contributor Author

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

This follows up from 18554b9

Rewrite show_test as an integration test, that cleanly reinvokes
kubecfg separately for each of yaml, json.

Fixes vmware-archive#99
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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant