From 2256c2b6347ca9f1a1f2a01ace9d4db8609a17f6 Mon Sep 17 00:00:00 2001 From: WenChih Lo Date: Fri, 1 Mar 2024 06:16:48 +0800 Subject: [PATCH] [BUG] Invalid "resources" scope in clusterresourcesync/deployment.yaml (#4916) * fix invalid clusterresourcesync/deployment.yaml Signed-off-by: Ryan Lo * update README.md Signed-off-by: Ryan Lo * update generated yaml files Signed-off-by: Ryan Lo * fix typo Signed-off-by: Ryan Lo --------- Signed-off-by: Ryan Lo --- charts/flyte-core/README.md | 3 ++- .../templates/clusterresourcesync/deployment.yaml | 7 ++++--- charts/flyte-core/values.yaml | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/charts/flyte-core/README.md b/charts/flyte-core/README.md index 73b5fceae5..31fd4791b9 100644 --- a/charts/flyte-core/README.md +++ b/charts/flyte-core/README.md @@ -60,7 +60,7 @@ helm install gateway bitnami/contour -n flyte | cloud_events.eventsPublisher.eventTypes[0] | string | `"all"` | | | cloud_events.eventsPublisher.topicName | string | `"arn:aws:sns:us-east-2:123456:123-my-topic"` | | | cloud_events.type | string | `"aws"` | | -| cluster_resource_manager | object | `{"config":{"cluster_resources":{"customData":[{"production":[{"projectQuotaCpu":{"value":"5"}},{"projectQuotaMemory":{"value":"4000Mi"}}]},{"staging":[{"projectQuotaCpu":{"value":"2"}},{"projectQuotaMemory":{"value":"3000Mi"}}]},{"development":[{"projectQuotaCpu":{"value":"4"}},{"projectQuotaMemory":{"value":"3000Mi"}}]}],"refreshInterval":"5m","standaloneDeployment":false,"templatePath":"/etc/flyte/clusterresource/templates"}},"enabled":true,"nodeSelector":{},"podAnnotations":{},"podEnv":{},"podLabels":{},"service_account_name":"flyteadmin","standaloneDeployment":false,"templates":[{"key":"aa_namespace","value":"apiVersion: v1\nkind: Namespace\nmetadata:\n name: {{ namespace }}\nspec:\n finalizers:\n - kubernetes\n"},{"key":"ab_project_resource_quota","value":"apiVersion: v1\nkind: ResourceQuota\nmetadata:\n name: project-quota\n namespace: {{ namespace }}\nspec:\n hard:\n limits.cpu: {{ projectQuotaCpu }}\n limits.memory: {{ projectQuotaMemory }}\n"}]}` | Configuration for the Cluster resource manager component. This is an optional component, that enables automatic cluster configuration. This is useful to set default quotas, manage namespaces etc that map to a project/domain | +| cluster_resource_manager | object | `{"config":{"cluster_resources":{"customData":[{"production":[{"projectQuotaCpu":{"value":"5"}},{"projectQuotaMemory":{"value":"4000Mi"}}]},{"staging":[{"projectQuotaCpu":{"value":"2"}},{"projectQuotaMemory":{"value":"3000Mi"}}]},{"development":[{"projectQuotaCpu":{"value":"4"}},{"projectQuotaMemory":{"value":"3000Mi"}}]}],"refreshInterval":"5m","standaloneDeployment":false,"templatePath":"/etc/flyte/clusterresource/templates"}},"enabled":true,"nodeSelector":{},"podAnnotations":{},"podEnv":{},"podLabels":{},"resources":{},"service_account_name":"flyteadmin","standaloneDeployment":false,"templates":[{"key":"aa_namespace","value":"apiVersion: v1\nkind: Namespace\nmetadata:\n name: {{ namespace }}\nspec:\n finalizers:\n - kubernetes\n"},{"key":"ab_project_resource_quota","value":"apiVersion: v1\nkind: ResourceQuota\nmetadata:\n name: project-quota\n namespace: {{ namespace }}\nspec:\n hard:\n limits.cpu: {{ projectQuotaCpu }}\n limits.memory: {{ projectQuotaMemory }}\n"}]}` | Configuration for the Cluster resource manager component. This is an optional component, that enables automatic cluster configuration. This is useful to set default quotas, manage namespaces etc that map to a project/domain | | cluster_resource_manager.config | object | `{"cluster_resources":{"customData":[{"production":[{"projectQuotaCpu":{"value":"5"}},{"projectQuotaMemory":{"value":"4000Mi"}}]},{"staging":[{"projectQuotaCpu":{"value":"2"}},{"projectQuotaMemory":{"value":"3000Mi"}}]},{"development":[{"projectQuotaCpu":{"value":"4"}},{"projectQuotaMemory":{"value":"3000Mi"}}]}],"refreshInterval":"5m","standaloneDeployment":false,"templatePath":"/etc/flyte/clusterresource/templates"}}` | Configmap for ClusterResource parameters | | cluster_resource_manager.config.cluster_resources | object | `{"customData":[{"production":[{"projectQuotaCpu":{"value":"5"}},{"projectQuotaMemory":{"value":"4000Mi"}}]},{"staging":[{"projectQuotaCpu":{"value":"2"}},{"projectQuotaMemory":{"value":"3000Mi"}}]},{"development":[{"projectQuotaCpu":{"value":"4"}},{"projectQuotaMemory":{"value":"3000Mi"}}]}],"refreshInterval":"5m","standaloneDeployment":false,"templatePath":"/etc/flyte/clusterresource/templates"}` | ClusterResource parameters Refer to the [structure](https://pkg.go.dev/github.com/lyft/flyteadmin@v0.3.37/pkg/runtime/interfaces#ClusterResourceConfig) to customize. | | cluster_resource_manager.config.cluster_resources.refreshInterval | string | `"5m"` | How frequently to run the sync process | @@ -70,6 +70,7 @@ helm install gateway bitnami/contour -n flyte | cluster_resource_manager.podAnnotations | object | `{}` | Annotations for ClusterResource pods | | cluster_resource_manager.podEnv | object | `{}` | Additional ClusterResource container environment variables | | cluster_resource_manager.podLabels | object | `{}` | Labels for ClusterResource pods | +| cluster_resource_manager.resources | object | `{}` | Resources for ClusterResource deployment | | cluster_resource_manager.service_account_name | string | `"flyteadmin"` | Service account name to run with | | cluster_resource_manager.templates | list | `[{"key":"aa_namespace","value":"apiVersion: v1\nkind: Namespace\nmetadata:\n name: {{ namespace }}\nspec:\n finalizers:\n - kubernetes\n"},{"key":"ab_project_resource_quota","value":"apiVersion: v1\nkind: ResourceQuota\nmetadata:\n name: project-quota\n namespace: {{ namespace }}\nspec:\n hard:\n limits.cpu: {{ projectQuotaCpu }}\n limits.memory: {{ projectQuotaMemory }}\n"}]` | Resource templates that should be applied | | cluster_resource_manager.templates[0] | object | `{"key":"aa_namespace","value":"apiVersion: v1\nkind: Namespace\nmetadata:\n name: {{ namespace }}\nspec:\n finalizers:\n - kubernetes\n"}` | Template for namespaces resources | diff --git a/charts/flyte-core/templates/clusterresourcesync/deployment.yaml b/charts/flyte-core/templates/clusterresourcesync/deployment.yaml index 19c0b9c48a..a2fb5d04ae 100644 --- a/charts/flyte-core/templates/clusterresourcesync/deployment.yaml +++ b/charts/flyte-core/templates/clusterresourcesync/deployment.yaml @@ -34,6 +34,10 @@ spec: image: "{{ .Values.flyteadmin.image.repository }}:{{ .Values.flyteadmin.image.tag }}" imagePullPolicy: "{{ .Values.flyteadmin.image.pullPolicy }}" name: sync-cluster-resources + {{- with .Values.cluster_resource_manager.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} volumeMounts: {{- if not .Values.cluster_resource_manager.config.cluster_resources.standaloneDeployment }} {{- include "databaseSecret.volumeMount" . | nindent 10 }} @@ -52,9 +56,6 @@ spec: name: cluster-secrets {{- end }} serviceAccountName: {{ .Values.cluster_resource_manager.service_account_name }} - {{- if .Values.cluster_resource_manager.resources }} - resources: {{- toYaml .Values.cluster_resource_manager.resources | nindent 10 }} - {{- end }} volumes: {{- include "databaseSecret.volume" . | nindent 8 }} - configMap: name: clusterresource-template diff --git a/charts/flyte-core/values.yaml b/charts/flyte-core/values.yaml index c104af3e75..d5c21c5131 100755 --- a/charts/flyte-core/values.yaml +++ b/charts/flyte-core/values.yaml @@ -896,6 +896,8 @@ cluster_resource_manager: podLabels: {} # -- nodeSelector for ClusterResource deployment nodeSelector: {} + # -- Resources for ClusterResource deployment + resources: {} # -- Configmap for ClusterResource parameters config: # -- ClusterResource parameters