From e2369bae68cacc0065a1981e8f7452d8782a168c Mon Sep 17 00:00:00 2001 From: klinch0 <68821526+klinch0@users.noreply.github.com> Date: Tue, 25 Feb 2025 16:53:52 +0300 Subject: [PATCH] feature/add-quota (#644) ## Summary by CodeRabbit - **New Features** - Introduced a new configurable parameter for tenant resource quotas, enabling flexible CPU and memory management. - Added a new YAML template for Kubernetes ResourceQuota configuration. - Updated application version to 1.8.0. - **Documentation** - Added documentation for the new `resourceQuotas` parameter in tenant configuration. - **Chores** - Updated versioning entries for the tenant application. --- packages/apps/tenant/Chart.yaml | 2 +- packages/apps/tenant/README.md | 17 +++++++++-------- packages/apps/tenant/templates/quota.yaml | 10 ++++++++++ packages/apps/tenant/values.schema.json | 5 +++++ packages/apps/tenant/values.yaml | 9 +++++++++ packages/apps/versions_map | 3 ++- 6 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 packages/apps/tenant/templates/quota.yaml diff --git a/packages/apps/tenant/Chart.yaml b/packages/apps/tenant/Chart.yaml index d8f2853a..201964b0 100644 --- a/packages/apps/tenant/Chart.yaml +++ b/packages/apps/tenant/Chart.yaml @@ -4,4 +4,4 @@ description: Separated tenant namespace icon: /logos/tenant.svg type: application -version: 1.7.0 +version: 1.8.0 diff --git a/packages/apps/tenant/README.md b/packages/apps/tenant/README.md index 6e270636..fe55948c 100644 --- a/packages/apps/tenant/README.md +++ b/packages/apps/tenant/README.md @@ -50,11 +50,12 @@ tenant-u1 ### Common parameters -| Name | Description | Value | -| ------------ | --------------------------------------------------------------------------------------------------------------------------- | ------- | -| `host` | The hostname used to access tenant services (defaults to using the tenant name as a subdomain for it's parent tenant host). | `""` | -| `etcd` | Deploy own Etcd cluster | `false` | -| `monitoring` | Deploy own Monitoring Stack | `false` | -| `ingress` | Deploy own Ingress Controller | `false` | -| `seaweedfs` | Deploy own SeaweedFS | `false` | -| `isolated` | Enforce tenant namespace with network policies | `false` | +| Name | Description | Value | +| ---------------- | --------------------------------------------------------------------------------------------------------------------------- | ------- | +| `host` | The hostname used to access tenant services (defaults to using the tenant name as a subdomain for it's parent tenant host). | `""` | +| `etcd` | Deploy own Etcd cluster | `false` | +| `monitoring` | Deploy own Monitoring Stack | `false` | +| `ingress` | Deploy own Ingress Controller | `false` | +| `seaweedfs` | Deploy own SeaweedFS | `false` | +| `isolated` | Enforce tenant namespace with network policies | `false` | +| `resourceQuotas` | Define resource quotas for the tenant | `{}` | diff --git a/packages/apps/tenant/templates/quota.yaml b/packages/apps/tenant/templates/quota.yaml new file mode 100644 index 00000000..8daf0607 --- /dev/null +++ b/packages/apps/tenant/templates/quota.yaml @@ -0,0 +1,10 @@ +{{- if .Values.resourceQuotas }} +apiVersion: v1 +kind: ResourceQuota +metadata: + name: tenant-quota + namespace: {{ include "tenant.name" . }} +spec: + hard: + {{- toYaml .Values.resourceQuotas | nindent 4 }} +{{- end }} diff --git a/packages/apps/tenant/values.schema.json b/packages/apps/tenant/values.schema.json index 4d270ecd..bda256e6 100644 --- a/packages/apps/tenant/values.schema.json +++ b/packages/apps/tenant/values.schema.json @@ -31,6 +31,11 @@ "type": "boolean", "description": "Enforce tenant namespace with network policies", "default": false + }, + "resourceQuotas": { + "type": "object", + "description": "Define resource quotas for the tenant", + "default": {} } } } \ No newline at end of file diff --git a/packages/apps/tenant/values.yaml b/packages/apps/tenant/values.yaml index ec4dcb18..89552e1f 100644 --- a/packages/apps/tenant/values.yaml +++ b/packages/apps/tenant/values.yaml @@ -6,9 +6,18 @@ ## @param ingress Deploy own Ingress Controller ## @param seaweedfs Deploy own SeaweedFS ## @param isolated Enforce tenant namespace with network policies +## @param resourceQuotas Define resource quotas for the tenant host: "" etcd: false monitoring: false ingress: false seaweedfs: false isolated: false +resourceQuotas: {} +# resourceQuotas: +# requests.cpu: "1" +# requests.memory: "1Gi" +# limits.cpu: "2" +# limits.memory: "2Gi" +# requests.nvidia.com/gpu: 4 +# requests.storage: 100Gi diff --git a/packages/apps/versions_map b/packages/apps/versions_map index 3dc95bf1..87994a31 100644 --- a/packages/apps/versions_map +++ b/packages/apps/versions_map @@ -104,7 +104,8 @@ tenant 1.6.5 f1e11451 tenant 1.6.6 d4634797 tenant 1.6.7 06afcf27 tenant 1.6.8 4cc48e6f -tenant 1.7.0 HEAD +tenant 1.7.0 6c73e3f3 +tenant 1.8.0 HEAD virtual-machine 0.1.4 f2015d6 virtual-machine 0.1.5 7cd7de7 virtual-machine 0.2.0 5ca8823