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
This commit is contained in:
Fabrizio Ferrai 2019-05-01 19:13:18 +03:00 committed by GitHub
parent 5d11c98b86
commit 805b432df2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2099 changed files with 12798 additions and 7043 deletions

4
.gitignore vendored
View File

@ -1,2 +1,6 @@
.stack-work
swagger.json
.stylish-haskell.yaml
/result
/result-*
tmp

View File

@ -1,15 +1,22 @@
.PHONY: install build check default
default: build
README.md: docs/README.md.dhall
./scripts/build-readme.sh
build: README.md
mkdir -p types default
./scripts/convert.py "${OPENAPI_SPEC}"
dhall-kubernetes-generator "${OPENAPI_SPEC}"
dhall freeze --all --inplace ./types.dhall
dhall freeze --all --inplace ./typesUnion.dhall
dhall freeze --all --inplace ./defaults.dhall
check: build
LC_ALL=en_US.UTF-8 ./scripts/check-source.py
mkdir -p tmp
LC_ALL=en_US.UTF-8 ./scripts/build-examples.py tmp
install: build
cp -r types default "${out}"
cp -r types defaults "${out}"
cp types.dhall defaults.dhall typesUnion.dhall "${out}"
cp README.md "${out}"

364
README.md
View File

@ -25,240 +25,239 @@ all while being non-Turing complete, strongly typed and [strongly normalizing][n
(i.e.: reduces everything to a normal form, no matter how much abstraction you build),
so saving you from the *"oh-noes-I-made-my-config-in-code-and-now-its-too-abstract"* nightmare.
For a Dhall Tutorial, see the [readme of the project][dhall-lang],
For a Dhall Tutorial, see [the website][dhall-website], or the [readme of the project][dhall-lang],
or the [full tutorial][dhall-tutorial].
## Prerequisites
**NOTE**: `dhall-kubernetes` requires at least version `1.21.0` of [the interpreter](https://github.com/dhall-lang/dhall-haskell)
(version `6.0.0` of the language).
**NOTE**: `dhall-kubernetes` requires at least version `1.22.0` of [the interpreter](https://github.com/dhall-lang/dhall-haskell)
(version `7.0.0` of the language).
You can install the latest version with the following:
```bash
stack install dhall-1.21.0 dhall-json-1.2.7 --resolver=nightly-2019-04-16
stack install dhall-1.22.0 dhall-json-1.2.8 --resolver=nightly-2019-04-28
```
## Quickstart - main API
We provide a simple API for the most common cases (For a list, see the [api](./api) folder).
## Quickstart - a simple Deployment
Let's say we'd like to configure a Deployment exposing an `nginx` webserver.
In the following example, we:
1. Define a `config` for our service, by merging a [default config][default-deployment]
(with the Dhall record-merge operator `//`) with a record with our parameters.
2. In there we define the details of the Deployment we care about (note that we do the same
"merging with defaults" operation for our container as well, so we don't have to specify
all the parameters)
3. We call the [`mkDeployment`][mkDeployment] function on our `config`
1. Import the Kubernetes definitions as Dhall Types (the `types.dhall` file) from the local repo.
In your case you will want to replace the local path with a remote one, e.g.
`https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/0a4f0b87fbdd4b679853c81ff804bde7b44336cf/types.dhall`.
Note: the `sha256:..` is applied to some imports so that:
1. the import is cached locally after the first evaluation, with great time savings (and avoiding network calls)
2. prevent execution if the content of the file changes. This is a security feature, and you
can read more [in Dhall's "Security Guarantees" document][security-hashes]
2. Import the defaults for the above types.
Since _most_ of the fields in any definition are optional, for better ergonomics while
coding Dhall we have generated default values for all types, so we can just use the `//`
operator (right-biased record merge) to add our data to the default configuration.
The pattern looks something like this: `defaultValue // { ourDataHere = ..}`
3. Define the [Deployment][deployment] using this pattern (see the default [here][default-deployment])
and hardcoding the deployment details:
```haskell
-- examples/deployment.dhall
let config =
../api/Deployment/default
//
{ name = "nginx"
, replicas = 2
, containers =
[ ../api/Deployment/defaultContainer
//
{ name = "nginx"
, imageName = "nginx"
, imageTag = "1.15.3"
, port = [ 80 ] : Optional Natural
}
]
}
-- examples/deploymentSimple.dhall
in ../api/Deployment/mkDeployment config
let types =
../types.dhall sha256:1ac84a230c0fdd003b4db05157b11329d273217cc6837083eb30c9288a67c87f
let defaults =
../defaults.dhall sha256:2e3d2b5d5fb52d08b078e803fa88ac1ed0f788c6a4d6342621a76eb77afe40f4
let deployment
: types.Deployment
= defaults.Deployment
// { metadata =
defaults.ObjectMeta // { name = "nginx" }
, spec =
Some
( defaults.DeploymentSpec
// { replicas =
Some 2
, template =
defaults.PodTemplateSpec
// { metadata =
defaults.ObjectMeta // { name = "nginx" }
, spec =
Some
( defaults.PodSpec
// { containers =
[ defaults.Container
// { name =
"nginx"
, image =
Some "nginx:1.15.3"
, ports =
[ defaults.ContainerPort
// { containerPort = 80 }
]
}
]
}
)
}
}
)
}
in deployment
```
We then run this through `dhall-to-yaml` to generate our Kubernetes definition:
```bash
dhall-to-yaml --omitNull < deployment.dhall
dhall-to-yaml --omitEmpty < examples/deploymentSimple.dhall
```
And we get:
```yaml
## examples/out/deployment.yaml
## examples/out/deploymentSimple.yaml
apiVersion: apps/v1
kind: Deployment
spec:
revisionHistoryLimit: 20
selector:
matchLabels:
app: nginx
strategy:
rollingUpdate:
maxSurge: 5
maxUnavailable: 0
type: RollingUpdate
template:
spec:
containers:
- image: nginx:1.15.3
imagePullPolicy: Always
env: []
volumeMounts: []
resources:
limits:
cpu: 500m
requests:
cpu: 10m
name: nginx
ports:
- containerPort: 80
volumes: []
metadata:
name: nginx
labels:
app: nginx
replicas: 2
metadata:
name: nginx
```
## Advanced usage - raw API
## More modular: defining an Ingress
If the main API is not enough (e.g. the object you'd like to generate is not in the list),
you can just fall back on using the raw Types and defaults the library provides
(and Pull Request here your program afterwards!).
The above is cool, but hardcoding data is not that cool.
Let's say we want to generate an Ingress definition (for an [Nginx Ingress][nginx-ingress])
that contains TLS certs and routes for every service.
For more examples of using this API see the [`./examples` folder](./examples).
So in a more realistic deployment you'll probably want to define:
- some `MyService` type that contains the config settings relevant to your deployments
- some functions parametrized by this type, so that you can produce objects to send to k8s
by just applying these functions to `MyService` objects
In the [`types`](./types) folder you'll find the types for the Kubernetes definitions. E.g.
[here's][Ingress] the type for the Ingress.
This is useful because then you can define your `Service`s separately from the Kubernetes logic,
and reuse those objects for configuring other things (e.g. configuring the services themselves,
templating documentation, configuring Terraform deployments, you name it).
Since _most_ of the fields in all definitions are optional, for better
ergonomics while coding Dhall we also generate default values for all types, in
the [`default`](./default) folder. When some fields are required, the default value
is a function whose input is a record of required fields, that returns the object
with these fields set. E.g. the default for the Ingress is [this
function][Ingress-default].
As an example of that, next we'll define an Ingress (an [Nginx Ingress][nginx-ingress] in this case),
containing stuff like TLS certs and routes for every service - see the [type][Ingress] and [default][Ingress-default] for it.
Let's say we have a Service with the following configuration:
Things to note in the following example:
- we define the `Service` type inline in the file, but in your case you'll want to have a
separate `./Service.dhall` file (so you can share around the project)
- we define functions to create the TLS definitions and the routes, so that we can `map`
them over the list of services.
- we also defined the list of `services` inline, but you should instead return the
`mkIngress` function instead of applying it, so you can do something like
`dhall-to-yaml --omitEmpty <<< "./mkIngress.dhall ./myServices.dhall"`
```haskell
-- examples/myConfig.dhall
{ name = "foo"
, host = "foo.example.com"
, version = "1.0.1"
}
-- examples/ingress.dhall
```
let Prelude = ../Prelude.dhall
That has the following type:
```haskell
-- examples/Config.dhall
{ name : Text
, host : Text
, version : Text
}
let map = Prelude.`List`.map
```
let kv = Prelude.JSON.keyText
We can now expose this service out to the world with the Ingress:
let types =
../types.dhall sha256:1ac84a230c0fdd003b4db05157b11329d273217cc6837083eb30c9288a67c87f
```haskell
-- examples/ingressRaw.dhall
let defaults =
../defaults.dhall sha256:2e3d2b5d5fb52d08b078e803fa88ac1ed0f788c6a4d6342621a76eb77afe40f4
let Service = { name : Text, host : Text, version : Text }
-- Prelude imports
let map = (../Prelude.dhall).`List`.map
let services = [ { name = "foo", host = "foo.example.com", version = "2.3" } ]
-- dhall-kubernetes types and defaults
in let TLS = ../types/io.k8s.api.extensions.v1beta1.IngressTLS.dhall
in let Rule = ../types/io.k8s.api.extensions.v1beta1.IngressRule.dhall
in let RuleVal = ../types/io.k8s.api.extensions.v1beta1.HTTPIngressRuleValue.dhall
in let Spec = ../types/io.k8s.api.extensions.v1beta1.IngressSpec.dhall
in let Ingress = ../types/io.k8s.api.extensions.v1beta1.Ingress.dhall
in let defaultIngress = ../default/io.k8s.api.extensions.v1beta1.Ingress.dhall
in let defaultMeta = ../default/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall
in let defaultSpec = ../default/io.k8s.api.extensions.v1beta1.IngressSpec.dhall
in let IntOrString = ../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall
let makeTLS
: Service -> types.IngressTLS
= \(service : Service)
-> { hosts =
[ service.host ]
, secretName =
Some "${service.name}-certificate"
}
-- Our Service type
in let Service = ./Config.dhall
in let Config = { services : List Service }
-- A function to generate an ingress given a configuration
in let mkIngress : Config -> Ingress =
\(config : Config) ->
-- Given a service, make a TLS definition with their host and certificate
let makeTLS = \(service : Service) ->
{ hosts = Some [ service.host ]
, secretName = Some "${service.name}-certificate"
}
-- Given a service, make an Ingress Rule
in let makeRule = \(service : Service) ->
{ host = Some service.host
, http = Some
{ paths = [ { backend =
{ serviceName = service.name
, servicePort = IntOrString.Int 80
let makeRule
: Service -> types.IngressRule
= \(service : Service)
-> { host =
Some service.host
, http =
Some
{ paths =
[ { backend =
{ serviceName =
service.name
, servicePort =
types.IntOrString.Int 80
}
, path = None Text
, path =
None Text
}
]
}
}
}
}
-- Nginx ingress requires a default service as a catchall
in let defaultService =
{ name = "default"
, host = "default.example.com"
, version = " 1.0"
}
let mkIngress
: List Service -> types.Ingress
= \(inputServices : List Service)
-> let annotations =
[ kv "kubernetes.io/ingress.class" "nginx"
, kv "kubernetes.io/ingress.allow-http" "false"
]
-- List of services
in let services = config.services # [ defaultService ]
let defaultService =
{ name =
"default"
, host =
"default.example.com"
, version =
" 1.0"
}
-- Some metadata annotations
-- NOTE: `dhall-to-yaml` will generate a record with arbitrary keys from a list
-- of records where mapKey is the key and mapValue is the value of that key
in let genericRecord = List { mapKey : Text, mapValue : Text }
in let kv = \(k : Text) -> \(v : Text) -> { mapKey = k, mapValue = v }
let ingressServices = inputServices # [ defaultService ]
in let annotations = Some
[ kv "kubernetes.io/ingress.class" "nginx"
, kv "kubernetes.io/ingress.allow-http" "false"
]
let spec =
defaults.IngressSpec
// { tls =
map Service types.IngressTLS makeTLS ingressServices
, rules =
map Service types.IngressRule makeRule ingressServices
}
-- Generate spec from services
in let spec = defaultSpec //
{ tls = Some (map Service TLS makeTLS services)
, rules = Some (map Service Rule makeRule services)
}
in defaults.Ingress
// { metadata =
defaults.ObjectMeta
// { name = "nginx", annotations = annotations }
, spec =
Some spec
}
in defaultIngress
{ metadata = defaultMeta
{ name = "nginx" } //
{ annotations = annotations }
} //
{ spec = Some spec }
-- Here we import our example service, and generate the ingress with it
in mkIngress { services = [ ./myConfig.dhall ] }
in mkIngress services
```
As before we get the yaml out by running:
```bash
dhall-to-yaml --omitNull < ingress.yaml.dhall
dhall-to-yaml --omitEmpty < examples/ingress.dhall
```
Result:
```yaml
## examples/out/ingressRaw.yaml
## examples/out/ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
spec:
@ -290,6 +289,45 @@ metadata:
```
## FAQ
#### Can I generate a YAML file with many objects in it?
It is usual for k8s YAML files to include multiple objects separated by `---` ("documents" in YAML lingo),
so you might want to do it too.
If the objects have the same type, this is very easy: you return a Dhall list containing the
objects, and use the `--documents` flag, e.g.:
```bash
dhall-to-yaml --documents --omitEmpty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
```
If the objects are of different type, it's not possible to have separate documents in the same YAML file.
However, since [k8s has a builtin `List` type for these cases](https://github.com/kubernetes/kubernetes/blob/master/hack/testdata/list.yaml),
it's possible to use it together with the [union type of all k8s types that we generate][typesUnion].
So if we want to deploy e.g. a Deployment and a Service together, we can do:
```haskell
let k8s = ./typesUnion.dhall
in
{ apiVersion = "v1"
, kind = "List"
, items =
[ k8s.Deployment ./my-deployment.dhall
, k8s.Service ./my-service.dhall
]
}
```
## Projects Using `dhall-kubernetes`
* [dhall-prometheus-operator][dhall-prometheus-operator]: Provides types and default records for [Prometheus Operators][prometheus-operator].
## Development
### Updating the nixpkgs snapshot (and kubernetes version)
@ -322,19 +360,17 @@ If you make changes to `scripts/convert.py` or `docs/README.md.dhall`, you need
to run this command afterwards.
## Projects Using `dhall-kubernetes`
* [dhall-prometheus-operator][dhall-prometheus-operator]: Provides types and default records for [Prometheus Operators][prometheus-operator].
[hydra-project]: http://hydra.dhall-lang.org/project/dhall-kubernetes
[dhall-lang]: https://github.com/dhall-lang/dhall-lang
[dhall-website]: https://dhall-lang.org/
[security-hashes]: https://github.com/dhall-lang/dhall-lang/wiki/Safety-guarantees#code-injection
[typesUnion]: https://github.com/dhall-lang/dhall-kubernetes/blob/master/typesUnion.dhall
[kubernetes]: https://kubernetes.io/
[normalization]: https://en.wikipedia.org/wiki/Normalization_property_(abstract_rewriting)
[nginx-ingress]: https://github.com/kubernetes/ingress-nginx
[dhall-tutorial]: http://hackage.haskell.org/package/dhall-1.17.0/docs/Dhall-Tutorial.html
[default-deployment]: ./api/Deployment/default
[mkDeployment]: ./api/Deployment/mkDeployment
[dhall-tutorial]: http://hackage.haskell.org/package/dhall-1.21.0/docs/Dhall-Tutorial.html
[default-deployment]: ./defaults/io.k8s.api.apps.v1.Deployment.dhall
[deployment]: ./types/io.k8s.api.apps.v1.Deployment.dhall
[Ingress]: ./types/io.k8s.api.extensions.v1beta1.Ingress.dhall
[Ingress-default]: ./default/io.k8s.api.extensions.v1beta1.Ingress.dhall
[prometheus-operator]: https://github.com/coreos/prometheus-operator

View File

@ -1,13 +0,0 @@
{ name : Text
, imageName : Text
, imageTag : Text
, imagePullPolicy : Text
, minCPU : Natural
, maxCPU : Natural
, mounts : List ./Mount
, envVars : List { mapKey : Text, mapValue : Text }
, port : Optional Natural
, command : Optional (List Text)
, livenessProbe : Optional ./Probe
, readinessProbe : Optional ./Probe
}

View File

@ -1,10 +0,0 @@
{ name : Text
, replicas : Natural
, revisionHistoryLimit : Natural
, maxSurge : Natural
, maxUnavailable : Natural
, containers : List ./Container
, emptyVolumes : List { name : Text }
, secretVolumes : List { name : Text }
, pathVolumes : List { name : Text, path : Text }
}

View File

@ -1,4 +0,0 @@
{ mountPath : Text
, name : Text
, readOnly : Optional Bool
}

View File

@ -1,5 +0,0 @@
{ initial : Natural
, period : Natural
, port : Natural
, path : Text
}

View File

@ -1,22 +0,0 @@
let intOrString = ../../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall
in
{ deployment = ../../default/io.k8s.api.apps.v1.Deployment.dhall
, container = ../../default/io.k8s.api.core.v1.Container.dhall
, containerPort = ../../default/io.k8s.api.core.v1.ContainerPort.dhall
, podSpec = ../../default/io.k8s.api.core.v1.PodSpec.dhall
, spec = ../../default/io.k8s.api.apps.v1.DeploymentSpec.dhall
, template = ../../default/io.k8s.api.core.v1.PodTemplateSpec.dhall
, probe = ../../default/io.k8s.api.core.v1.Probe.dhall
, httpGet = ../../default/io.k8s.api.core.v1.HTTPGetAction.dhall
, envVar = ../../default/io.k8s.api.core.v1.EnvVar.dhall
, mount = ../../default/io.k8s.api.core.v1.VolumeMount.dhall
, volume = ../../default/io.k8s.api.core.v1.Volume.dhall
, secretVolume = ../../default/io.k8s.api.core.v1.SecretVolumeSource.dhall
, emptyVolume = ../../default/io.k8s.api.core.v1.EmptyDirVolumeSource.dhall
, pathVolume = ../../default/io.k8s.api.core.v1.HostPathVolumeSource.dhall
, meta = ../../default/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall
, selector = ../../default/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall
, Int = intOrString.Int
, String = intOrString.String
}

View File

@ -1,18 +0,0 @@
{ Deployment = ../../types/io.k8s.api.apps.v1.Deployment.dhall
, Container = ../../types/io.k8s.api.core.v1.Container.dhall
, ContainerPort = ../../types/io.k8s.api.core.v1.ContainerPort.dhall
, PodSpec = ../../types/io.k8s.api.core.v1.PodSpec.dhall
, RollingUpdate = ../../types/io.k8s.api.apps.v1.RollingUpdateDeployment.dhall
, Spec = ../../types/io.k8s.api.apps.v1.DeploymentSpec.dhall
, Strategy = ../../types/io.k8s.api.apps.v1.DeploymentStrategy.dhall
, Resources = ../../types/io.k8s.api.core.v1.ResourceRequirements.dhall
, Probe = ../../types/io.k8s.api.core.v1.Probe.dhall
, HttpGet = ../../types/io.k8s.api.core.v1.HTTPGetAction.dhall
, EnvVar = ../../types/io.k8s.api.core.v1.EnvVar.dhall
, Mount = ../../types/io.k8s.api.core.v1.VolumeMount.dhall
, Volume = ../../types/io.k8s.api.core.v1.Volume.dhall
, SecretVolume = ../../types/io.k8s.api.core.v1.SecretVolumeSource.dhall
, EmptyVolume = ../../types/io.k8s.api.core.v1.EmptyDirVolumeSource.dhall
, PathVolume = ../../types/io.k8s.api.core.v1.HostPathVolumeSource.dhall
, IntOrString = ../../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall
}

View File

@ -1,10 +0,0 @@
{ name = "CHANGEME"
, replicas = 1
, revisionHistoryLimit = 20
, maxSurge = 5
, maxUnavailable = 0
, containers = [] : List ./Container
, emptyVolumes = [] : List { name : Text }
, secretVolumes = [] : List { name : Text }
, pathVolumes = [] : List { name : Text, path : Text }
} : ./Deployment

View File

@ -1,13 +0,0 @@
{ name = "CHANGEME"
, imageName = "SOME_IMAGE"
, imageTag = "0.1"
, imagePullPolicy = "Always"
, minCPU = 10
, maxCPU = 500
, mounts = [] : List ./Mount
, envVars = [] : List { mapKey : Text, mapValue : Text }
, port = [] : Optional Natural
, command = [] : Optional (List Text)
, livenessProbe = [] : Optional ./Probe
, readinessProbe = [] : Optional ./Probe
} : ./Container

View File

@ -1,168 +0,0 @@
-- Prelude
let Prelude = ../../Prelude.dhall
in let map = Prelude.`List`.map
in let kv = Prelude.JSON.keyText
-- Kubernetes types and defaults
in let Types = ./RawTypes
in let default = ./RawDefaults
-- Types for dynamic records
in let KV = { mapKey : Text, mapValue : Text }
in let ListKV = List KV
in let mkProbe : ./Probe → Optional Types.Probe =
λ(probe : ./Probe) →
Some
(default.probe //
{ initialDelaySeconds = Some probe.initial
, periodSeconds = Some probe.period
, httpGet = Some
(default.httpGet
{ port = default.Int probe.port } //
{ path = Some probe.path
})
})
in let mkEnvVar : KV → Types.EnvVar =
λ(var : KV) →
default.envVar
{ name = var.mapKey } //
{ value = Some var.mapValue }
in let mkEmptyVolume : { name : Text } → Types.Volume =
λ(vol : { name : Text }) →
default.volume
{ name = vol.name } //
{ emptyDir = Some default.emptyVolume }
in let mkSecretVolume : { name : Text } → Types.Volume =
λ(vol : { name : Text }) →
default.volume
{ name = vol.name } //
{ secret = Some
(default.secretVolume // { secretName = Some vol.name } )
}
in let mkPathVolume : { name : Text, path : Text } → Types.Volume =
λ(vol : { name : Text, path : Text }) →
default.volume
{ name = vol.name } //
{ hostPath = Some
(default.pathVolume { path = vol.path })
}
in let mkMount : ./Mount → Types.Mount =
λ(mount : ./Mount) →
default.mount
{ mountPath = mount.mountPath
, name = mount.name
} //
{ readOnly = mount.readOnly }
in let mkContainer : ./Container → Types.Container =
λ(container : ./Container) →
default.container
{ name = container.name } //
{ image = Some "${container.imageName}:${container.imageTag}"
, imagePullPolicy = Some container.imagePullPolicy
, ports = Optional/fold
Natural
container.port
(Optional (List Types.ContainerPort))
(λ(port : Natural) → Some
[(default.containerPort { containerPort = port })])
(None (List Types.ContainerPort))
, resources = Some
{ limits = Some [kv "cpu" "${Natural/show container.maxCPU}m"]
, requests = Some [kv "cpu" "${Natural/show container.minCPU}m"]
}
, command = container.command
, volumeMounts = Some
(map ./Mount Types.Mount mkMount container.mounts)
-- Poll the container to see if the it's alive or we should restart it
, livenessProbe = Optional/fold
./Probe
container.livenessProbe
(Optional Types.Probe)
mkProbe
(None Types.Probe)
-- Poll the container to see that it's ready for requests
, readinessProbe = Optional/fold
./Probe
container.readinessProbe
(Optional Types.Probe)
mkProbe
(None Types.Probe)
, env = Some
(map { mapKey : Text , mapValue : Text } Types.EnvVar mkEnvVar container.envVars)
}
in let mkDeployment : ./Deployment → Types.Deployment =
λ(deployment : ./Deployment) →
let selector = Some [kv "app" deployment.name]
in let emptyVolumes = map { name : Text } Types.Volume mkEmptyVolume deployment.emptyVolumes
in let secretVolumes = map { name : Text } Types.Volume mkSecretVolume deployment.secretVolumes
in let pathVolumes = map { name : Text, path : Text } Types.Volume mkPathVolume deployment.pathVolumes
in let volumes = Some (emptyVolumes # secretVolumes # pathVolumes)
in let spec = default.spec
{ selector = default.selector // { matchLabels = selector }
, template = default.template
{ metadata = default.meta
{ name = deployment.name } // { labels = selector }
} //
{ spec = Some (default.podSpec
{ containers = map ./Container Types.Container mkContainer deployment.containers
} //
{ volumes = volumes
})
}
} //
{ replicas = Some deployment.replicas
-- Don't keep all the ReplicaSets
, revisionHistoryLimit = Some deployment.revisionHistoryLimit
, strategy = Some
-- Control the RollingUpdate so the app is always available. For more info see:
-- https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
{ type = Some "RollingUpdate"
, rollingUpdate = Some
{ maxSurge = Some (default.Int deployment.maxSurge)
, maxUnavailable = Some (default.Int deployment.maxUnavailable)
}
}
}
in default.deployment
{ metadata = default.meta { name = deployment.name }
} //
{ spec = Some spec
}
in mkDeployment

View File

@ -1,9 +0,0 @@
let intOrString = ../../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall
in
{ service = ../../default/io.k8s.api.core.v1.Service.dhall
, spec = ../../default/io.k8s.api.core.v1.ServiceSpec.dhall
, port = ../../default/io.k8s.api.core.v1.ServicePort.dhall
, meta = ../../default/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall
, Int = intOrString.Int
, String = intOrString.String
}

View File

@ -1,5 +0,0 @@
{ Service = ../../types/io.k8s.api.core.v1.Service.dhall
, Spec = ../../types/io.k8s.api.core.v1.ServiceSpec.dhall
, Port = ../../types/io.k8s.api.core.v1.ServicePort.dhall
, IntOrString = ../../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall
}

View File

@ -1,6 +0,0 @@
{ name : Text
, annotations : List { mapKey : Text, mapValue : Text }
, containerPort : Natural
, outPort : Natural
, type : ./ServiceType
}

View File

@ -1,5 +0,0 @@
< ClusterIP : {}
| NodePort : {}
| LoadBalancer : {}
| ExternalName : {}
>

View File

@ -1,6 +0,0 @@
{ name = "CHANGEME"
, annotations = [] : List { mapKey : Text, mapValue : Text }
, containerPort = 8080
, outPort = 80
, type = (./ServiceType).NodePort {=}
}

View File

@ -1,50 +0,0 @@
-- Prelude
let Prelude = ../../Prelude.dhall
in let kv = Prelude.JSON.keyText
-- Kubernetes types and defaults
in let Types = ./RawTypes
in let default = ./RawDefaults
-- Types for dynamic records
in let KV = { mapKey : Text, mapValue : Text }
in let ListKV = List KV
in let mkService : ./Service → Types.Service =
λ(service : ./Service) →
let selector = Some [kv "app" service.name]
in let meta = default.meta
{ name = service.name } //
{ labels = selector
, annotations = Some service.annotations
}
-- Handlers for the ServiceType union
in let handlers =
{ ClusterIP = \(_ : {}) -> "ClusterIP"
, NodePort = \(_ : {}) -> "NodePort"
, LoadBalancer = \(_ : {}) -> "LoadBalancer"
, ExternalName = \(_ : {}) -> "ExternalName"
}
in let spec = default.spec //
{ type = Some (merge handlers service.type : Text)
, ports = Some
[ default.port
{ port = service.outPort } //
{ targetPort = Some (default.Int service.containerPort) }
]
, selector = selector
}
in default.service
{ metadata = meta
} //
{ spec = Some spec
} : Types.Service
in mkService

View File

@ -1,4 +0,0 @@
\(_params : {name : (Text)}) ->
{ name = _params.name
, rules = ([] : Optional (List ../types/io.k8s.api.admissionregistration.v1alpha1.Rule.dhall))
} : ../types/io.k8s.api.admissionregistration.v1alpha1.Initializer.dhall

View File

@ -1,6 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("admissionregistration.k8s.io/v1alpha1" : Text)
, initializers = ([] : Optional (List ../types/io.k8s.api.admissionregistration.v1alpha1.Initializer.dhall))
, kind = ("InitializerConfiguration" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.admissionregistration.v1alpha1.InitializerConfiguration.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.admissionregistration.v1alpha1.InitializerConfiguration.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("admissionregistration.k8s.io/v1alpha1" : Text)
, items = _params.items
, kind = ("InitializerConfigurationList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.admissionregistration.v1alpha1.InitializerConfigurationList.dhall

View File

@ -1,4 +0,0 @@
{ apiGroups = ([] : Optional (List Text))
, apiVersions = ([] : Optional (List Text))
, resources = ([] : Optional (List Text))
} : ../types/io.k8s.api.admissionregistration.v1alpha1.Rule.dhall

View File

@ -1,6 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("admissionregistration.k8s.io/v1beta1" : Text)
, kind = ("MutatingWebhookConfiguration" : Text)
, metadata = _params.metadata
, webhooks = ([] : Optional (List ../types/io.k8s.api.admissionregistration.v1beta1.Webhook.dhall))
} : ../types/io.k8s.api.admissionregistration.v1beta1.MutatingWebhookConfiguration.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.admissionregistration.v1beta1.MutatingWebhookConfiguration.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("admissionregistration.k8s.io/v1beta1" : Text)
, items = _params.items
, kind = ("MutatingWebhookConfigurationList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.admissionregistration.v1beta1.MutatingWebhookConfigurationList.dhall

View File

@ -1,5 +0,0 @@
{ apiGroups = ([] : Optional (List Text))
, apiVersions = ([] : Optional (List Text))
, operations = ([] : Optional (List Text))
, resources = ([] : Optional (List Text))
} : ../types/io.k8s.api.admissionregistration.v1beta1.RuleWithOperations.dhall

View File

@ -1,5 +0,0 @@
\(_params : {name : (Text), namespace : (Text)}) ->
{ name = _params.name
, namespace = _params.namespace
, path = ([] : Optional (Text))
} : ../types/io.k8s.api.admissionregistration.v1beta1.ServiceReference.dhall

View File

@ -1,6 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("admissionregistration.k8s.io/v1beta1" : Text)
, kind = ("ValidatingWebhookConfiguration" : Text)
, metadata = _params.metadata
, webhooks = ([] : Optional (List ../types/io.k8s.api.admissionregistration.v1beta1.Webhook.dhall))
} : ../types/io.k8s.api.admissionregistration.v1beta1.ValidatingWebhookConfiguration.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.admissionregistration.v1beta1.ValidatingWebhookConfiguration.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("admissionregistration.k8s.io/v1beta1" : Text)
, items = _params.items
, kind = ("ValidatingWebhookConfigurationList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.admissionregistration.v1beta1.ValidatingWebhookConfigurationList.dhall

View File

@ -1,8 +0,0 @@
\(_params : {clientConfig : (../types/io.k8s.api.admissionregistration.v1beta1.WebhookClientConfig.dhall), name : (Text)}) ->
{ clientConfig = _params.clientConfig
, failurePolicy = ([] : Optional (Text))
, name = _params.name
, namespaceSelector = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall))
, rules = ([] : Optional (List ../types/io.k8s.api.admissionregistration.v1beta1.RuleWithOperations.dhall))
, sideEffects = ([] : Optional (Text))
} : ../types/io.k8s.api.admissionregistration.v1beta1.Webhook.dhall

View File

@ -1,4 +0,0 @@
{ caBundle = ([] : Optional (Text))
, service = ([] : Optional (../types/io.k8s.api.admissionregistration.v1beta1.ServiceReference.dhall))
, url = ([] : Optional (Text))
} : ../types/io.k8s.api.admissionregistration.v1beta1.WebhookClientConfig.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall), revision : (Natural)}) ->
{ apiVersion = ("apps/v1" : Text)
, data = ([] : Optional (../types/io.k8s.apimachinery.pkg.runtime.RawExtension.dhall))
, kind = ("ControllerRevision" : Text)
, metadata = _params.metadata
, revision = _params.revision
} : ../types/io.k8s.api.apps.v1.ControllerRevision.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1.ControllerRevision.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1" : Text)
, items = _params.items
, kind = ("ControllerRevisionList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1.ControllerRevisionList.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("apps/v1" : Text)
, kind = ("DaemonSet" : Text)
, metadata = _params.metadata
, spec = ([] : Optional (../types/io.k8s.api.apps.v1.DaemonSetSpec.dhall))
, status = ([] : Optional (../types/io.k8s.api.apps.v1.DaemonSetStatus.dhall))
} : ../types/io.k8s.api.apps.v1.DaemonSet.dhall

View File

@ -1,7 +0,0 @@
\(_params : {status : (Text), type : (Text)}) ->
{ lastTransitionTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, message = ([] : Optional (Text))
, reason = ([] : Optional (Text))
, status = _params.status
, type = _params.type
} : ../types/io.k8s.api.apps.v1.DaemonSetCondition.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1.DaemonSet.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1" : Text)
, items = _params.items
, kind = ("DaemonSetList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1.DaemonSetList.dhall

View File

@ -1,7 +0,0 @@
\(_params : {selector : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall), template : (../types/io.k8s.api.core.v1.PodTemplateSpec.dhall)}) ->
{ minReadySeconds = ([] : Optional (Natural))
, revisionHistoryLimit = ([] : Optional (Natural))
, selector = _params.selector
, template = _params.template
, updateStrategy = ([] : Optional (../types/io.k8s.api.apps.v1.DaemonSetUpdateStrategy.dhall))
} : ../types/io.k8s.api.apps.v1.DaemonSetSpec.dhall

View File

@ -1,12 +0,0 @@
\(_params : {currentNumberScheduled : (Natural), desiredNumberScheduled : (Natural), numberMisscheduled : (Natural), numberReady : (Natural)}) ->
{ collisionCount = ([] : Optional (Natural))
, conditions = ([] : Optional (List ../types/io.k8s.api.apps.v1.DaemonSetCondition.dhall))
, currentNumberScheduled = _params.currentNumberScheduled
, desiredNumberScheduled = _params.desiredNumberScheduled
, numberAvailable = ([] : Optional (Natural))
, numberMisscheduled = _params.numberMisscheduled
, numberReady = _params.numberReady
, numberUnavailable = ([] : Optional (Natural))
, observedGeneration = ([] : Optional (Natural))
, updatedNumberScheduled = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1.DaemonSetStatus.dhall

View File

@ -1,3 +0,0 @@
{ rollingUpdate = ([] : Optional (../types/io.k8s.api.apps.v1.RollingUpdateDaemonSet.dhall))
, type = ([] : Optional (Text))
} : ../types/io.k8s.api.apps.v1.DaemonSetUpdateStrategy.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("apps/v1" : Text)
, kind = ("Deployment" : Text)
, metadata = _params.metadata
, spec = ([] : Optional (../types/io.k8s.api.apps.v1.DeploymentSpec.dhall))
, status = ([] : Optional (../types/io.k8s.api.apps.v1.DeploymentStatus.dhall))
} : ../types/io.k8s.api.apps.v1.Deployment.dhall

View File

@ -1,8 +0,0 @@
\(_params : {status : (Text), type : (Text)}) ->
{ lastTransitionTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, lastUpdateTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, message = ([] : Optional (Text))
, reason = ([] : Optional (Text))
, status = _params.status
, type = _params.type
} : ../types/io.k8s.api.apps.v1.DeploymentCondition.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1.Deployment.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1" : Text)
, items = _params.items
, kind = ("DeploymentList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1.DeploymentList.dhall

View File

@ -1,10 +0,0 @@
\(_params : {selector : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall), template : (../types/io.k8s.api.core.v1.PodTemplateSpec.dhall)}) ->
{ minReadySeconds = ([] : Optional (Natural))
, paused = ([] : Optional (Bool))
, progressDeadlineSeconds = ([] : Optional (Natural))
, replicas = ([] : Optional (Natural))
, revisionHistoryLimit = ([] : Optional (Natural))
, selector = _params.selector
, strategy = ([] : Optional (../types/io.k8s.api.apps.v1.DeploymentStrategy.dhall))
, template = _params.template
} : ../types/io.k8s.api.apps.v1.DeploymentSpec.dhall

View File

@ -1,9 +0,0 @@
{ availableReplicas = ([] : Optional (Natural))
, collisionCount = ([] : Optional (Natural))
, conditions = ([] : Optional (List ../types/io.k8s.api.apps.v1.DeploymentCondition.dhall))
, observedGeneration = ([] : Optional (Natural))
, readyReplicas = ([] : Optional (Natural))
, replicas = ([] : Optional (Natural))
, unavailableReplicas = ([] : Optional (Natural))
, updatedReplicas = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1.DeploymentStatus.dhall

View File

@ -1,3 +0,0 @@
{ rollingUpdate = ([] : Optional (../types/io.k8s.api.apps.v1.RollingUpdateDeployment.dhall))
, type = ([] : Optional (Text))
} : ../types/io.k8s.api.apps.v1.DeploymentStrategy.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("apps/v1" : Text)
, kind = ("ReplicaSet" : Text)
, metadata = _params.metadata
, spec = ([] : Optional (../types/io.k8s.api.apps.v1.ReplicaSetSpec.dhall))
, status = ([] : Optional (../types/io.k8s.api.apps.v1.ReplicaSetStatus.dhall))
} : ../types/io.k8s.api.apps.v1.ReplicaSet.dhall

View File

@ -1,7 +0,0 @@
\(_params : {status : (Text), type : (Text)}) ->
{ lastTransitionTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, message = ([] : Optional (Text))
, reason = ([] : Optional (Text))
, status = _params.status
, type = _params.type
} : ../types/io.k8s.api.apps.v1.ReplicaSetCondition.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1.ReplicaSet.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1" : Text)
, items = _params.items
, kind = ("ReplicaSetList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1.ReplicaSetList.dhall

View File

@ -1,6 +0,0 @@
\(_params : {selector : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall)}) ->
{ minReadySeconds = ([] : Optional (Natural))
, replicas = ([] : Optional (Natural))
, selector = _params.selector
, template = ([] : Optional (../types/io.k8s.api.core.v1.PodTemplateSpec.dhall))
} : ../types/io.k8s.api.apps.v1.ReplicaSetSpec.dhall

View File

@ -1,8 +0,0 @@
\(_params : {replicas : (Natural)}) ->
{ availableReplicas = ([] : Optional (Natural))
, conditions = ([] : Optional (List ../types/io.k8s.api.apps.v1.ReplicaSetCondition.dhall))
, fullyLabeledReplicas = ([] : Optional (Natural))
, observedGeneration = ([] : Optional (Natural))
, readyReplicas = ([] : Optional (Natural))
, replicas = _params.replicas
} : ../types/io.k8s.api.apps.v1.ReplicaSetStatus.dhall

View File

@ -1,2 +0,0 @@
{ maxUnavailable = ([] : Optional (../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall))
} : ../types/io.k8s.api.apps.v1.RollingUpdateDaemonSet.dhall

View File

@ -1,3 +0,0 @@
{ maxSurge = ([] : Optional (../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall))
, maxUnavailable = ([] : Optional (../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall))
} : ../types/io.k8s.api.apps.v1.RollingUpdateDeployment.dhall

View File

@ -1,2 +0,0 @@
{ partition = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1.RollingUpdateStatefulSetStrategy.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("apps/v1" : Text)
, kind = ("StatefulSet" : Text)
, metadata = _params.metadata
, spec = ([] : Optional (../types/io.k8s.api.apps.v1.StatefulSetSpec.dhall))
, status = ([] : Optional (../types/io.k8s.api.apps.v1.StatefulSetStatus.dhall))
} : ../types/io.k8s.api.apps.v1.StatefulSet.dhall

View File

@ -1,7 +0,0 @@
\(_params : {status : (Text), type : (Text)}) ->
{ lastTransitionTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, message = ([] : Optional (Text))
, reason = ([] : Optional (Text))
, status = _params.status
, type = _params.type
} : ../types/io.k8s.api.apps.v1.StatefulSetCondition.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1.StatefulSet.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1" : Text)
, items = _params.items
, kind = ("StatefulSetList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1.StatefulSetList.dhall

View File

@ -1,10 +0,0 @@
\(_params : {selector : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall), serviceName : (Text), template : (../types/io.k8s.api.core.v1.PodTemplateSpec.dhall)}) ->
{ podManagementPolicy = ([] : Optional (Text))
, replicas = ([] : Optional (Natural))
, revisionHistoryLimit = ([] : Optional (Natural))
, selector = _params.selector
, serviceName = _params.serviceName
, template = _params.template
, updateStrategy = ([] : Optional (../types/io.k8s.api.apps.v1.StatefulSetUpdateStrategy.dhall))
, volumeClaimTemplates = ([] : Optional (List ../types/io.k8s.api.core.v1.PersistentVolumeClaim.dhall))
} : ../types/io.k8s.api.apps.v1.StatefulSetSpec.dhall

View File

@ -1,11 +0,0 @@
\(_params : {replicas : (Natural)}) ->
{ collisionCount = ([] : Optional (Natural))
, conditions = ([] : Optional (List ../types/io.k8s.api.apps.v1.StatefulSetCondition.dhall))
, currentReplicas = ([] : Optional (Natural))
, currentRevision = ([] : Optional (Text))
, observedGeneration = ([] : Optional (Natural))
, readyReplicas = ([] : Optional (Natural))
, replicas = _params.replicas
, updateRevision = ([] : Optional (Text))
, updatedReplicas = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1.StatefulSetStatus.dhall

View File

@ -1,3 +0,0 @@
{ rollingUpdate = ([] : Optional (../types/io.k8s.api.apps.v1.RollingUpdateStatefulSetStrategy.dhall))
, type = ([] : Optional (Text))
} : ../types/io.k8s.api.apps.v1.StatefulSetUpdateStrategy.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall), revision : (Natural)}) ->
{ apiVersion = ("apps/v1beta1" : Text)
, data = ([] : Optional (../types/io.k8s.apimachinery.pkg.runtime.RawExtension.dhall))
, kind = ("ControllerRevision" : Text)
, metadata = _params.metadata
, revision = _params.revision
} : ../types/io.k8s.api.apps.v1beta1.ControllerRevision.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1beta1.ControllerRevision.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta1" : Text)
, items = _params.items
, kind = ("ControllerRevisionList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1beta1.ControllerRevisionList.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta1" : Text)
, kind = ("Deployment" : Text)
, metadata = _params.metadata
, spec = ([] : Optional (../types/io.k8s.api.apps.v1beta1.DeploymentSpec.dhall))
, status = ([] : Optional (../types/io.k8s.api.apps.v1beta1.DeploymentStatus.dhall))
} : ../types/io.k8s.api.apps.v1beta1.Deployment.dhall

View File

@ -1,8 +0,0 @@
\(_params : {status : (Text), type : (Text)}) ->
{ lastTransitionTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, lastUpdateTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, message = ([] : Optional (Text))
, reason = ([] : Optional (Text))
, status = _params.status
, type = _params.type
} : ../types/io.k8s.api.apps.v1beta1.DeploymentCondition.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1beta1.Deployment.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta1" : Text)
, items = _params.items
, kind = ("DeploymentList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1beta1.DeploymentList.dhall

View File

@ -1,7 +0,0 @@
\(_params : {name : (Text), rollbackTo : (../types/io.k8s.api.apps.v1beta1.RollbackConfig.dhall)}) ->
{ apiVersion = ("apps/v1beta1" : Text)
, kind = ("DeploymentRollback" : Text)
, name = _params.name
, rollbackTo = _params.rollbackTo
, updatedAnnotations = ([] : Optional ((List {mapKey : Text, mapValue : Text})))
} : ../types/io.k8s.api.apps.v1beta1.DeploymentRollback.dhall

View File

@ -1,11 +0,0 @@
\(_params : {template : (../types/io.k8s.api.core.v1.PodTemplateSpec.dhall)}) ->
{ minReadySeconds = ([] : Optional (Natural))
, paused = ([] : Optional (Bool))
, progressDeadlineSeconds = ([] : Optional (Natural))
, replicas = ([] : Optional (Natural))
, revisionHistoryLimit = ([] : Optional (Natural))
, rollbackTo = ([] : Optional (../types/io.k8s.api.apps.v1beta1.RollbackConfig.dhall))
, selector = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall))
, strategy = ([] : Optional (../types/io.k8s.api.apps.v1beta1.DeploymentStrategy.dhall))
, template = _params.template
} : ../types/io.k8s.api.apps.v1beta1.DeploymentSpec.dhall

View File

@ -1,9 +0,0 @@
{ availableReplicas = ([] : Optional (Natural))
, collisionCount = ([] : Optional (Natural))
, conditions = ([] : Optional (List ../types/io.k8s.api.apps.v1beta1.DeploymentCondition.dhall))
, observedGeneration = ([] : Optional (Natural))
, readyReplicas = ([] : Optional (Natural))
, replicas = ([] : Optional (Natural))
, unavailableReplicas = ([] : Optional (Natural))
, updatedReplicas = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1beta1.DeploymentStatus.dhall

View File

@ -1,3 +0,0 @@
{ rollingUpdate = ([] : Optional (../types/io.k8s.api.apps.v1beta1.RollingUpdateDeployment.dhall))
, type = ([] : Optional (Text))
} : ../types/io.k8s.api.apps.v1beta1.DeploymentStrategy.dhall

View File

@ -1,2 +0,0 @@
{ revision = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1beta1.RollbackConfig.dhall

View File

@ -1,3 +0,0 @@
{ maxSurge = ([] : Optional (../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall))
, maxUnavailable = ([] : Optional (../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall))
} : ../types/io.k8s.api.apps.v1beta1.RollingUpdateDeployment.dhall

View File

@ -1,2 +0,0 @@
{ partition = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1beta1.RollingUpdateStatefulSetStrategy.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta1" : Text)
, kind = ("Scale" : Text)
, metadata = _params.metadata
, spec = ([] : Optional (../types/io.k8s.api.apps.v1beta1.ScaleSpec.dhall))
, status = ([] : Optional (../types/io.k8s.api.apps.v1beta1.ScaleStatus.dhall))
} : ../types/io.k8s.api.apps.v1beta1.Scale.dhall

View File

@ -1,2 +0,0 @@
{ replicas = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1beta1.ScaleSpec.dhall

View File

@ -1,5 +0,0 @@
\(_params : {replicas : (Natural)}) ->
{ replicas = _params.replicas
, selector = ([] : Optional ((List {mapKey : Text, mapValue : Text})))
, targetSelector = ([] : Optional (Text))
} : ../types/io.k8s.api.apps.v1beta1.ScaleStatus.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta1" : Text)
, kind = ("StatefulSet" : Text)
, metadata = _params.metadata
, spec = ([] : Optional (../types/io.k8s.api.apps.v1beta1.StatefulSetSpec.dhall))
, status = ([] : Optional (../types/io.k8s.api.apps.v1beta1.StatefulSetStatus.dhall))
} : ../types/io.k8s.api.apps.v1beta1.StatefulSet.dhall

View File

@ -1,7 +0,0 @@
\(_params : {status : (Text), type : (Text)}) ->
{ lastTransitionTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, message = ([] : Optional (Text))
, reason = ([] : Optional (Text))
, status = _params.status
, type = _params.type
} : ../types/io.k8s.api.apps.v1beta1.StatefulSetCondition.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1beta1.StatefulSet.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta1" : Text)
, items = _params.items
, kind = ("StatefulSetList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1beta1.StatefulSetList.dhall

View File

@ -1,10 +0,0 @@
\(_params : {serviceName : (Text), template : (../types/io.k8s.api.core.v1.PodTemplateSpec.dhall)}) ->
{ podManagementPolicy = ([] : Optional (Text))
, replicas = ([] : Optional (Natural))
, revisionHistoryLimit = ([] : Optional (Natural))
, selector = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall))
, serviceName = _params.serviceName
, template = _params.template
, updateStrategy = ([] : Optional (../types/io.k8s.api.apps.v1beta1.StatefulSetUpdateStrategy.dhall))
, volumeClaimTemplates = ([] : Optional (List ../types/io.k8s.api.core.v1.PersistentVolumeClaim.dhall))
} : ../types/io.k8s.api.apps.v1beta1.StatefulSetSpec.dhall

View File

@ -1,11 +0,0 @@
\(_params : {replicas : (Natural)}) ->
{ collisionCount = ([] : Optional (Natural))
, conditions = ([] : Optional (List ../types/io.k8s.api.apps.v1beta1.StatefulSetCondition.dhall))
, currentReplicas = ([] : Optional (Natural))
, currentRevision = ([] : Optional (Text))
, observedGeneration = ([] : Optional (Natural))
, readyReplicas = ([] : Optional (Natural))
, replicas = _params.replicas
, updateRevision = ([] : Optional (Text))
, updatedReplicas = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1beta1.StatefulSetStatus.dhall

View File

@ -1,3 +0,0 @@
{ rollingUpdate = ([] : Optional (../types/io.k8s.api.apps.v1beta1.RollingUpdateStatefulSetStrategy.dhall))
, type = ([] : Optional (Text))
} : ../types/io.k8s.api.apps.v1beta1.StatefulSetUpdateStrategy.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall), revision : (Natural)}) ->
{ apiVersion = ("apps/v1beta2" : Text)
, data = ([] : Optional (../types/io.k8s.apimachinery.pkg.runtime.RawExtension.dhall))
, kind = ("ControllerRevision" : Text)
, metadata = _params.metadata
, revision = _params.revision
} : ../types/io.k8s.api.apps.v1beta2.ControllerRevision.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1beta2.ControllerRevision.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta2" : Text)
, items = _params.items
, kind = ("ControllerRevisionList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1beta2.ControllerRevisionList.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta2" : Text)
, kind = ("DaemonSet" : Text)
, metadata = _params.metadata
, spec = ([] : Optional (../types/io.k8s.api.apps.v1beta2.DaemonSetSpec.dhall))
, status = ([] : Optional (../types/io.k8s.api.apps.v1beta2.DaemonSetStatus.dhall))
} : ../types/io.k8s.api.apps.v1beta2.DaemonSet.dhall

View File

@ -1,7 +0,0 @@
\(_params : {status : (Text), type : (Text)}) ->
{ lastTransitionTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, message = ([] : Optional (Text))
, reason = ([] : Optional (Text))
, status = _params.status
, type = _params.type
} : ../types/io.k8s.api.apps.v1beta2.DaemonSetCondition.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1beta2.DaemonSet.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta2" : Text)
, items = _params.items
, kind = ("DaemonSetList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1beta2.DaemonSetList.dhall

View File

@ -1,7 +0,0 @@
\(_params : {selector : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall), template : (../types/io.k8s.api.core.v1.PodTemplateSpec.dhall)}) ->
{ minReadySeconds = ([] : Optional (Natural))
, revisionHistoryLimit = ([] : Optional (Natural))
, selector = _params.selector
, template = _params.template
, updateStrategy = ([] : Optional (../types/io.k8s.api.apps.v1beta2.DaemonSetUpdateStrategy.dhall))
} : ../types/io.k8s.api.apps.v1beta2.DaemonSetSpec.dhall

View File

@ -1,12 +0,0 @@
\(_params : {currentNumberScheduled : (Natural), desiredNumberScheduled : (Natural), numberMisscheduled : (Natural), numberReady : (Natural)}) ->
{ collisionCount = ([] : Optional (Natural))
, conditions = ([] : Optional (List ../types/io.k8s.api.apps.v1beta2.DaemonSetCondition.dhall))
, currentNumberScheduled = _params.currentNumberScheduled
, desiredNumberScheduled = _params.desiredNumberScheduled
, numberAvailable = ([] : Optional (Natural))
, numberMisscheduled = _params.numberMisscheduled
, numberReady = _params.numberReady
, numberUnavailable = ([] : Optional (Natural))
, observedGeneration = ([] : Optional (Natural))
, updatedNumberScheduled = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1beta2.DaemonSetStatus.dhall

View File

@ -1,3 +0,0 @@
{ rollingUpdate = ([] : Optional (../types/io.k8s.api.apps.v1beta2.RollingUpdateDaemonSet.dhall))
, type = ([] : Optional (Text))
} : ../types/io.k8s.api.apps.v1beta2.DaemonSetUpdateStrategy.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta2" : Text)
, kind = ("Deployment" : Text)
, metadata = _params.metadata
, spec = ([] : Optional (../types/io.k8s.api.apps.v1beta2.DeploymentSpec.dhall))
, status = ([] : Optional (../types/io.k8s.api.apps.v1beta2.DeploymentStatus.dhall))
} : ../types/io.k8s.api.apps.v1beta2.Deployment.dhall

View File

@ -1,8 +0,0 @@
\(_params : {status : (Text), type : (Text)}) ->
{ lastTransitionTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, lastUpdateTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, message = ([] : Optional (Text))
, reason = ([] : Optional (Text))
, status = _params.status
, type = _params.type
} : ../types/io.k8s.api.apps.v1beta2.DeploymentCondition.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1beta2.Deployment.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta2" : Text)
, items = _params.items
, kind = ("DeploymentList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1beta2.DeploymentList.dhall

View File

@ -1,10 +0,0 @@
\(_params : {selector : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall), template : (../types/io.k8s.api.core.v1.PodTemplateSpec.dhall)}) ->
{ minReadySeconds = ([] : Optional (Natural))
, paused = ([] : Optional (Bool))
, progressDeadlineSeconds = ([] : Optional (Natural))
, replicas = ([] : Optional (Natural))
, revisionHistoryLimit = ([] : Optional (Natural))
, selector = _params.selector
, strategy = ([] : Optional (../types/io.k8s.api.apps.v1beta2.DeploymentStrategy.dhall))
, template = _params.template
} : ../types/io.k8s.api.apps.v1beta2.DeploymentSpec.dhall

View File

@ -1,9 +0,0 @@
{ availableReplicas = ([] : Optional (Natural))
, collisionCount = ([] : Optional (Natural))
, conditions = ([] : Optional (List ../types/io.k8s.api.apps.v1beta2.DeploymentCondition.dhall))
, observedGeneration = ([] : Optional (Natural))
, readyReplicas = ([] : Optional (Natural))
, replicas = ([] : Optional (Natural))
, unavailableReplicas = ([] : Optional (Natural))
, updatedReplicas = ([] : Optional (Natural))
} : ../types/io.k8s.api.apps.v1beta2.DeploymentStatus.dhall

View File

@ -1,3 +0,0 @@
{ rollingUpdate = ([] : Optional (../types/io.k8s.api.apps.v1beta2.RollingUpdateDeployment.dhall))
, type = ([] : Optional (Text))
} : ../types/io.k8s.api.apps.v1beta2.DeploymentStrategy.dhall

View File

@ -1,7 +0,0 @@
\(_params : {metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta2" : Text)
, kind = ("ReplicaSet" : Text)
, metadata = _params.metadata
, spec = ([] : Optional (../types/io.k8s.api.apps.v1beta2.ReplicaSetSpec.dhall))
, status = ([] : Optional (../types/io.k8s.api.apps.v1beta2.ReplicaSetStatus.dhall))
} : ../types/io.k8s.api.apps.v1beta2.ReplicaSet.dhall

View File

@ -1,7 +0,0 @@
\(_params : {status : (Text), type : (Text)}) ->
{ lastTransitionTime = ([] : Optional (../types/io.k8s.apimachinery.pkg.apis.meta.v1.Time.dhall))
, message = ([] : Optional (Text))
, reason = ([] : Optional (Text))
, status = _params.status
, type = _params.type
} : ../types/io.k8s.api.apps.v1beta2.ReplicaSetCondition.dhall

View File

@ -1,6 +0,0 @@
\(_params : {items : (List ../types/io.k8s.api.apps.v1beta2.ReplicaSet.dhall), metadata : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta.dhall)}) ->
{ apiVersion = ("apps/v1beta2" : Text)
, items = _params.items
, kind = ("ReplicaSetList" : Text)
, metadata = _params.metadata
} : ../types/io.k8s.api.apps.v1beta2.ReplicaSetList.dhall

View File

@ -1,6 +0,0 @@
\(_params : {selector : (../types/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.dhall)}) ->
{ minReadySeconds = ([] : Optional (Natural))
, replicas = ([] : Optional (Natural))
, selector = _params.selector
, template = ([] : Optional (../types/io.k8s.api.core.v1.PodTemplateSpec.dhall))
} : ../types/io.k8s.api.apps.v1beta2.ReplicaSetSpec.dhall

View File

@ -1,8 +0,0 @@
\(_params : {replicas : (Natural)}) ->
{ availableReplicas = ([] : Optional (Natural))
, conditions = ([] : Optional (List ../types/io.k8s.api.apps.v1beta2.ReplicaSetCondition.dhall))
, fullyLabeledReplicas = ([] : Optional (Natural))
, observedGeneration = ([] : Optional (Natural))
, readyReplicas = ([] : Optional (Natural))
, replicas = _params.replicas
} : ../types/io.k8s.api.apps.v1beta2.ReplicaSetStatus.dhall

View File

@ -1,2 +0,0 @@
{ maxUnavailable = ([] : Optional (../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall))
} : ../types/io.k8s.api.apps.v1beta2.RollingUpdateDaemonSet.dhall

View File

@ -1,3 +0,0 @@
{ maxSurge = ([] : Optional (../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall))
, maxUnavailable = ([] : Optional (../types/io.k8s.apimachinery.pkg.util.intstr.IntOrString.dhall))
} : ../types/io.k8s.api.apps.v1beta2.RollingUpdateDeployment.dhall

Some files were not shown because too many files have changed in this diff Show More