From dd4a8503ad8ba474a97d04a9a71927201e9087e0 Mon Sep 17 00:00:00 2001 From: Felipe Gonzalez Date: Fri, 9 Aug 2024 18:34:36 -0300 Subject: [PATCH] chore: Handle secrets on spec (#55) --- bootstrap/crds/main.tf | 4 ++++ operator/src/controller.rs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bootstrap/crds/main.tf b/bootstrap/crds/main.tf index 05a3152..a5e0290 100644 --- a/bootstrap/crds/main.tf +++ b/bootstrap/crds/main.tf @@ -55,6 +55,10 @@ resource "kubernetes_manifest" "customresourcedefinition_cardanonodeports_demete "properties" = { "spec" = { "properties" = { + "authToken" = { + "nullable" = true + "type" = "string" + } "network" = { "type" = "string" } diff --git a/operator/src/controller.rs b/operator/src/controller.rs index f9866c8..6eeb091 100644 --- a/operator/src/controller.rs +++ b/operator/src/controller.rs @@ -35,6 +35,7 @@ pub struct CardanoNodePortSpec { pub network: String, pub version: String, pub throughput_tier: String, + pub auth_token: Option, } #[derive(Deserialize, Serialize, Clone, Default, Debug, JsonSchema)] @@ -55,7 +56,10 @@ impl Context { } async fn reconcile(crd: Arc, ctx: Arc) -> Result { - let key = build_api_key(&crd).await?; + let key = match &crd.spec.auth_token { + Some(key) => key.clone(), + None => build_api_key(&crd).await?, + }; let status = CardanoNodePortStatus { authenticated_endpoint_url: build_hostname(&key),