Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (32 sloc) 2.04 KB

ArgoCD bindings for dhall

This package contains bindings for using dhall to define ArgoCD resources.

How to define argocd resources with dhall

To define a argocd application, you can do:

let argocd =

let k8s =

in  argocd.Application::{
    , metadata = k8s.ObjectMeta::{ name = "guestbook" }
    , spec = argocd.ApplicationSpec::{
      , project = "default"
      , source =
            , repoURL = ""
            , path = "guestbook"
      , destination = argocd.DestinationSpec::{
        , server = "https://kubernetes.default.svc"
        , namespace = "default"

To apply the dhall file, you can do echo $filename | dhall-to-yaml --omit-empty | kubectl apply -f -

In dhall you can also refactor any of those strings as imports and reuse them across definitions.

See the example directory for a more complete definition of this pattern using our the higher level utilities defined in util.

How to use argocd to apply dhall templates

You can also use argocd to apply dhall templates in your kubernetes cluster. To do so, you need to install dhall-to-yaml as a plugin to the argocd repo server. You can do so by applying the kustomize template in the kustomize directory (you can further improve it by adding secrets, environment variables, etc.).

This will install a plugin called dhall-to-yaml that will look for an app.dhall file (or a different file if specified as environment variable). For convenience, our types and utilities already include a Dhall source spec that you can leverage.

You can’t perform that action at this time.