From e6f39eab217b78904536e4eff8742353dd08a697 Mon Sep 17 00:00:00 2001 From: bom Date: Fri, 10 May 2024 15:24:29 +0200 Subject: [PATCH 1/3] Add support for hetzner csi --- doc/ProvsK3sBuild.md | 19 ++++++++++------- src/main/python/ddadevops/domain/provs_k3s.py | 21 ++++++++++++++++++- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/doc/ProvsK3sBuild.md b/doc/ProvsK3sBuild.md index 95aa5b8..b959dcc 100644 --- a/doc/ProvsK3sBuild.md +++ b/doc/ProvsK3sBuild.md @@ -13,14 +13,17 @@ classDiagram ## Input -| name | description | default | -| ----------------------------- | ----------------------------------------------------------------- | --------- | -| k3s_provision_user | the user used to provision k3s | "root" | -| k3s_letsencrypt_email | email address used for letsencrypt | | -| k3s_letsencrypt_endpoint | letsencrypt endpoint. Valid values are staging, prod | "staging" | -| k3s_app_filename_to_provision | an k8s manifest to apply imediately after k3s setup was sucessful | | -| k3s_enable_echo | provision the echo app on k3s. Valid values are true, false | "false" | -| k3s_provs_template | use a individual template for provs config | None | +| name | description | default | +| --------------------------------- | ----------------------------------------------------------------- | --------- | +| k3s_provision_user | the user used to provision k3s | "root" | +| k3s_letsencrypt_email | email address used for letsencrypt | | +| k3s_letsencrypt_endpoint | letsencrypt endpoint. Valid values are staging, prod | "staging" | +| k3s_app_filename_to_provision | an k8s manifest to apply imediately after k3s setup was sucessful | | +| k3s_enable_echo | provision the echo app on k3s. Valid values are true, false | "false" | +| k3s_provs_template | use a individual template for provs config | None | +| k3s_enable_hetzner_csi | enable hetzner csi | False | +| k3s_hetzner_api_token | hetzner_api_token | None | +| k3s_hetzner_encryption_passphrase | encryption passphrase for volumes | None | ### Credentials Mapping defaults diff --git a/src/main/python/ddadevops/domain/provs_k3s.py b/src/main/python/ddadevops/domain/provs_k3s.py index 4c95d38..5ecc0e6 100644 --- a/src/main/python/ddadevops/domain/provs_k3s.py +++ b/src/main/python/ddadevops/domain/provs_k3s.py @@ -20,6 +20,14 @@ CONFIG_CERTMANAGER = """certmanager: """ CONFIG_ECHO = """echo: $echo """ +CONFIG_HETZNER_CSI = """hetzner: + hcloudApiToken: + source: "PLAIN" # PLAIN, GOPASS or PROMPT + parameter: $hcloud_api # the api key for the hetzner cloud + encryptionPassphrase: + source: "PLAIN" # PLAIN, GOPASS or PROMPT + parameter: $encryption # the encryption passphrase for created volumes +""" class K3s(Validateable): @@ -28,8 +36,11 @@ class K3s(Validateable): self.k3s_letsencrypt_email = inp.get("k3s_letsencrypt_email") self.k3s_letsencrypt_endpoint = inp.get("k3s_letsencrypt_endpoint", "staging") self.k3s_app_filename_to_provision = inp.get("k3s_app_filename_to_provision") - self.k3s_enable_echo = inp.get("k3s_enable_echo", "false") + self.k3s_enable_echo = inp.get("k3s_enable_echo", None) self.k3s_provs_template = inp.get("k3s_provs_template", None) + self.k3s_enable_hetzner_csi = inp.get("k3s_enable_hetzner_csi", False) + self.k3s_hetzner_api_token = inp.get("k3s_hetzner_api_token", None) + self.k3s_hetzner_encryption_passphrase = inp.get("k3s_hetzner_encryption_passphrase", None) self.provision_dns: Optional[DnsRecord] = None def validate(self) -> List[str]: @@ -37,6 +48,9 @@ class K3s(Validateable): result += self.__validate_is_not_empty__("k3s_letsencrypt_email") result += self.__validate_is_not_empty__("k3s_letsencrypt_endpoint") result += self.__validate_is_not_empty__("k3s_app_filename_to_provision") + if self.k3s_enable_hetzner_csi: + result += self.__validate_is_not_empty__("k3s_hetzner_api_token") + result += self.__validate_is_not_empty__("k3s_hetzner_encryption_passphrase") if self.provision_dns: result += self.provision_dns.validate() return result @@ -61,6 +75,9 @@ class K3s(Validateable): substitutes["letsencrypt_endpoint"] = self.k3s_letsencrypt_endpoint if self.k3s_enable_echo is not None: substitutes["echo"] = self.k3s_enable_echo + if self.k3s_enable_hetzner_csi: + substitutes["hcloud_api"] = self.k3s_hetzner_api_token + substitutes["encryption"] = self.k3s_hetzner_encryption_passphrase return self.__config_template__().substitute(substitutes) def command(self, devops: Devops): @@ -89,4 +106,6 @@ class K3s(Validateable): template_text += CONFIG_IPV4 if self.provision_dns.ipv6 is not None: template_text += CONFIG_IPV6 + if self.k3s_enable_hetzner_csi: + template_text += CONFIG_HETZNER_CSI return Template(template_text) From 4d8dc95d8e8fed99ff6348e697d4ac4ca1e500e4 Mon Sep 17 00:00:00 2001 From: bom Date: Fri, 10 May 2024 15:25:58 +0200 Subject: [PATCH 2/3] release: 4.12.0 --- build.py | 2 +- infrastructure/backup/build.py | 2 +- infrastructure/clj-cljs/build.py | 2 +- infrastructure/clj/build.py | 2 +- infrastructure/ddadevops/build.py | 2 +- infrastructure/dind/build.py | 2 +- infrastructure/kotlin/build.py | 2 +- infrastructure/python/build.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.py b/build.py index 7fddb95..0dcd06c 100644 --- a/build.py +++ b/build.py @@ -33,7 +33,7 @@ default_task = "dev" name = "ddadevops" MODULE = "not-used" PROJECT_ROOT_PATH = "." -version = "4.11.11-dev" +version = "4.12.0" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] diff --git a/infrastructure/backup/build.py b/infrastructure/backup/build.py index d2e4cd3..fe50d1e 100644 --- a/infrastructure/backup/build.py +++ b/infrastructure/backup/build.py @@ -7,7 +7,7 @@ import logging name = 'dda-backup' MODULE = 'NOT_SET' PROJECT_ROOT_PATH = '../..' -version = "4.11.11-dev" +version = "4.12.0" @init diff --git a/infrastructure/clj-cljs/build.py b/infrastructure/clj-cljs/build.py index 15561ae..b4edddb 100644 --- a/infrastructure/clj-cljs/build.py +++ b/infrastructure/clj-cljs/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "clj-cljs" PROJECT_ROOT_PATH = "../.." -version = "4.11.11-dev" +version = "4.12.0" @init def initialize(project): diff --git a/infrastructure/clj/build.py b/infrastructure/clj/build.py index 2f1a4d9..ea06a31 100644 --- a/infrastructure/clj/build.py +++ b/infrastructure/clj/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "clj" PROJECT_ROOT_PATH = "../.." -version = "4.11.11-dev" +version = "4.12.0" @init def initialize(project): diff --git a/infrastructure/ddadevops/build.py b/infrastructure/ddadevops/build.py index 33406f9..8554bef 100644 --- a/infrastructure/ddadevops/build.py +++ b/infrastructure/ddadevops/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "ddadevops" PROJECT_ROOT_PATH = "../.." -version = "4.11.11-dev" +version = "4.12.0" @init diff --git a/infrastructure/dind/build.py b/infrastructure/dind/build.py index 884fdd3..9201902 100644 --- a/infrastructure/dind/build.py +++ b/infrastructure/dind/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "dind" PROJECT_ROOT_PATH = "../.." -version = "4.11.11-dev" +version = "4.12.0" @init diff --git a/infrastructure/kotlin/build.py b/infrastructure/kotlin/build.py index 358960b..eaee6af 100644 --- a/infrastructure/kotlin/build.py +++ b/infrastructure/kotlin/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "kotlin" PROJECT_ROOT_PATH = "../.." -version = "4.11.11-dev" +version = "4.12.0" @init diff --git a/infrastructure/python/build.py b/infrastructure/python/build.py index ace48f8..9d48213 100644 --- a/infrastructure/python/build.py +++ b/infrastructure/python/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "python" PROJECT_ROOT_PATH = "../.." -version = "4.11.11-dev" +version = "4.12.0" @init From 6093d160e8ef2e6a4422a42cc155bf398cf845f2 Mon Sep 17 00:00:00 2001 From: bom Date: Fri, 10 May 2024 15:25:58 +0200 Subject: [PATCH 3/3] bump version to: 4.12.1-dev --- build.py | 2 +- infrastructure/backup/build.py | 2 +- infrastructure/clj-cljs/build.py | 2 +- infrastructure/clj/build.py | 2 +- infrastructure/ddadevops/build.py | 2 +- infrastructure/dind/build.py | 2 +- infrastructure/kotlin/build.py | 2 +- infrastructure/python/build.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.py b/build.py index 0dcd06c..53f7b3d 100644 --- a/build.py +++ b/build.py @@ -33,7 +33,7 @@ default_task = "dev" name = "ddadevops" MODULE = "not-used" PROJECT_ROOT_PATH = "." -version = "4.12.0" +version = "4.12.1-dev" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] diff --git a/infrastructure/backup/build.py b/infrastructure/backup/build.py index fe50d1e..79c2836 100644 --- a/infrastructure/backup/build.py +++ b/infrastructure/backup/build.py @@ -7,7 +7,7 @@ import logging name = 'dda-backup' MODULE = 'NOT_SET' PROJECT_ROOT_PATH = '../..' -version = "4.12.0" +version = "4.12.1-dev" @init diff --git a/infrastructure/clj-cljs/build.py b/infrastructure/clj-cljs/build.py index b4edddb..d025179 100644 --- a/infrastructure/clj-cljs/build.py +++ b/infrastructure/clj-cljs/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "clj-cljs" PROJECT_ROOT_PATH = "../.." -version = "4.12.0" +version = "4.12.1-dev" @init def initialize(project): diff --git a/infrastructure/clj/build.py b/infrastructure/clj/build.py index ea06a31..7ce3838 100644 --- a/infrastructure/clj/build.py +++ b/infrastructure/clj/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "clj" PROJECT_ROOT_PATH = "../.." -version = "4.12.0" +version = "4.12.1-dev" @init def initialize(project): diff --git a/infrastructure/ddadevops/build.py b/infrastructure/ddadevops/build.py index 8554bef..e746b20 100644 --- a/infrastructure/ddadevops/build.py +++ b/infrastructure/ddadevops/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "ddadevops" PROJECT_ROOT_PATH = "../.." -version = "4.12.0" +version = "4.12.1-dev" @init diff --git a/infrastructure/dind/build.py b/infrastructure/dind/build.py index 9201902..3521d3f 100644 --- a/infrastructure/dind/build.py +++ b/infrastructure/dind/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "dind" PROJECT_ROOT_PATH = "../.." -version = "4.12.0" +version = "4.12.1-dev" @init diff --git a/infrastructure/kotlin/build.py b/infrastructure/kotlin/build.py index eaee6af..ff14c64 100644 --- a/infrastructure/kotlin/build.py +++ b/infrastructure/kotlin/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "kotlin" PROJECT_ROOT_PATH = "../.." -version = "4.12.0" +version = "4.12.1-dev" @init diff --git a/infrastructure/python/build.py b/infrastructure/python/build.py index 9d48213..a9a2ac3 100644 --- a/infrastructure/python/build.py +++ b/infrastructure/python/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "ddadevops" MODULE = "python" PROJECT_ROOT_PATH = "../.." -version = "4.12.0" +version = "4.12.1-dev" @init