diff --git a/spawn_operator/spawn_operator/lib/mix/tasks/bonny.gen.manifest/customizer.ex b/spawn_operator/spawn_operator/lib/mix/tasks/bonny.gen.manifest/customizer.ex index 341177b5..29e70ddd 100644 --- a/spawn_operator/spawn_operator/lib/mix/tasks/bonny.gen.manifest/customizer.ex +++ b/spawn_operator/spawn_operator/lib/mix/tasks/bonny.gen.manifest/customizer.ex @@ -15,12 +15,8 @@ defmodule Mix.Tasks.Bonny.Gen.Manifest.SpawnOperatorCustomizer do def override(%{kind: "ServiceAccount"} = resource) do put_in(resource, ~w(metadata labels foo)a, "bar") end - """ - - @spec override(Bonny.Resource.t()) :: Bonny.Resource.t() - @doc """ - This function generated Deployment manifest like bellow: + If kind is equal to Deployment then this function generated Deployment manifest like bellow: ```yaml %{ @@ -83,9 +79,9 @@ defmodule Mix.Tasks.Bonny.Gen.Manifest.SpawnOperatorCustomizer do } } } - } - ``` """ + + @spec override(Bonny.Resource.t()) :: Bonny.Resource.t() def override(%{kind: "Deployment"} = resource) do %{resource | spec: %{resource.spec | template: update_template(resource)}} end diff --git a/spawn_operator/spawn_operator/lib/spawn_operator/k8s/configmap/activator_configmap.ex b/spawn_operator/spawn_operator/lib/spawn_operator/k8s/configmap/activator_configmap.ex index c6f91a0b..ebbe4459 100644 --- a/spawn_operator/spawn_operator/lib/spawn_operator/k8s/configmap/activator_configmap.ex +++ b/spawn_operator/spawn_operator/lib/spawn_operator/k8s/configmap/activator_configmap.ex @@ -2,4 +2,7 @@ defmodule SpawnOperator.K8s.ConfigMap.ActivatorCM do @moduledoc false @behaviour SpawnOperator.K8s.Manifest + + @impl true + def manifest(_resource, _opts \\ []), do: %{} end diff --git a/spawn_operator/spawn_operator/lib/spawn_operator/k8s/configmap/sidecar_configmap.ex b/spawn_operator/spawn_operator/lib/spawn_operator/k8s/configmap/sidecar_configmap.ex index 9bc4bbb0..b4e6a223 100644 --- a/spawn_operator/spawn_operator/lib/spawn_operator/k8s/configmap/sidecar_configmap.ex +++ b/spawn_operator/spawn_operator/lib/spawn_operator/k8s/configmap/sidecar_configmap.ex @@ -3,9 +3,6 @@ defmodule SpawnOperator.K8s.ConfigMap.SidecarCM do @behaviour SpawnOperator.K8s.Manifest - @impl true - def manifest(resource, _opts \\ []), do: gen_configmap(resource) - @doc """ ConfigMap is generated using following CRD labels: @@ -72,6 +69,9 @@ defmodule SpawnOperator.K8s.ConfigMap.SidecarCM do # Optional. Default "" spawn-eigr.io/sidecar-pubsub-nats-auth-jwt: "" """ + @impl true + def manifest(resource, _opts \\ []), do: gen_configmap(resource) + defp gen_configmap( %{ system: system, diff --git a/spawn_operator/spawn_operator/lib/spawn_operator/k8s/secret/actor_system_secret.ex b/spawn_operator/spawn_operator/lib/spawn_operator/k8s/secret/actor_system_secret.ex index 2bb0474a..d7f13e5a 100644 --- a/spawn_operator/spawn_operator/lib/spawn_operator/k8s/secret/actor_system_secret.ex +++ b/spawn_operator/spawn_operator/lib/spawn_operator/k8s/secret/actor_system_secret.ex @@ -35,7 +35,7 @@ defmodule SpawnOperator.K8s.Secret.ActorSystemSecret do } end - defp get_storage_options(_system, ns, params) do + defp get_storage_options(_system, _ns, params) do statestore = String.downcase(Map.get(params, "type", "native")) |> Base.encode64() pool_params = Map.get(params, "pool", %{}) pool_size = Map.get(pool_params, "size", "10") |> Base.encode64() diff --git a/spawn_operator/spawn_operator/lib/spawn_operator/k8s_conn.ex b/spawn_operator/spawn_operator/lib/spawn_operator/k8s_conn.ex index 577b8ec2..1ccdb080 100644 --- a/spawn_operator/spawn_operator/lib/spawn_operator/k8s_conn.ex +++ b/spawn_operator/spawn_operator/lib/spawn_operator/k8s_conn.ex @@ -12,16 +12,19 @@ defmodule SpawnOperator.K8sConn do @spec get(atom()) :: K8s.Conn.t() def get(:dev) do {:ok, conn} = K8s.Conn.from_file("~/.kube/config", context: "k3d-eigr-spawn") - conn + struct!(conn, insecure_skip_tls_verify: true) end - def get(:test), - do: %K8s.Conn{ + def get(:test) do + conn = %K8s.Conn{ discovery_driver: K8s.Discovery.Driver.File, discovery_opts: [config: "test/support/discovery.json"], http_provider: K8s.Client.DynamicHTTPProvider } + struct!(conn, insecure_skip_tls_verify: true) + end + def get(_) do K8s.Conn.from_service_account() |> then(fn diff --git a/spawn_operator/spawn_operator/lib/spawn_operator/operator.ex b/spawn_operator/spawn_operator/lib/spawn_operator/operator.ex index 00f52f97..06c69478 100644 --- a/spawn_operator/spawn_operator/lib/spawn_operator/operator.ex +++ b/spawn_operator/spawn_operator/lib/spawn_operator/operator.ex @@ -47,15 +47,15 @@ defmodule SpawnOperator.Operator do def controllers(watch_namespace, _opts) do [ %{ - query: K8s.Client.list("spawn-eigr.io/v1", "Activator", namespace: watch_namespace), + query: K8s.Client.watch("spawn-eigr.io/v1", "Activator", namespace: watch_namespace), controller: SpawnOperator.Controller.ActivatorController }, %{ - query: K8s.Client.list("spawn-eigr.io/v1", "ActorHost", namespace: watch_namespace), + query: K8s.Client.watch("spawn-eigr.io/v1", "ActorHost", namespace: watch_namespace), controller: SpawnOperator.Controller.ActorHostController }, %{ - query: K8s.Client.list("spawn-eigr.io/v1", "ActorSystem", namespace: watch_namespace), + query: K8s.Client.watch("spawn-eigr.io/v1", "ActorSystem", namespace: watch_namespace), controller: SpawnOperator.Controller.ActorSystemController } ] diff --git a/spawn_operator/spawn_operator/mix.exs b/spawn_operator/spawn_operator/mix.exs index 0029be08..c05df086 100644 --- a/spawn_operator/spawn_operator/mix.exs +++ b/spawn_operator/spawn_operator/mix.exs @@ -43,7 +43,7 @@ defmodule Operator.MixProject do [ {:bandit, "~> 0.5"}, {:bakeware, ">= 0.0.0", runtime: false}, - {:bonny, "~> 1.0.0"}, + {:bonny, "~> 1.1.0"}, {:spawn, path: "../../"} ] end