Skip to content

Commit a70daa9

Browse files
chore: Handle secrets on spec (#63)
* chore: Handle secrets on spec * Generate crd
1 parent 0ba116f commit a70daa9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

bootstrap/crds/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ resource "kubernetes_manifest" "customresourcedefinition_ogmiosports_demeter_run
6060
"properties" = {
6161
"spec" = {
6262
"properties" = {
63+
"authToken" = {
64+
"nullable" = true
65+
"type" = "string"
66+
}
6367
"network" = {
6468
"type" = "string"
6569
}

operator/src/controller.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub struct OgmiosPortSpec {
3737
pub version: u8,
3838
// throughput should be 0, 1, 2
3939
pub throughput_tier: String,
40+
pub auth_token: Option<String>,
4041
}
4142

4243
#[derive(Deserialize, Serialize, Clone, Default, Debug, JsonSchema)]
@@ -58,7 +59,10 @@ impl Context {
5859
}
5960

6061
async fn reconcile(crd: Arc<OgmiosPort>, ctx: Arc<Context>) -> Result<Action> {
61-
let key = build_api_key(&crd).await?;
62+
let key = match &crd.spec.auth_token {
63+
Some(api_key) => api_key.clone(),
64+
None => build_api_key(&crd).await?,
65+
};
6266

6367
let (hostname, hostname_key) = build_hostname(&crd.spec.network, &crd.spec.version, &key);
6468

0 commit comments

Comments
 (0)