Commit Graph

36 Commits

Author SHA1 Message Date
Gabriella Gonzalez
299351e9df
Upgrade dhall-haskell reference (#182)
… to pick up the `NatOrString` changes from:

71a8374c2a
2022-03-09 07:42:32 -08:00
arobertn
bc7719ecdb
Pass natural/integer preference args to openapi-to-dhall (#178) 2022-01-13 17:10:10 -08:00
Gabriella Gonzalez
49d1d68d2c
Fix handling of additional properties (#180)
… by pulling in the fix from https://github.com/dhall-lang/dhall-haskell/pull/2343
2021-12-03 09:19:20 -08:00
Alvin Zhao
df8b2a3e83
kubernetes v1.22 (#176) 2021-09-17 09:19:58 -07:00
Gabriella Gonzalez
bda43aa30e
Upgrade dhall-haskell (#175)
Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/174
2021-09-14 21:49:07 -07:00
Gabriel Gonzalez
5227c6f47d
Support Kubernetes 1.20 and 1.21 (#170)
Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/169
2021-07-07 12:11:34 -07:00
Gabriel Gonzalez
2ed2ffd073
Improve user experience for generating files (#165)
This improves the documentation and scripts responsible for
generating files.  The main changes from the user's point of view
are:

* The `generate` script now supports four subcommands:

  * `generate kubernetes` - Generate all Kubernetes bindings
  * `generate examples` - Generate examples for the preferred Kubernetes version
  * `generate readme` - Generate the README from the Dhall template
  * `generate preferred` - Generate top-level files that re-export the preferred
    Kubernetes version

  The `generate` script without arguments generates everything

* Generation should be faster and more incremental now

  For example, regenerating the `README` by itself should go more quickly since
  it no longer requires regenerating any examples or Kubernetes bindings if
  they haven't changed

This required overhauling the internal Nix code for generating these files
to support more granular builds.

Another consequence of this change is that the preferred Kubernetes
version no longer packages `Prelude.dhall`, `README.dhall` or the
`examples`.  Those are now only stored within the top-level directory.
2021-03-23 11:32:34 -07:00
Will Sewell
2b6210de20
Update dhall-openapi and regenerate (#162)
Includes changes from https://github.com/dhall-lang/dhall-haskell/pull/2126
and https://github.com/dhall-lang/dhall-haskell/pull/2137.
2021-01-17 12:21:24 +00:00
Will Sewell
079178f537
Update dhall-openapi (#158)
* Fetch latest versions of kubernetes

* Update dhall-openapi and regenerate
2021-01-15 09:10:08 -08:00
Gabriel Gonzalez
a4126b7f8f
Fix apiVersion/kind defaults for PersistentVolumeClaim (#155) 2020-10-31 19:51:58 -07:00
Gabriel Gonzalez
c636517c40
Add support for kubernetes API version 1.19 (#147) 2020-09-27 17:15:16 -07:00
Gabriel Gonzalez
efb745854a
Fix CI to check that generation script has run (#145)
… based on the discussion in #138

CI wasn't checking that the `./scripts/generate.sh` script had been
run, which this change fixes
2020-09-11 18:11:01 -07:00
Gabriel Gonzalez
ad3369f9f9
Fix PersistentVolumeClaim (#144)
Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/136
2020-09-07 21:30:28 -07:00
Gabriel Gonzalez
59132b47b7
Fix examples to use remote imports (#142)
Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/140
2020-08-28 07:44:06 -07:00
Gabriel Gonzalez
c0586bcce5
Switch to dhall-openapi project (#137)
The `dhall-openapi` subproject from the `dhall-haskell` repository
supersedes `dhall-kubernetes-generator`, so this change switches over
to using that project.
2020-08-11 08:55:13 -07:00
Gabriel Gonzalez
f4bf4b9ddf
Only build README and examples for the preferred version (#132)
Also generate version 1.18 along the way

Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/131
2020-07-23 19:19:21 -07:00
Gabriel Gonzalez
a6a361875f
Disable Dhall's test suite (#130)
... so that the build works for Nix systems that are sandboxed

Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/128
2020-07-17 07:33:02 -07:00
Tristan de Cacqueray
49fabcc9a1
Update to latest dhall to escape reserved keywords (#127)
This change updates the dhall-kubernetes-generator to use the latest dhall
version so that attribute named after reserved keywords are properly escape.
See: https://github.com/dhall-lang/dhall-haskell/issues/1896
2020-06-30 13:02:32 -07:00
Gabriel Gonzalez
98a4e61e1c
Fix evaluation failure in CI (#121)
Hydra complains about the branch name with:

```
hydra-eval-jobs returned exit code 1:
error: worker error: invalid Git branch/tag name 'refs/heads/nixos-unstable'
```

... and the branch name is not necessary anyway
2020-05-26 09:08:02 -07:00
Gabriel Gonzalez
b4908eb261
Remove --omit-empty from Nix code (#119)
It's no longer necessary, although in this case it happens to
have no effect
2020-05-09 07:39:01 -07:00
Gabriel Gonzalez
381306bcc3
Go back to using --omitNull instead of --omitEmpty (#110)
Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/86

The motivation of this is to more accurately model the Kubernetes
API semantics by not auto-omitting empty fields.  This is because
a field set to `Some ([] : List T)` is not necessarily the same
as `None (List T)`.

This makes the typical case a bit more verbose (more `Some`s), but
the difference to the `./examples` shows that it's not too bad.
2020-01-31 06:52:20 -08:00
Gabriel Gonzalez
3e160f4a27
Upgrade to dhall-1.29.0 (#109)
The main motivation for the upgrade is to take advantage of the
improved formatting for example code
2020-01-30 07:23:13 -08:00
Gabriel Gonzalez
90c1eb8851
Minimize unnecessary rebuilds (#105)
This improves the granularity of the Nix build graph in order to minimize
unnecessary rebuilds.

This also fixed several bugs in the package generation along the way, so
this change includes those fixes.
2020-01-14 07:35:36 -08:00
Gabriel Gonzalez
a8ffffc4cb
Generate Dhall schemas for multiple Kubernetes versions (#104)
Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/75

This also changes the default version to the latest version to 1.17 since now
users can access older versions
2020-01-12 15:00:56 -08:00
Gabriel Gonzalez
eb001e6683
Groundwork for supporting multiple releases (#103)
Related to https://github.com/dhall-lang/dhall-kubernetes/issues/75

This generalizes the machinery for fetching the Kubernetes OpenAPI spec to
support fetching multiple versions.  In particular, the Kubernetes version
is no longer tied to the version of Nixpkgs that we use.
2020-01-10 21:40:36 -08:00
Alessandro Marrella
8234563d02 Implement generator from CustomResourceDefinition (#98) 2020-01-10 06:22:41 -08:00
Gabriel Gonzalez
1c6397ccde
Improve coverage for ./scripts/generate.sh (#100)
`./scripts/generate.sh` will now also auto-update the
`./examples/*.dhall` files and `./package.dhall`, too
2020-01-07 18:29:56 -08:00
Greg Ziegan
4ab28225a1 Update Kubernetes API and expose TypesUnion in package.dhall 2019-12-14 08:10:02 -08:00
Hunter Kelly
337a81fa8b Generator Improvements (#92)
* Add --skipDuplicates CLI flag and handler

* Add prefixMap option for specifying external import roots
2019-12-11 05:41:24 -08:00
Greg Ziegan
7af2ab5345 Prefer "schema" syntax for examples (#93)
* Also update to the latest version of `dhall`
* Also fix `./scripts/generate.sh` to generate the `schemas*` files
2019-11-23 16:53:03 -08:00
Fabrizio Ferrai
4ad58156b7
Update to Kubernetes 1.14.3 (#72) 2019-07-30 10:25:00 +03:00
Fabrizio Ferrai
805b432df2
API v2 (#57)
This ports the conversion script from Python to Haskell (fix #7)

The main reasons for this port are that:
- the Python script was really hard to maintain for reasons like 
  "converting from Swagger to Dhall is interleaved with string formatting"
- in Haskell we can use the dhall library to generate always syntactically 
  correct Dhall AST. It's also much easier to keep an eye on correctness, 
  because types and pattern matching. It also forces us to deal with things
  like cyclic imports from the get go.

Things happening here:
- remove the `api` folder, removing the difference between "raw api" and "nice api"
- move defaults from `default` to `defaults` folder, as it is in `dhall-nethack`
- transition to the new syntax for `Optional` (fix #49)
- add `types.dhall` and `defaults.dhall`, so that one can now easily "pin a version"
  by just importing these two records at a specific commit/tag. They also make it really
  easy to access objects, e.g.
  `let types = https://raw.githubusercontent... sha256:... in types.Deployment`
- also add typesUnion.dhall (fix #54), so one is able to send to Kubernetes different
  objects in the same stream. This is also documented in the README
- defaults are resolved recursively (fix #46): if there's an import of a "nullable" record,
  then it's not marked as Optional, making merging objects much easier
- default objects are not lambdas anymore, and instead they just don't include the required
  fields (that is, the ones that are not nullable records), as suggested in dhall-lang/dhall-lang#382
- for objects that are simple types we used to generate a simple lambda
  `\(a : Text) -> a` as a default, now we just don't generate a default (e.g. see
  `io.k8s.apimachinery.pkg.apis.meta.v1.Time`)
- autoformat all generated Dhall code
- remove cyclic imports (fix #47)
- update to dhall-1.22 and dhall-json-1.2.8
2019-05-01 19:13:18 +03:00
Arian van Putten
8d295ecedc
Nixify the build (#55)
This makes our build reproducible and consistent

* Disables dhall tests. They don't build in sandbox mode because they require network access
* Moves all scripts to ./scripts folder for consistency
* Moves all nix files to ./nix folder for consistency, except for release.nix which Hydra needs
* Changes convert.py to take the K8s swagger spec as an argument
* Get k8s swagger spec from nixpkgs
* Get dhall prelude from nixpkgs
* added an ./scripts/update-nixpkgs.sh script to easily update to a new version of nixpkgs
2019-03-30 11:05:29 +01:00
Fabrizio Ferrai
423db8a8bb
Centralize Prelude import (#51)
Import the Prelude only in one place, so it's cached and easily overridable
2019-03-25 12:20:27 +02:00
Fabrizio Ferrai
ced5c10af3
Update to Dhall v5.0.0: deprecate constructors keyword (#45) 2019-01-21 08:49:34 +02:00
Simon Hafner
b98223e2a6 Upgrade to dhall version v3.0.0 (#36) 2018-11-12 18:37:55 +01:00