Repository: kubeflow/pipelines

Issue:
'kubeflow-pipelines-profile-controller' fails to deploy pods on profile creation when ResourceQuota is set in the profile.
In multi-user mode, it seems like `kubeflow-pipelines-profile-controller` deploy below pods on Kubeflow profile creation.

- `ml-pipeline-ui-artifact`
- `ml-pipeline-visualizationserver`

When `ResourceQuota` is set in the profile, `kubeflow-pipelines-profile-controller` fails to deploy `ml-pipeline-ui-artifact` and `ml-pipeline-visualizationserver` with below error.

```
Warning  FailedCreate  17m replicaset-controller 
Error creating: pods "ml-pipeline-ui-artifact-684c5db68-s74w8" is forbidden: failed quota: kf-resource-quota: must specify cpu,memory
```

- Related code: [https://github.com/kubeflow/manifests/blob/master/apps/pipeline/upstream/installs/multi-user/pipelines-profile-controller/sync.py](https://github.com/kubeflow/manifests/blob/master/apps/pipeline/upstream/installs/multi-user/pipelines-profile-controller/sync.py)
- Cause: The container resource limit & request is not set on the pod specs, so the pods can not be deployed in the namespace (which has  `ResourceQuota` ).

Since Kubeflow profile supports setting `ResourceQuota`,  `kubeflow-pipelines-profile-controller` should set container resource requests & limits in pod specs to avoid above errors. 

I confirmed that with below patch, ml-pipeline pods are successfully deployed.

```python
diff --git a/apps/pipeline/upstream/installs/multi-user/pipelines-profile-controller/sync.py b/apps/pipeline/upstream/installs/multi-user/pipelines-profile-controller/sync.py
index 75c6e5db..a0e71fbf 100644
--- a/apps/pipeline/upstream/installs/multi-user/pipelines-profile-controller/sync.py
+++ b/apps/pipeline/upstream/installs/multi-user/pipelines-profile-controller/sync.py
@@ -104,6 +104,16 @@ class Controller(BaseHTTPRequestHandler):
                                 "ports": [{
                                     "containerPort": 8888
                                 }],
+                                "resources": {
+                                    "requests": {
+                                        "cpu": "50m",
+                                        "memory": "200Mi"
+                                    },
+                                    "limits": {
+                                        "cpu": "500m",
+                                        "memory": "2Gi"
+                                    },
+                                }
                             }],
                             "serviceAccountName":
                             "default-editor",
@@ -204,7 +214,17 @@ class Controller(BaseHTTPRequestHandler):
                                 "IfNotPresent",
                                 "ports": [{
                                     "containerPort": 3000
-                                }]
+                                }],
+                                "resources": {
+                                    "requests": {
+                                        "cpu": "50m",
+                                        "memory": "200Mi"
+                                    },
+                                    "limits": {
+                                        "cpu": "500m",
+                                        "memory": "2Gi"
+                                    },
+                                }
                             }],
                             "serviceAccountName":
                             "default-editor"
```

Please take a look, thanks.


Discussion:
This would be more like a KFP-specific issue

/cc @Bobgy 

Can you help transfer the issue to kubeflow/pipelines?
Thanks @henrysecond1! That makes sense adding some default value there.
Manifests is currently migrating to kubeflow/pipelines repo. Would you want to open a PR after that?
Sure, thanks for the explanation. I'll open PR after the migration. 

Resolving patch:
diff --git a/manifests/kustomize/base/installs/multi-user/pipelines-profile-controller/sync.py b/manifests/kustomize/base/installs/multi-user/pipelines-profile-controller/sync.py
--- a/manifests/kustomize/base/installs/multi-user/pipelines-profile-controller/sync.py
+++ b/manifests/kustomize/base/installs/multi-user/pipelines-profile-controller/sync.py
@@ -104,6 +104,16 @@ def sync(self, parent, children):
                                 "ports": [{
                                     "containerPort": 8888
                                 }],
+                                "resources": {
+                                    "requests": {
+                                        "cpu": "50m",
+                                        "memory": "200Mi"
+                                    },
+                                    "limits": {
+                                        "cpu": "500m",
+                                        "memory": "1Gi"
+                                    },
+                                }
                             }],
                             "serviceAccountName":
                             "default-editor",
@@ -204,7 +214,17 @@ def sync(self, parent, children):
                                 "IfNotPresent",
                                 "ports": [{
                                     "containerPort": 3000
-                                }]
+                                }],
+                                "resources": {
+                                    "requests": {
+                                        "cpu": "10m",
+                                        "memory": "70Mi"
+                                    },
+                                    "limits": {
+                                        "cpu": "100m",
+                                        "memory": "500Mi"
+                                    },
+                                }
                             }],
                             "serviceAccountName":
                             "default-editor"


Test patch: