introduce k3s

This commit is contained in:
Michael Jerger 2023-05-22 11:08:34 +02:00
parent 61dfa82661
commit 0f212782d5
7 changed files with 42 additions and 2 deletions

View file

@ -25,6 +25,16 @@ classDiagram
c4k_executabel_name
c4k_mixin_config
c4k_mixin_auth
c4k_grafana_cloud_user
c4k_grafana_cloud_password
}
class ProvsK3s {
k3s_provision_user
k3s_letsencrypt_email
k3s_letsencrypt_endpoint
k3s_enable_echo
k3s_app_filename_to_provision
}
class DnsRecord {
@ -71,11 +81,13 @@ classDiagram
Devops *-- "0..1" Image: spcialized_builds
Devops *-- "0..1" C4k: spcialized_builds
Devops *-- "0..1" ProvsK3s: spcialized_builds
Devops *-- "0..1" Release: mixins
Release o-- "0..1" BuildFile: primary_build_file
Release o-- "0..n" BuildFile: secondary_build_files
BuildFile *-- "1" Version
C4k *-- DnsRecord
C4k *-- DnsRecord: dns_record
ProvsK3s *-- DnsRecord: provision_dns
Credentials *-- "0..n" CredentialMapping: mappings
```

View file

@ -2,6 +2,7 @@ from .common import Validateable, DnsRecord, Devops, BuildType, MixinType, Relea
from .devops_factory import DevopsFactory
from .image import Image
from .c4k import C4k
from .provs_k3s import K3s
from .release import Release
from .credentials import Credentials, CredentialMapping, GopassType
from .version import Version

View file

@ -9,6 +9,7 @@ def filter_none(list_to_filter):
class BuildType(Enum):
IMAGE = 0
C4K = 1
K3S = 2
class MixinType(Enum):

View file

@ -2,6 +2,7 @@ from typing import List, Optional, Dict
from .common import Validateable, Devops, BuildType, MixinType
from .image import Image
from .c4k import C4k
from .provs_k3s import K3s
from .release import Release
from .version import Version
@ -19,6 +20,8 @@ class DevopsFactory:
specialized_builds[BuildType.IMAGE] = Image(inp)
if BuildType.C4K in build_types:
specialized_builds[BuildType.C4K] = C4k(inp)
if BuildType.K3S in build_types:
specialized_builds[BuildType.K3S] = K3s(inp)
mixins: Dict[MixinType, Validateable] = {}
if MixinType.RELEASE in mixin_types:

View file

@ -0,0 +1,10 @@
from typing import List, Optional
from .common import (
Validateable,
DnsRecord,
Devops,
)
class K3s(Validateable):
def __init__(self, inp: dict):
pass

View file

@ -9,7 +9,7 @@ def devops_config(overrides: dict) -> dict:
"stage": "test",
"project_root_path": "root_path",
"build_dir_name": "target",
"build_types": ["IMAGE", "C4K"],
"build_types": ["IMAGE", "C4K", "K3S"],
"mixin_types": ["RELEASE"],
"image_dockerhub_user": "dockerhub_user",
"image_dockerhub_password": "dockerhub_password",

View file

@ -0,0 +1,13 @@
import pytest
from pathlib import Path
from src.main.python.ddadevops.domain import (
DnsRecord,
BuildType,
K3s
)
from .helper import build_devops
def test_creation():
sut = build_devops({})
assert BuildType.K3S in sut.specialized_builds