Last active
June 21, 2019 19:09
-
-
Save coryodaniel/f889a309f4ea06b8e7f8316c6b299716 to your computer and use it in GitHub Desktop.
K8s.Controller to k8s client?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Thinking about moving controller functionality from Bonny to K8s. | |
# Currently k8s is very focused around HTTP, but controllers are a common concept, so YMMV. | |
# This may be a piece of yarn, and end up pulling too much operator functionality. | |
# In that case, I'm using this for spit balling the API for Bonny v1. | |
# Start a new controller w/ default | |
K8s.Controller.start("foo.example.com/v1", :bars, mod: BarController) | |
K8s.Controller.start("foo.example.com/v1", :bars, | |
mod: BarController, | |
cluster: :default, | |
namespace: "foo", # if applicable support :all? | |
label_selectors: %{}, | |
field_selectors: %{}, | |
reconcile_every: 30 # seconds | |
) | |
# Options: | |
# - handler module | |
# - reconcile every | |
# - cluster name (for Discovery) | |
# - namespace | |
# - labelSelectors and fieldSelectors to narrow a controller to specific | |
defmodule K8s.Controller do | |
# Adds @behaviour and overridable add/1, modify/1, delete/1, reconcile/1 functions | |
defmacro __using__(_), do: nil | |
def start(groupVersion, kind, opts) do | |
# spawns a linked process to watch/reconcile | |
end | |
end | |
K8s.Controller.start("foo.example.com/v1", :bars, mod: BarController) | |
defmodule BarController do | |
use K8s.Controller | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment