Overboard


Overboard

Overboard is a library providing strongly typed builders over kubernetes configuration. It allows you to retain a declarative style to your configuration while putting the full power of the F# programming language in your hands.

Overboard outputs plain Kubernetes YAML or JSON resource config files, so no need to change what you already have.

Why?

Defining infrastructure as code can get complicated. Infrastructure code can run up to thousands of lines of configuration files. We then add layer upon layer of tools on top of this to manage the complexity while trying to keep our structured text correct and understandable.

The problems being solved by layers of tooling on top of mountains of yaml are the following:

These are all problems that mature languages have solved decades ago. Instead of layering new tools on top of YAML files, what if we instead used a declarative programming language to define our configuration? Overboard enables this approach for Kubernetes.

Feature summary

Getting started

Show me the code!

Of course. Say we have a file called infra.fsx.

// infra.fsx
// include the Overboard package from Nuget
#r "nuget:Overboard"

// open  the namespaces for the resources you need
open Overboard.Common
open Overboard.Workloads

// define the deployment Kubernetes resource
let theDeployment = k8s {
    deployment {
        "my-overboard-deployment"
        replicas 2
        add_matchLabel ("app", "nginx")
        pod {
            _labels [("app", "nginx")]
            container {
                name "nginx"
                image "nginx:latest"
            }
        }
    }
}

// write your YAML file to disk
KubeCtlWriter.toYamlFile theDeployment "deployment.yaml"

That's it! You now have a kubernetes config file for a deployment.

dotnet fsi infra.fsx
kubectl apply -f deployment.yaml

Ready to try it yourself? Try the hello-world tutorial. To explore more examples, check out the How-to or Tutorials section.

Example use-cases

  1. Template out repeat config as a function. See the Generate dynamic config how-to.
  2. Fetch data from databases, APIs, environment variables, git, or wherever else to generate Kubernetes config.
  3. Package up common infrastructure patterns and ship them to teams as Nuget packages.
  4. Easily build CLI tools to output collections of Kubernetes config for development teams.
  5. Let your imagination ship out.

About this documentation

The docs follow the guidance from The documentation system.

Generation is done using FSharp.Formatting.

To run the docs locally, navigate to this /overboard root folder and run the following command:

dotnet fsdocs watch --eval

About the logo

Ship by Aleksandr Vector from Noun Project

namespace Overboard
namespace Overboard.Common
val theDeployment: obj
val container: ContainerBuilder
<summary> A single application container that you want to run within a pod. https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#Container </summary>