Skip to content

Commit

Permalink
Generate a dummy secret file for the operator
Browse files Browse the repository at this point in the history
This secret is then used by the operator to connect to the external API.
  • Loading branch information
edenreich committed Jun 18, 2024
1 parent eae800a commit f376771
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/k8s-codegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ fn generate_rbac_files(resources: Vec<String>, kubernetes_operator_group: &str)
generate_role_binding_file_content();
generate_cluster_role_binding_file_content();
generate_operator_deployment_file();
generate_operator_secret_file();
}

#[derive(Template)]
Expand Down Expand Up @@ -905,6 +906,19 @@ fn generate_operator_deployment_file() {
write_to_file("manifests/operator/deployment.yaml".to_string(), content);
}

#[derive(Template)]
#[template(path = "manifest_operator_secret.jinja")]
struct OperatorSecretTemplate {}

fn generate_operator_secret_file() {
if get_ignored_files().contains(&"manifests/operator/secret.yaml".to_string()) {
return;
}

let content = OperatorSecretTemplate {}.render().unwrap();
write_to_file("manifests/operator/secret.yaml".to_string(), content);
}

#[derive(Template, Deserialize, Serialize)]
#[template(path = "manifest_example.jinja")]
struct ExampleTemplate {
Expand Down
8 changes: 8 additions & 0 deletions crates/k8s-codegen/templates/manifest_operator_secret.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Secret
metadata:
name: operator-secret
type: Opaque
stringData:
access_token: ''
1 change: 1 addition & 0 deletions manifests/operator/secret.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f376771

Please sign in to comment.