Merge branch 'main' of ssh://repo.prod.meissa.de:2222/meissa/dda-devops-build

This commit is contained in:
Mirco 2024-05-22 15:45:36 +02:00
commit f4da27f63f
10 changed files with 39 additions and 17 deletions

View file

@ -33,7 +33,7 @@ default_task = "dev"
name = "ddadevops" name = "ddadevops"
MODULE = "not-used" MODULE = "not-used"
PROJECT_ROOT_PATH = "." PROJECT_ROOT_PATH = "."
version = "4.11.11-dev" version = "4.12.1-dev"
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
description = __doc__ description = __doc__
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]

View file

@ -13,14 +13,17 @@ classDiagram
## Input ## Input
| name | description | default | | name | description | default |
| ----------------------------- | ----------------------------------------------------------------- | --------- | | --------------------------------- | ----------------------------------------------------------------- | --------- |
| k3s_provision_user | the user used to provision k3s | "root" | | k3s_provision_user | the user used to provision k3s | "root" |
| k3s_letsencrypt_email | email address used for letsencrypt | | | k3s_letsencrypt_email | email address used for letsencrypt | |
| k3s_letsencrypt_endpoint | letsencrypt endpoint. Valid values are staging, prod | "staging" | | 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_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_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_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 ### Credentials Mapping defaults

View file

@ -7,7 +7,7 @@ import logging
name = 'dda-backup' name = 'dda-backup'
MODULE = 'NOT_SET' MODULE = 'NOT_SET'
PROJECT_ROOT_PATH = '../..' PROJECT_ROOT_PATH = '../..'
version = "4.11.11-dev" version = "4.12.1-dev"
@init @init

View file

@ -6,7 +6,7 @@ from ddadevops import *
name = "ddadevops" name = "ddadevops"
MODULE = "clj-cljs" MODULE = "clj-cljs"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "4.11.11-dev" version = "4.12.1-dev"
@init @init
def initialize(project): def initialize(project):

View file

@ -6,7 +6,7 @@ from ddadevops import *
name = "ddadevops" name = "ddadevops"
MODULE = "clj" MODULE = "clj"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "4.11.11-dev" version = "4.12.1-dev"
@init @init
def initialize(project): def initialize(project):

View file

@ -6,7 +6,7 @@ from ddadevops import *
name = "ddadevops" name = "ddadevops"
MODULE = "ddadevops" MODULE = "ddadevops"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "4.11.11-dev" version = "4.12.1-dev"
@init @init

View file

@ -6,7 +6,7 @@ from ddadevops import *
name = "ddadevops" name = "ddadevops"
MODULE = "dind" MODULE = "dind"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "4.11.11-dev" version = "4.12.1-dev"
@init @init

View file

@ -6,7 +6,7 @@ from ddadevops import *
name = "ddadevops" name = "ddadevops"
MODULE = "kotlin" MODULE = "kotlin"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "4.11.11-dev" version = "4.12.1-dev"
@init @init

View file

@ -6,7 +6,7 @@ from ddadevops import *
name = "ddadevops" name = "ddadevops"
MODULE = "python" MODULE = "python"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "4.11.11-dev" version = "4.12.1-dev"
@init @init

View file

@ -20,6 +20,14 @@ CONFIG_CERTMANAGER = """certmanager:
""" """
CONFIG_ECHO = """echo: $echo 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): class K3s(Validateable):
@ -28,8 +36,11 @@ class K3s(Validateable):
self.k3s_letsencrypt_email = inp.get("k3s_letsencrypt_email") self.k3s_letsencrypt_email = inp.get("k3s_letsencrypt_email")
self.k3s_letsencrypt_endpoint = inp.get("k3s_letsencrypt_endpoint", "staging") 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_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_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 self.provision_dns: Optional[DnsRecord] = None
def validate(self) -> List[str]: 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_email")
result += self.__validate_is_not_empty__("k3s_letsencrypt_endpoint") result += self.__validate_is_not_empty__("k3s_letsencrypt_endpoint")
result += self.__validate_is_not_empty__("k3s_app_filename_to_provision") 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: if self.provision_dns:
result += self.provision_dns.validate() result += self.provision_dns.validate()
return result return result
@ -61,6 +75,9 @@ class K3s(Validateable):
substitutes["letsencrypt_endpoint"] = self.k3s_letsencrypt_endpoint substitutes["letsencrypt_endpoint"] = self.k3s_letsencrypt_endpoint
if self.k3s_enable_echo is not None: if self.k3s_enable_echo is not None:
substitutes["echo"] = self.k3s_enable_echo 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) return self.__config_template__().substitute(substitutes)
def command(self, devops: Devops): def command(self, devops: Devops):
@ -89,4 +106,6 @@ class K3s(Validateable):
template_text += CONFIG_IPV4 template_text += CONFIG_IPV4
if self.provision_dns.ipv6 is not None: if self.provision_dns.ipv6 is not None:
template_text += CONFIG_IPV6 template_text += CONFIG_IPV6
if self.k3s_enable_hetzner_csi:
template_text += CONFIG_HETZNER_CSI
return Template(template_text) return Template(template_text)