Skip to content

Commit

Permalink
Upgrade to upstream dhall-kubernetes
Browse files Browse the repository at this point in the history
------

Upstream `dhall-kubernetes` has returned to using the default behavior
of omitting empty Optionals instead of the `--omit-empty` behavior that
it had embraced earlier.

This change updates `dhall-prometheus-operator` to return to the use of
`Optional List X` instead of `List X` in turn.
  • Loading branch information
ari-becker committed Mar 23, 2020
1 parent 3b96185 commit 860f6e1
Show file tree
Hide file tree
Showing 29 changed files with 389 additions and 492 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eval "$(lorri direnv)"
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,25 @@ This project relies upon resources provided by the [`dhall-kubernetes`](https://
## Install
For stability, users are encouraged to import from a tagged release, not from the master branch, and to watch for new releases. This project does not yet have rigorous testing set up for it and new commits on the master branch are prone to break compatibility and are almost sure to change the import hash for the expression.
```
https://raw.githubusercontent.com/coralogix/dhall-prometheus-operator/v3.1.1/package.dhall sha256:1160d4c0f3d0f4750dd1644b2ba8351b197ebad4b1f577b42e7ae590f4706726
https://raw.githubusercontent.com/coralogix/dhall-prometheus-operator/v4.0.0/package.dhall sha256:bcfe5eed190f43f737a09bb2e40975cfd6fabc1f026c6475b012c263502a6210
```

## Example Usage
### Example ServiceMonitor
```dhall
let kubernetes = https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/4ad58156b7fdbbb6da0543d8b314df899feca077/defaults.dhall sha256:4450e23dc81975d111650e06c0238862944bf699537af6cbacac9c7e471dfabe
let Kubernetes = https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/506d633e382872346927b8cb9884d8b7382e6cab/package.dhall sha256:d9eac5668d5ed9cb3364c0a39721d4694e4247dad16d8a82827e4619ee1d6188

let Kubernetes = https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/4ad58156b7fdbbb6da0543d8b314df899feca077/types.dhall sha256:e48e21b807dad217a6c3e631fcaf3e950062310bfb4a8bbcecc330eb7b2f60ed

let PrometheusOperator = (https://raw.githubusercontent.com/coralogix/dhall-prometheus-operator/v3.1.1/package.dhall sha256:1160d4c0f3d0f4750dd1644b2ba8351b197ebad4b1f577b42e7ae590f4706726).v1
let PrometheusOperator = (https://raw.githubusercontent.com/coralogix/dhall-prometheus-operator/v4.0.0/package.dhall sha256:bcfe5eed190f43f737a09bb2e40975cfd6fabc1f026c6475b012c263502a6210).v1

in PrometheusOperator.ServiceMonitor::{
, metadata =
kubernetes.ObjectMeta // { name = "example" }
Kubernetes.ObjectMeta::{ name = "example" }
, spec =
PrometheusOperator.ServiceMonitorSpec::{
, selector =
kubernetes.LabelSelector
// { matchLabels =
toMap { app = "example" }
Kubernetes.LabelSelector::{
, matchLabels = Some
(toMap { app = "example" })
}
, endpoints =
[ PrometheusOperator.Endpoint.Union.TargetPort
Expand Down
2 changes: 1 addition & 1 deletion imports.dhall
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ Kubernetes =
https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/381306bcc3fd87aafe042c23bb66fe58227b85f4/1.15/package.dhall sha256:271494d6e3daba2a47d9d023188e35bf44c9c477a1cfbad1c589695a6b626e56
https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/506d633e382872346927b8cb9884d8b7382e6cab/package.dhall sha256:d9eac5668d5ed9cb3364c0a39721d4694e4247dad16d8a82827e4619ee1d6188
, Prelude =
https://raw.githubusercontent.com/dhall-lang/dhall-lang/v14.0.0/Prelude/package.dhall sha256:c1b3fc613aabfb64a9e17f6c0d70fe82016a030beedd79851730993e9083fde2
}
29 changes: 29 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
let
nixpkgs = import (
let
version = "ef4b914b113119b7a70cf90b37496413d85723a3";
in builtins.fetchTarball {
name = "nixpkgs-${version}";
url = "https://github.com/NixOS/nixpkgs/archive/${version}.tar.gz";
sha256 = "1flgwivn53vk04svj4za39gg6g6r7r92g3y201h8cml0604gsmg8";
}
) {};

dhall-haskell = import (
let
version = "1.30.0";
in nixpkgs.fetchFromGitHub {
owner = "dhall-lang";
repo = "dhall-haskell";
rev = version;
fetchSubmodules = true;
sha256 = "1a662vwv7azdz77a1lwblqlpavh6dnf5idna932vhimnd03pczv4";
}
);

in nixpkgs.mkShell {
buildInputs = [
dhall-haskell.dhall
nixpkgs.git
];
}
4 changes: 2 additions & 2 deletions v1/AlertingSpec.dhall
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
let AlertmanagerEndpoints = ./AlertmanagerEndpoints.dhall

let AlertingSpec =
{ Type = { alertmanagers : List AlertmanagerEndpoints.Type }
, default.alertmanagers = [] : List AlertmanagerEndpoints.Type
{ Type = { alertmanagers : Optional (List AlertmanagerEndpoints.Type) }
, default.alertmanagers = None (List AlertmanagerEndpoints.Type)
}

let test = AlertingSpec::{=}
Expand Down
33 changes: 13 additions & 20 deletions v1/Alertmanager.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,16 @@ let AlertmanagerSpec = ./AlertmanagerSpec.dhall

let AlertmanagerStatus = ./AlertmanagerStatus.dhall

let Alertmanager =
{ Type =
{ apiVersion : Text
, kind : Text
, metadata : Kubernetes.ObjectMeta.Type
, spec : AlertmanagerSpec.Type
, status : Optional AlertmanagerStatus.Type
}
, default =
{ apiVersion = "monitoring.coreos.com/v1"
, kind = "Alertmanager"
, spec = AlertmanagerSpec::{=}
, status = None AlertmanagerStatus.Type
}
}

let test =
Alertmanager::{ metadata = Kubernetes.ObjectMeta::{ name = "example" } }

in Alertmanager
in { Type =
{ apiVersion : Text
, kind : Text
, metadata : Kubernetes.ObjectMeta.Type
, spec : AlertmanagerSpec.Type
, status : Optional AlertmanagerStatus.Type
}
, default =
{ apiVersion = "monitoring.coreos.com/v1"
, kind = "Alertmanager"
, status = None AlertmanagerStatus.Type
}
}
46 changes: 18 additions & 28 deletions v1/AlertmanagerEndpoints.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,21 @@ let IntOrString = (../imports.dhall).Kubernetes.IntOrString

let TLSConfig = ./TLSConfig.dhall

let AlertmanagerEndpoints =
{ Type =
{ namespace : Text
, name : Text
, port : IntOrString
, scheme : Optional Text
, pathPrefix : Optional Text
, tlsConfig : Optional TLSConfig.Type
, bearerTokenFile : Optional Text
, apiVersion : Optional Text
}
, default =
{ scheme = None Text
, pathPrefix = None Text
, tlsConfig = None TLSConfig.Type
, bearerTokenFile = None Text
, apiVersion = None Text
}
}

let test =
AlertmanagerEndpoints::{
, namespace = "default"
, name = "example"
, port = IntOrString.String "example"
}

in AlertmanagerEndpoints
in { Type =
{ namespace : Text
, name : Text
, port : IntOrString
, scheme : Optional Text
, pathPrefix : Optional Text
, tlsConfig : Optional TLSConfig.Type
, bearerTokenFile : Optional Text
, apiVersion : Optional Text
}
, default =
{ scheme = None Text
, pathPrefix = None Text
, tlsConfig = None TLSConfig.Type
, bearerTokenFile = None Text
, apiVersion = None Text
}
}
10 changes: 5 additions & 5 deletions v1/AlertmanagerList.dhall
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
let ListMeta = (../imports.dhall).Kubernetes.ListMeta
let ListMeta = (../imports.dhall).Kubernetes.ListMeta.Type

let Alertmanager = ./Alertmanager.dhall

let AlertmanagerList =
{ Type =
{ apiVersion : Text
, kind : Text
, metadata : Optional ListMeta.Type
, items : List Alertmanager.Type
, metadata : Optional ListMeta
, items : Optional (List Alertmanager.Type)
}
, default =
{ apiVersion = "monitoring.coreos.com/v1"
, kind = "AlertmanagerList"
, metadata = None ListMeta.Type
, items = [] : List Alertmanager.Type
, metadata = None ListMeta
, items = None (List Alertmanager.Type)
}
}

Expand Down
41 changes: 21 additions & 20 deletions v1/AlertmanagerSpec.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,32 @@ let AlertmanagerSpec =
, tag : Optional Text
, sha : Optional Text
, baseImage : Optional Text
, imagePullSecrets : List Kubernetes.LocalObjectReference.Type
, secrets : List Text
, configMaps : List Text
, imagePullSecrets :
Optional (List Kubernetes.LocalObjectReference.Type)
, secrets : Optional (List Text)
, configMaps : Optional (List Text)
, configSecret : Optional Text
, logLevel : Optional Text
, logFormat : Optional Text
, replicas : Optional Natural
, retention : Optional Text
, storage : Optional StorageSpec
, volumes : List Kubernetes.Volume.Type
, volumeMounts : List Kubernetes.VolumeMount.Type
, volumes : Optional (List Kubernetes.Volume.Type)
, volumeMounts : Optional (List Kubernetes.VolumeMount.Type)
, externalUrl : Optional Text
, routePrefix : Optional Text
, paused : Optional Bool
, nodeSelector : Map Text Text
, nodeSelector : Optional (Map Text Text)
, resources : Optional Kubernetes.ResourceRequirements.Type
, affinity : Optional Kubernetes.Affinity.Type
, tolerations : List Kubernetes.Toleration.Type
, tolerations : Optional (List Kubernetes.Toleration.Type)
, securityContext : Optional Kubernetes.PodSecurityContext.Type
, serviceAccountName : Optional Text
, listenLocal : Optional Bool
, containers : List Kubernetes.Container.Type
, initContainers : List Kubernetes.Container.Type
, containers : Optional (List Kubernetes.Container.Type)
, initContainers : Optional (List Kubernetes.Container.Type)
, priorityClassName : Optional Text
, additionalPeers : List Text
, additionalPeers : Optional (List Text)
, portName : Optional Text
}
, default =
Expand All @@ -48,31 +49,31 @@ let AlertmanagerSpec =
, tag = None Text
, sha = None Text
, baseImage = None Text
, imagePullSecrets = [] : List Kubernetes.LocalObjectReference.Type
, secrets = [] : List Text
, configMaps = [] : List Text
, imagePullSecrets = None (List Kubernetes.LocalObjectReference.Type)
, secrets = None (List Text)
, configMaps = None (List Text)
, configSecret = None Text
, logLevel = None Text
, logFormat = None Text
, replicas = None Natural
, retention = None Text
, storage = None StorageSpec
, volumes = [] : List Kubernetes.Volume.Type
, volumeMounts = [] : List Kubernetes.VolumeMount.Type
, volumes = None (List Kubernetes.Volume.Type)
, volumeMounts = None (List Kubernetes.VolumeMount.Type)
, externalUrl = None Text
, routePrefix = None Text
, paused = None Bool
, nodeSelector = [] : Map Text Text
, nodeSelector = None (Map Text Text)
, resources = None Kubernetes.ResourceRequirements.Type
, affinity = None Kubernetes.Affinity.Type
, tolerations = [] : List Kubernetes.Toleration.Type
, tolerations = None (List Kubernetes.Toleration.Type)
, securityContext = None Kubernetes.PodSecurityContext.Type
, serviceAccountName = None Text
, listenLocal = None Bool
, containers = [] : List Kubernetes.Container.Type
, initContainers = [] : List Kubernetes.Container.Type
, containers = None (List Kubernetes.Container.Type)
, initContainers = None (List Kubernetes.Container.Type)
, priorityClassName = None Text
, additionalPeers = [] : List Text
, additionalPeers = None (List Text)
, portName = None Text
}
}
Expand Down
12 changes: 6 additions & 6 deletions v1/Endpoint.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let TLSConfig = ./TLSConfig.dhall
let Common =
{ path : Optional Text
, scheme : Optional Text
, params : Map Text Text
, params : Optional (Map Text Text)
, interval : Optional Text
, scrapeTimeout : Optional Text
, tlsConfig : Optional TLSConfig.Type
Expand All @@ -22,16 +22,16 @@ let Common =
, honorLabels : Optional Bool
, honorTimestamps : Optional Bool
, basicAuth : Optional BasicAuth.Type
, metricRelabelings : List RelabelConfig.Type
, relabelings : List RelabelConfig.Type
, metricRelabelings : Optional (List RelabelConfig.Type)
, relabelings : Optional (List RelabelConfig.Type)
, proxyUrl : Optional Text
}
: Type

let common =
{ path = None Text
, scheme = None Text
, params = [] : Map Text Text
, params = None (Map Text Text)
, interval = None Text
, scrapeTimeout = None Text
, tlsConfig = None TLSConfig.Type
Expand All @@ -40,8 +40,8 @@ let common =
, honorLabels = None Bool
, honorTimestamps = None Bool
, basicAuth = None BasicAuth.Type
, metricRelabelings = [] : List RelabelConfig.Type
, relabelings = [] : List RelabelConfig.Type
, metricRelabelings = None (List RelabelConfig.Type)
, relabelings = None (List RelabelConfig.Type)
, proxyUrl = None Text
}

Expand Down
63 changes: 29 additions & 34 deletions v1/PodMetricsEndpoint.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,32 @@ let Prelude = imports.Prelude

let RelabelConfig = (./RelabelConfig.dhall).Type

let PodMetricsEndpoint =
{ Type =
{ port : Optional Text
, targetPort : Optional Kubernetes.IntOrString
, path : Optional Text
, scheme : Optional Text
, params : Optional (Prelude.Map.Type Text Text)
, interval : Optional Text
, scrapeTimeout : Optional Text
, honorLabels : Optional Bool
, honorTimestamps : Optional Bool
, metricRelabelings : List RelabelConfig
, relabelings : List RelabelConfig
, proxyUrl : Optional Text
}
, default =
{ port = None Text
, targetPort = None Kubernetes.IntOrString
, path = None Text
, scheme = None Text
, params = None (Prelude.Map.Type Text Text)
, interval = None Text
, scrapeTimeout = None Text
, honorLabels = None Bool
, honorTimestamps = None Bool
, metricRelabelings = [] : List RelabelConfig
, relabelings = [] : List RelabelConfig
, proxyUrl = None Text
}
}

let test = PodMetricsEndpoint::{=}

in PodMetricsEndpoint
in { Type =
{ port : Optional Text
, targetPort : Optional Kubernetes.IntOrString
, path : Optional Text
, scheme : Optional Text
, params : Optional (Prelude.Map.Type Text Text)
, interval : Optional Text
, scrapeTimeout : Optional Text
, honorLabels : Optional Bool
, honorTimestamps : Optional Bool
, metricRelabelings : Optional (List RelabelConfig)
, relabelings : Optional (List RelabelConfig)
, proxyUrl : Optional Text
}
, default =
{ port = None Text
, targetPort = None Kubernetes.IntOrString
, path = None Text
, scheme = None Text
, params = None (Prelude.Map.Type Text Text)
, interval = None Text
, scrapeTimeout = None Text
, honorLabels = None Bool
, honorTimestamps = None Bool
, metricRelabelings = None (List RelabelConfig)
, relabelings = None (List RelabelConfig)
, proxyUrl = None Text
}
}
Loading

0 comments on commit 860f6e1

Please sign in to comment.