Commit Graph

120 Commits

Author SHA1 Message Date
Gabriella Gonzalez
6172560fb9 Fix handling of additionalProperties
By pulling in the change from https://github.com/dhall-lang/dhall-haskell/pull/2343
2021-12-02 18:08:42 -08: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
Gabriel Gonzalez
058e24fb5f
Update top-level README and examples (#164)
Currently CI does not enforce that they stay
in sync with the `1.17/` package, so I had to
explicitly run the `generate.sh` script to update
them.  I will follow up with another change to
automate this check.
2021-03-18 11:25:57 -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
4dd75dd735
Update docs/README.md.dhall to match README.md (#159)
In a63120cd21 and
3fdb6ca551 README.md had been
updated directly, without updating the "source"
docs/README.md.dhall. This commit rectifies that.
2021-01-16 21:24:15 -08: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
Will Sewell
4e17f209ee
Make scripts/generate.sh POSIX compliant (#161)
The script uses `/bin/sh` as the shell, but uses syntax that is
only defined for bash etc. These suggestions were made by
[`shellcheck`](https://www.shellcheck.net).
2021-01-13 17:05:35 +00:00
Will Sewell
f9827967f4
Only attempt to copy examples for preferred version (#160)
These files are only copied into the nix build for the preferred
version, so for all other versions `cp` would complain that these
files do not exist.
2021-01-13 08:09:37 -08:00
Gabriel Gonzalez
a4126b7f8f
Fix apiVersion/kind defaults for PersistentVolumeClaim (#155) 2020-10-31 19:51:58 -07:00
Simon Zeng
3367b683fa
Remove unused script from documentation generation (#152)
scripts/convert.py is no longer in use - references to it should be
removed from the README
2020-10-30 08:26:18 -07:00
Gabriel Gonzalez
a63120cd21
Update development instructions (#154)
… based on an inquiry from @s-zeng in https://github.com/dhall-lang/dhall-kubernetes/pull/152#issue-509304142
2020-10-29 07:22:50 -07:00
Gabriel Gonzalez
3f1d8cc224
Fix README instructions (#151) 2020-10-03 14:53:09 -07:00
Tristan de Cacqueray
1582db1513
Prelude: update safety-guarantees documentation link (#149) 2020-10-01 09:17:20 -07:00
Gabriel Gonzalez
c636517c40
Add support for kubernetes API version 1.19 (#147) 2020-09-27 17:15:16 -07:00
Gabriel Gonzalez
07bb77a74c
Update add-kubernetes-release.sh script (#148)
… to take care of also running `./scripts/generate` on behalf of the
user
2020-09-25 14:07:15 -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
Gabriel Gonzalez
170c6e86fc
Fix top-level examples (#129) 2020-07-14 07:51:57 -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
fd9cdd4647
Support V1 CRD API (#123)
Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/122
2020-05-30 14:55:05 -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
4a34acd613
Remove dead code (#118)
These scripts are obsolete and have been replaced by Nix code in
`./nix/nixpkgs.nix`
2020-05-08 09:04:45 -07:00
Gabriel Gonzalez
9badc02688
Improve error messages for CRD support (#117) 2020-05-08 09:02:12 -07:00
Gabriel Gonzalez
fc275e649b
Make ObjectMeta's name field optional (#115)
Supersedes https://github.com/dhall-lang/dhall-kubernetes/pull/85
2020-04-24 12:46:00 -07:00
Gabriel Gonzalez
506d633e38
Prefer autoscaler/v2beta2 (#113)
Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/112
2020-02-28 09:02:14 -08: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
Alessandro Marrella
3c6d09a940
Update omit-empty command in Readme (#107) 2020-01-17 17:04:34 +00:00
Gabriel Gonzalez
6a47bd50c4
Remove top-level swagger2.json (#106)
We don't use this for generating the Kubernetes bindings any longer, so we
can safely remove it in order to avoid confusion
2020-01-15 12:59:00 -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
Gabriel Gonzalez
50dac0e944
Add nix-shell support for dhall-kubernetes-generator (#102) 2020-01-10 18:24:00 -08:00
Alessandro Marrella
8234563d02 Implement generator from CustomResourceDefinition (#98) 2020-01-10 06:22:41 -08:00
Gabriel Gonzalez
ddc42e6109
Change algorithm for prioritizing duplicate resources (#101)
Now we place a higher priority on production/beta/alpha than we do on v2/v1

... as requested by @amarrella
2020-01-08 07:52:07 -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
Gabriel Gonzalez
89e7c8ed0b
Automate exclusion of duplicate resources (#99)
Related to https://github.com/dhall-lang/dhall-kubernetes/issues/75

In order to support multiple versions of the Kubernetes API we need to begin
automating the process of excluding duplicate resources (otherwise the
maintenance burden would be far too high).  This change adds new support
for automatically preferring Kubernetes resources by version where:

* v2 is prioritized over v1
* production is prioritized over beta, which is prioritized over alpha

Note that even when prioritizing by version there are still a few cases of
duplicates.  For now we use the default behavior of `Data.List.maximumBy`
to select the last resource if there are still conflicts.  This leads to
a few differences in which resources are preferred when such a conflict
arises (where previously we were just guessing manually which one to pick).
2020-01-03 08:51:05 -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
Ari Becker
bbfec3d854 Add package.dhall (#95)
* Add a `package.dhall` file, which re-exports `schemas.dhall` and adds
`IntOrString`. The expected hash of `package.dhall` is currently:
sha256:3ea8628b704704de295261dfc7626c15247c589c10a266f970cade262543fdda

* Update documentation and examples to clarify that expected usage is
through the `package.dhall` file.

* README.md cleanup: Update tutorial reference URL to the latest `1.28`
release of `dhall-haskell`, and change code language hints from
`haskell` to `dhall`.
2019-12-07 13:41:54 -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
Gabriel Gonzalez
fee24c0993
Add dhall-kubernetes support for "schemas" (#84)
For lack of a better term, I'm calling the `{ Type = …, default = … }`
record that the record completion operator expects a "schema".  This
change adds `dhall-kubernetes` support for auto-generating these schemas
for ease of use with the new `::` operator.

See the included example for how this would be used
2019-11-18 08:22:19 -08:00
James Guthrie
2fb32a453c Set Cron* types and defaults to v1beta1 (#88)
According to the Kubernetes documentation [1]:

Note: CronJob resource in batch/v2alpha1 API group has been deprecated
starting from cluster version 1.8. You should switch to using
batch/v1beta1, instead, which is enabled by default in the API server.
Examples in this document use batch/v1beta1 in all examples.

[1]: https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/
2019-11-16 18:18:44 -08:00
Alessandro Marrella
14ef113368 Add EarnestResearch/dhall-packages to the users (#89)
We are happy users of dhall and dhall-kubernetes and we opensourced our bindings, I'm proposing to add them here for better discovery :)
2019-11-16 18:06:58 -08:00
Simon Jakobi
dea2c92017
Update Prelude.dhall to v10.0.0 (#80)
Now all the examples will build again with current versions
of dhall.
2019-09-16 18:52:23 +02:00