diff --git a/deployment-configuration/compose/Chart.yaml b/deployment-configuration/compose/Chart.yaml index 83bf4933..1b396ffe 100644 --- a/deployment-configuration/compose/Chart.yaml +++ b/deployment-configuration/compose/Chart.yaml @@ -1,10 +1,8 @@ apiVersion: v1 -appVersion: "0.0.1" -description: CloudHarness Docker Compose -name: cloudharness -version: 0.0.1 +appVersion: 2.4.0-compose +description: CloudHarness Docker compose Helm Chart maintainers: - - name: Filippo Ledda - email: filippo@metacell.us - - name: Zoran Sinnema - email: zoran@metacell.us +- {email: filippo@metacell.us, name: Filippo Ledda} +- {email: vincent@metacell.us, name: Vincent Aranega} +name: cloudharness +version: 0.0.1 \ No newline at end of file diff --git a/deployment-configuration/compose/README.md b/deployment-configuration/compose/README.md index 391b61c6..5387ebbe 100644 --- a/deployment-configuration/compose/README.md +++ b/deployment-configuration/compose/README.md @@ -1,3 +1,3 @@ # CloudHarness Docker Compose: deploy CloudHarness to Docker Compose -Helm is used to define templates about how the CloudHarness deployment on Docker Compose. For further information about Helm, see https://helm.sh. +Helm is used to define templates about how the CloudHarness deployment on Docker Compose. For further information about Helm, see https://helm.sh. \ No newline at end of file diff --git a/deployment-configuration/compose/values.yaml b/deployment-configuration/compose/values.yaml index 434dcac7..0fa87e29 100644 --- a/deployment-configuration/compose/values.yaml +++ b/deployment-configuration/compose/values.yaml @@ -21,52 +21,7 @@ apps: {} env: # -- Cloud Harness version - name: CH_VERSION - value: 0.0.1 - # -- Cloud harness chart version - - name: CH_CHART_VERSION - value: 0.0.1 -privenv: - # -- Defines a secret as private environment variable that is injected in containers. - - name: CH_SECRET - value: In God we trust; all others must bring data. ― W. Edwards Deming -ingress: - # -- Flag to enable/disalbe ingress controller. - enabled: true - # -- K8s Name of ingress. - name: cloudharness-ingress - # -- Enables/disables SSL redirect. - ssl_redirect: true - letsencrypt: - # -- Email for letsencrypt. - email: filippo@metacell.us -backup: - # -- Flag to enable/disable backups. - active: false - # -- Number of days to keep backups. - keep_days: "7" - # -- Number of weeks to keep backups. - keep_weeks: "4" - # -- Number of months to keep backups. - keep_months: "6" - # -- Schedule as cronjob expression. - schedule: "*/5 * * * *" - # -- The file suffix added to backup files. - suffix: ".gz" - # -- The volume size for backups (all backups share the same volume) - volumesize: "2Gi" - # -- Target directory of backups, the mount point of the persistent volume. - dir: "/backups" - resources: - requests: - # -- K8s memory resource definition. - memory: "32Mi" - # -- K8s cpu resource definition. - cpu: "25m" - limits: - # -- K8s memory resource definition. - memory: "64Mi" - # -- K8s cpu resource definition. - cpu: "50m" + value: 2.4.0 proxy: timeout: # -- Timeout for proxy connections in seconds. diff --git a/deployment-configuration/helm/Chart.yaml b/deployment-configuration/helm/Chart.yaml index f294c3e7..31dbc5ff 100644 --- a/deployment-configuration/helm/Chart.yaml +++ b/deployment-configuration/helm/Chart.yaml @@ -1,10 +1,8 @@ apiVersion: v1 -appVersion: "0.0.1" +appVersion: 2.4.0 description: CloudHarness Helm Chart -name: cloudharness -version: 0.0.1 maintainers: - - name: Filippo Ledda - email: filippo@metacell.us - - name: Zoran Sinnema - email: zoran@metacell.us +- {email: filippo@metacell.us, name: Filippo Ledda} +- {email: zoran@metacell.us, name: Zoran Sinnema} +name: cloudharness +version: 0.0.1 \ No newline at end of file diff --git a/deployment-configuration/helm/values.yaml b/deployment-configuration/helm/values.yaml index 59fd7a67..86ada06f 100644 --- a/deployment-configuration/helm/values.yaml +++ b/deployment-configuration/helm/values.yaml @@ -21,10 +21,7 @@ apps: {} env: # -- Cloud Harness version - name: CH_VERSION - value: 0.0.1 - # -- Cloud harness chart version - - name: CH_CHART_VERSION - value: 0.0.1 + value: 2.4.0 privenv: # -- Defines a secret as private environment variable that is injected in containers. - name: CH_SECRET @@ -38,7 +35,7 @@ ingress: ssl_redirect: true letsencrypt: # -- Email for letsencrypt. - email: filippo@metacell.us + email: cloudharness@metacell.us backup: # -- Flag to enable/disable backups. active: false diff --git a/deployment-configuration/skaffold-template.yaml b/deployment-configuration/skaffold-template.yaml index 6331c4d8..2b2a3a25 100644 --- a/deployment-configuration/skaffold-template.yaml +++ b/deployment-configuration/skaffold-template.yaml @@ -1,8 +1,7 @@ apiVersion: skaffold/v2beta28 kind: Config build: - tagPolicy: - sha256: {} + tagPolicy: {} local: useBuildkit: true concurrency: 4 diff --git a/tools/deployment-cli-tools/ch_cli_tools/dockercompose.py b/tools/deployment-cli-tools/ch_cli_tools/dockercompose.py index a4a3e1b8..e714f1f1 100644 --- a/tools/deployment-cli-tools/ch_cli_tools/dockercompose.py +++ b/tools/deployment-cli-tools/ch_cli_tools/dockercompose.py @@ -16,7 +16,9 @@ from .models import HarnessMainConfig -from .configurationgenerator import ConfigurationGenerator, validate_helm_values, KEY_HARNESS, KEY_SERVICE, KEY_DATABASE, KEY_APPS, KEY_TASK_IMAGES, KEY_TEST_IMAGES, KEY_DEPLOYMENT, values_from_legacy, values_set_legacy, get_included_with_dependencies, create_env_variables, collect_apps_helm_templates +from .configurationgenerator import ConfigurationGenerator, \ + validate_helm_values, values_from_legacy, values_set_legacy, get_included_with_dependencies, create_env_variables, collect_apps_helm_templates, \ + KEY_HARNESS, KEY_SERVICE, KEY_DATABASE, KEY_APPS, KEY_TASK_IMAGES, KEY_TEST_IMAGES, KEY_DEPLOYMENT def create_docker_compose_configuration(root_paths, tag: Union[str, int, None] = 'latest', registry='', local=True, domain=None, exclude=(), secured=True, diff --git a/tools/deployment-cli-tools/ch_cli_tools/skaffold.py b/tools/deployment-cli-tools/ch_cli_tools/skaffold.py index aefc8607..0c471f42 100644 --- a/tools/deployment-cli-tools/ch_cli_tools/skaffold.py +++ b/tools/deployment-cli-tools/ch_cli_tools/skaffold.py @@ -9,8 +9,8 @@ from cloudharness_utils.constants import APPS_PATH, DEPLOYMENT_CONFIGURATION_PATH, \ BASE_IMAGES_PATH, STATIC_IMAGES_PATH, HELM_ENGINE, COMPOSE_ENGINE from .helm import KEY_APPS, KEY_HARNESS, KEY_DEPLOYMENT, KEY_TASK_IMAGES -from .utils import get_template, dict_merge, find_dockerfiles_paths, app_name_from_path, \ - find_file_paths, guess_build_dependencies_from_dockerfile, merge_to_yaml_file, get_json_template, get_image_name +from .utils import get_template, dict_merge, find_dockerfiles_paths, app_name_from_path, yaml, \ + find_file_paths, guess_build_dependencies_from_dockerfile, get_json_template, get_image_name from . import HERE @@ -22,12 +22,13 @@ def relpath_if(p1, p2): def create_skaffold_configuration(root_paths, helm_values: HarnessMainConfig, output_path='.', manage_task_images=True, backend_deploy=HELM_ENGINE): - skaffold_conf = get_template('skaffold-template.yaml', True) + backend = backend_deploy or HELM_ENGINE + template_name = 'skaffold-template.yaml' + skaffold_conf = get_template(template_name, True) apps = helm_values.apps base_image_name = (helm_values.registry.name or "") + helm_values.name artifacts = {} overrides = {} - backend = backend_deploy or HELM_ENGINE def remove_tag(image_name): return image_name.split(":")[0] @@ -101,7 +102,7 @@ def process_build_dockerfile( for root_path in root_paths: skaffold_conf = dict_merge(skaffold_conf, get_template( - join(root_path, DEPLOYMENT_CONFIGURATION_PATH, 'skaffold-template.yaml'))) + join(root_path, DEPLOYMENT_CONFIGURATION_PATH, template_name))) base_dockerfiles = find_dockerfiles_paths( join(root_path, BASE_IMAGES_PATH)) @@ -219,15 +220,19 @@ def identify_unicorn_based_main(candidates): 'images': [artifact['image'] for artifact in artifacts.values() if artifact['image']] } } + if backend == COMPOSE_ENGINE or not helm_values.tag: skaffold_conf['build']['tagPolicy'] = { 'envTemplate': { 'template': '"{{.TAG}}"' } } + else: + skaffold_conf['build']['tagPolicy'] = {"sha256": {}} skaffold_conf['build']['artifacts'] = [v for v in artifacts.values()] - merge_to_yaml_file(skaffold_conf, os.path.join( - output_path, 'skaffold.yaml')) + + with open('skaffold.yaml', "w") as f: + yaml.dump(skaffold_conf, f) return skaffold_conf @@ -244,8 +249,7 @@ def git_clone_hook(conf: GitDependencyConfig, context_path: str): def create_vscode_debug_configuration(root_paths, helm_values): - logging.info( - "Creating VS code cloud build configuration.\nCloud build extension is needed to debug.") + logging.info("Creating VS code cloud build configuration.\nCloud build extension is needed to debug.") vscode_launch_path = '.vscode/launch.json'