dhall-kubernetes icon indicating copy to clipboard operation
dhall-kubernetes copied to clipboard

v1beta1 Ingress is missing from typesUnion.dhall

Open K0Te opened this issue 4 years ago • 1 comments

Hi,

I am trying to use the new v1beta1 Ingress API for K8, I've been able to create configuration:

let k8Ingress =
      https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/1.19/schemas/io.k8s.api.extensions.v1beta1.Ingress.dhall sha256:751334b2bff987943ee94b79e57a8f52f9d82db8e78d0af288df0c2c62f870db
in  k8Ingress::{
    , metadata = k8.ObjectMeta::{
...

But now I cannot use it list API, as the new one is missing from typesUnion.dhall, it only contains the old one:

| Ingress :    ./types/io.k8s.api.networking.v1.Ingress.dhall sha256:11cb1017304eefa899441f454e5f46a1dada585092b89a7c7158528d4f9f1230<br class="Apple-interchange-newline">

Please advise.

K0Te avatar Jun 14 '21 14:06 K0Te

@K0Te: Yeah, this is because if there are multiple versions of a resource available form the API, then we only select one version for typesUnion (and also for types / schemas / defaults). In particular, we prefer the v1 version of a resource over the v1beta1 version

So if you really want the beta1 version of the resource, then there is a way to work around this if you need to use a non-default version, which is to wrap the typesUnion type in yet another sum type, like this:

let typesUnion = ...

let MyUnion = < Ingress : https://.../types/io.k8s.api.extensions.v1beta1.Ingress.dhall | Other : typesUnion >

... because dhall-to-yaml can handle nested union types (it will strip the alternative from both of them).

Gabriella439 avatar Jun 16 '21 21:06 Gabriella439