Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,38 @@ def relocate_env(self, src: str, dst: str) -> None:
if not os.path.exists(base_dir):
raise TutorError("[DRYDOCK] Missing extra-extensions folder")
shutil.move(base_dir, dst)


class GlobalManifests(BaseManifests):
"""Generate environment not bound to tutor env manifests."""

TEMPLATE_ROOT = "kustomized/global-stack"
TEMPLATE_TARGETS = [
f"{TEMPLATE_ROOT}/kustomization.yml",
]

def __init__(self, options: dict) -> None:
"""Initialize the class based on the `manifest_options` from the reference.

Parameters
----------
options: dict
Defines additional configuration options for the generations of the
configuration repository.

- ["output"]: Name of the directory to store the manifests.
"""
self.output_dir = options.get("output", "drydock-global-env")

def relocate_env(self, src: str, dst: str) -> None:
"""Moves the drydock rendered templates a global destination.

Parameters
----------
src: str
The initial path where the full tutor env was rendered.
dst: str
The path to save the final environment with the global manifests..
"""
base_dir = path_join(src, "env/drydock", f"{self.TEMPLATE_ROOT}")
shutil.move(base_dir, dst)
Comment thread
mariajgrimaldi marked this conversation as resolved.
5 changes: 5 additions & 0 deletions drydock/manifest_builder/infrastructure/tutor_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,8 @@ def get_data(self) -> dict:

def get_root(self) -> str:
return self.context.obj.root


class TutorGlobalConfig(TutorExtendedConfig):
"""Drydock configuration defaults for a global environment."""
DEFAULT_TEMPLATE_SET = "kustomized/global-stack"
5 changes: 5 additions & 0 deletions drydock/templates/kustomized/global-stack/defaults.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DRYDOCK_GLOBAL_STACK_NAMESPACE: "monitoring"
DRYDOCK_PROMETHEUS_VALUES: ""
DRYDOCK_PROMETHEUS_PATCHES: ""
DRYDOCK_GLOBAL_RESOURCES: ""
DRYDOCK_PROMETHEUS_VERSION: 39.4.0
24 changes: 24 additions & 0 deletions drydock/templates/kustomized/global-stack/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: kustomize.config.k8s.io/v1beta1
Comment thread
mariajgrimaldi marked this conversation as resolved.
kind: Kustomization

namespace: {{ DRYDOCK_GLOBAL_STACK_NAMESPACE }}

{%- if DRYDOCK_GLOBAL_RESOURCES %}
resources:
{{ patch("drydock-global-resources") }}
{%- endif %}

helmCharts:
- name: kube-prometheus-stack
repo: https://prometheus-community.github.io/helm-charts
version: {{ DRYDOCK_PROMETHEUS_VERSION }}
releaseName: prometheus
includeCRDs: true
{%- if DRYDOCK_PROMETHEUS_VALUES %}
valuesInline:
{{ DRYDOCK_PROMETHEUS_VALUES | indent(4) }}
{%- endif %}
{{ patch("drydock-global-helm-charts") }}

patches:
{{ DRYDOCK_PROMETHEUS_PATCHES }}