Skip to content

Commit

Permalink
chore: Handle secrets on spec (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalezzfelipe authored Aug 9, 2024
1 parent 5ac3578 commit dd4a850
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions bootstrap/crds/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ resource "kubernetes_manifest" "customresourcedefinition_cardanonodeports_demete
"properties" = {
"spec" = {
"properties" = {
"authToken" = {
"nullable" = true
"type" = "string"
}
"network" = {
"type" = "string"
}
Expand Down
6 changes: 5 additions & 1 deletion operator/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct CardanoNodePortSpec {
pub network: String,
pub version: String,
pub throughput_tier: String,
pub auth_token: Option<String>,
}

#[derive(Deserialize, Serialize, Clone, Default, Debug, JsonSchema)]
Expand All @@ -55,7 +56,10 @@ impl Context {
}

async fn reconcile(crd: Arc<CardanoNodePort>, ctx: Arc<Context>) -> Result<Action> {
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),
Expand Down

0 comments on commit dd4a850

Please sign in to comment.