diff --git a/README.md b/README.md index ab19477..739c21b 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,15 @@ Systemd, [Docker SDK](https://docker-py.readthedocs.io/en/stable/) for Python (f | _ports_ | listening port information for a service | `{}` | | _dataDir_ | directory to store service runtime/operational data | `/tmp` | | _restart_policy_ | service restart policy | `unless-stopped` | -| _cpus_ | available CPU resources each deployed service can use | `1.0` | -| _memory_ | available memory resources each deployed service can use | `4g` | ### Container | var | description | default | | :-------------: | :--------------------------------------------------------: | :--------------: | | _image_ | service container image to deploy | ` ` | +| _resources.cpuLimit_ | limit of CPU resources each deployed service can use | `1.0` | +| _resources.memLimit_ | limit of memory resources each deployed service can use | `1G` | +| _resources.memRequest_ | requested memory resources each deployed service can use | `1G` | ### Systemd @@ -49,7 +50,16 @@ Systemd, [Docker SDK](https://docker-py.readthedocs.io/en/stable/) for Python (f | _binary_file_name_override_ | Override the binary file name after moving it to the destination directory | ` ` | | _destination_directory_ | directory where the binary file will be placed after downloading/extracting | `/usr/local/bin` | | _systemd_ | Systemd deployment custom unit, service and install properties | `{}` | +| _cpus_ | percentage of CPU resources each deployed service can use | `100%` | +| _memory_ | available memory resources each deployed service can use | `1G` | +### Kubernetes (k8s) + +| var | description | default | +| :-------------: | :--------------------------------------------------------: | :--------------: | +| _helm_chart_path_ | path to Helm chart to use for the service deployment/release | `../../helm` | +| _helm_namespace_ | Kubernetes namespace to deploy to | `default` | +| _helm_values_path_ | file to load Helm chart values (see [here](./helm/README.md) for available values) | `values.yml` | ## Containerized Apps - [O1 Containers](https://github.com/0x0I/containers) diff --git a/defaults/main.yml b/defaults/main.yml index c98d0fd..57e2618 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -58,12 +58,19 @@ port_list: [] ### Container ### image: +resources: + cpuLimit: 1 + memRequest: 1G + memLimit: 1G ### Systemd ### binary_url: # (Optional) Override the binary file name after moving it to the destination directory binary_file_name_override: +cpus: 100% +memory: 1G + systemd: {} # unit_properties: {} # service_properties: {} @@ -71,4 +78,11 @@ systemd: {} systemd_environment_directive: "" +### Kubernetes ### +helm_chart_path: ../../helm +helm_namespace: default +helm_values_path: values.yml + +### + setup_iptables: false diff --git a/tasks/k8s/setup.yml b/tasks/k8s/setup.yml new file mode 100644 index 0000000..7a180a8 --- /dev/null +++ b/tasks/k8s/setup.yml @@ -0,0 +1,19 @@ +--- +- name: Ensure Helm is installed + command: helm version + register: helm_version + ignore_errors: true + +- name: Install Helm if not installed + apt: + name: helm + state: present + when: helm_version.failed + +- name: Deploy Helm chart + kubernetes.core.helm: + name: "{{ name }}" + chart_ref: "{{ helm_chart_path }}" + release_namespace: "{{ helm_namespace }}" + values_files: + - "{{ helm_values_path }}" \ No newline at end of file