Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce API that would allow Dashboard get resources info about target K8s namespace for workspace #13504

Closed
1 of 2 tasks
sleshchenko opened this issue Jun 10, 2019 · 4 comments
Assignees
Labels
kind/enhancement A feature request - must adhere to the feature request template. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. severity/P1 Has a major impact to usage or development of the system.

Comments

@sleshchenko
Copy link
Member

sleshchenko commented Jun 10, 2019

Description

It's needed for #13484.
Introduce API that would allow Dashboard get resources info about target K8s namespace for workspace (name, quotas for now).

In the scope of this issue, it's needed to:

Additional context

 oc describe quota object-counts                                                                          
Name:                   object-counts
Namespace:              skabashn-che
Resource                Used  Hard
--------                ----  ----
persistentvolumeclaims  1     2
replicationcontrollers  0     20
secrets                 18    20
services                0     15
Name:       compute-resources
Namespace:  skabashn-che
Scopes:     NotTerminating
 * Matches all pods that do not have an active deadline. These pods usually include long running pods whose container command is not expected to terminate.
Resource       Used  Hard
--------       ----  ----
limits.cpu     0     16
limits.memory  0     8Gi
@sleshchenko sleshchenko added kind/enhancement A feature request - must adhere to the feature request template. team/platform labels Jun 10, 2019
@sleshchenko sleshchenko self-assigned this Jun 10, 2019
@sleshchenko sleshchenko added the status/in-progress This issue has been taken by an engineer and is under active development. label Jun 10, 2019
@skabashnyuk skabashnyuk added the severity/P1 Has a major impact to usage or development of the system. label Jun 10, 2019
@sleshchenko sleshchenko removed the status/in-progress This issue has been taken by an engineer and is under active development. label Jun 13, 2019
@sleshchenko
Copy link
Member Author

Is suspended in favor of #13538

@slemeur slemeur added this to the 7.1.0 milestone Aug 2, 2019
@skabashnyuk skabashnyuk modified the milestones: 7.1.0, 7.2.0 Aug 14, 2019
@skabashnyuk skabashnyuk modified the milestones: 7.2.0, 7.3.0 Sep 4, 2019
@skabashnyuk skabashnyuk added severity/P2 Has a minor but important impact to the usage or development of the system. and removed severity/P1 Has a major impact to usage or development of the system. labels Sep 5, 2019
@sleshchenko
Copy link
Member Author

There is a dedicated issue to provide a list of available namespaces #14376. And this issue is more about extending that API and provide resources information about namespaces. The description is updated with the corresponding changes.

@sleshchenko sleshchenko changed the title Introduce API that would allow Dashboard get info about target K8s namespace for workspace Introduce API that would allow Dashboard get resources info about target K8s namespace for workspace Sep 23, 2019
@sleshchenko
Copy link
Member Author

sleshchenko commented Sep 24, 2019

Here is a result of quick research of K8s/OS Resource API I did some time ago. It works pretty in the same way for K8s and OS except that fact that K8s dashboard has its own API proxy that responds with like grouped data (below will be an example and maybe we should do the same for our API).
In the cluster there maybe be different quotas objects (although docs says The administrator creates one ResourceQuota for each namespace See [1]).
Each quota is independent of others like RAM nor pod count limit are not added in the end. If there is one quota with 1 pod, and another quota with 2 pods - then user is able to create only 1 pod(not 3), since otherwise, he will exceed the first quota.
Only admins are able to create quotas - but all users should be able to view them(in namespaces where they has rights) along with status.
K8s API also provides a status for quotas - so, we should not evaluate by our own how much resources are left.
Screenshot_20190924_135446
Quotas examples:

---
apiVersion: v1
kind: List
items:
-
  apiVersion: v1
  kind: ResourceQuota
  metadata:
    name: compute-resources-1
  spec:
    hard:
      pods: "1"
      limits.memory: 1Gi
-
  apiVersion: v1
  kind: ResourceQuota
  metadata:
    name: compute-resources-2
  spec:
    hard:
      pods: "2"
      persistentvolumeclaims: "5"
      limits.memory: 2Gi

The error message when user tries to exceed quota:
Screenshot_20190924_140438

And K8s namespace proxy API:
http://127.0.0.1:36011/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/api/v1/namespace/test
Screenshot_20190924_142628
As we can see, K8s Dashboard receives quotas information along with other kinds of namespace information. And OS Dashboard receives bare namespaces and then bare quotas list.
I've put it here since we may want to have one Che K8s Namespace API that will expose resources info as well, or go in OS way and have Namespace and Resources API separately.

P.S. It's not completed an investigation, like there is limits field in Namespace object of K8s Dashboard Proxy API, but hope it will help a person who will work on this issue.

@skabashnyuk skabashnyuk modified the milestones: 7.3.0, 7.x Sep 26, 2019
@skabashnyuk skabashnyuk modified the milestones: 7.x, Backlog - Platform Oct 10, 2019
@sleshchenko sleshchenko added severity/P1 Has a major impact to usage or development of the system. and removed severity/P2 Has a minor but important impact to the usage or development of the system. labels Nov 26, 2019
@che-bot
Copy link
Contributor

che-bot commented May 27, 2020

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

@che-bot che-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 27, 2020
@che-bot che-bot closed this as completed Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

4 participants