Giter Site home page Giter Site logo

Comments (7)

rawmind0 avatar rawmind0 commented on August 29, 2024

@jamiebuxxx , the rancher project p-zxsmg where the namespace is assined has CPU/Memory
resources and limits defined??

from terraform-provider-rancher2.

jamiebuxxx avatar jamiebuxxx commented on August 29, 2024

No, the projects do not have CPU/Memory resources and limits defined. And I don't see anything assigned in the GUI. Those are only defined in the namespace using the Terraform plugin.

This would be the preferred method as different namespaces can have different resource needs but still be under the same project.

from terraform-provider-rancher2.

rawmind0 avatar rawmind0 commented on August 29, 2024

Project CPU/Memory resources and limits should be defined before you can define CPU/Memory resources and limits for namespaces assigned to that project. Once project CPU/Memory resources and limits are defined you'll see namespace CPU/Memory resources and limits on the rancher UI.

Something lik that,

resource "rancher2_project" "foo" {
  name = "foo"
  cluster_id = "<clusted_id>"
  resource_quota {
    project_limit {
      limits_cpu = "2000m"
      limits_memory = "2000Mi"
      requests_storage = "2Gi"
    }
    namespace_default_limit {
      limits_cpu = "500m"
      limits_memory = "500Mi"
      requests_storage = "1Gi"
    }
  }
}

resource "rancher2_namespace" "foo" {
  name = "foo"
  project_id = "${rancher2_project.foo.id}"
  resource_quota {
    limit {
      limits_cpu = "100m"
      limits_memory = "100Mi"
      requests_storage = "1Gi"
    }
  }
}

from terraform-provider-rancher2.

jamiebuxxx avatar jamiebuxxx commented on August 29, 2024

Interesting. I remember discussing this issue before. Cause whatever you allocate to the project resource/limits, then the namespace can not allocate over that value. I can see the logic of this concept, but this won't be ideal for our setup.

It will be difficult for us to allocate resources/limits to a project without know how many namespaces will be under a project. This could cause a newly created namespaces to not have limits because the project budget ran out. We saw this a while back with initial Rancher 2 testing.

So then this leads me to another question, why can set the resource/limits of a namespace under a project from the Web UI, but not from this provider? Considering that its extending the Rancher2 API

Screen Shot 2019-08-14 at 9 30 22 AM

kubectl describe ns jenkins-sandbox
Name:         jenkins-sandbox
Labels:       cattle.io/creator=norman
              field.cattle.io/projectId=p-h64wj
Annotations:  cattle.io/status:
                {"Conditions":[{"Type":"InitialRolesPopulated","Status":"True","Message":"","LastUpdateTime":"2019-07-30T22:21:50Z"},{"Type":"ResourceQuot...
              field.cattle.io/containerDefaultResourceLimit: {"limitsCpu":"2000m","requestsCpu":"500m","requestsMemory":"256Mi"}
              field.cattle.io/creatorId: u-j46t4zp7gm
              field.cattle.io/projectId: c-8skfr:p-h64wj
              lifecycle.cattle.io/create.namespace-auth: true
Status:       Active

No resource quota.

Resource Limits
 Type       Resource  Min  Max  Default Request  Default Limit  Max Limit/Request Ratio
 ----       --------  ---  ---  ---------------  -------------  -----------------------
 Container  cpu       -    -    500m             2              -
 Container  memory    -    -    256Mi            -              -

from terraform-provider-rancher2.

rawmind0 avatar rawmind0 commented on August 29, 2024

Interesting. I remember discussing this issue before. Cause whatever you allocate to the project resource/limits, then the namespace can not allocate over that value. I can see the logic of this concept, but this won't be ideal for our setup.

A rancher project is a group of namespaces, then no namespace within a project can't allocate more that project resource/limits.

It will be difficult for us to allocate resources/limits to a project without know how many namespaces will be under a project. This could cause a newly created namespaces to not have limits because the project budget ran out. We saw this a while back with initial Rancher 2 testing.

I got your point, but you'd have same problem on k8s cluster sizing. If you set resource limits on your namespace (good practice), this could cause that newly created namespaces could not get them because k8s cluster don't have enough free resources. I guess that at some point you are going to scale the k8s cluster, you could do the same with the project resource/limits. When you set project resouce/limits and default namespaces resouce/limits, you have an estimation of how many namespaces may fit on it.

So then this leads me to another question, why can set the resource/limits of a namespace under a project from the Web UI, but not from this provider? Considering that its extending the Rancher2 API

You can't set namespace resource/limits from the UI as you can't from this provider. Your screenshot is showing other feature container default resource limit. These limits are applied to containers within the namespace and are managed by a distinct argument, namespace container_resource_limit

from terraform-provider-rancher2.

jamiebuxxx avatar jamiebuxxx commented on August 29, 2024

Ok. Going to let this soak for bit. I would like to avoid breaking away to far from Kubernetes specific derivatives like request, limits, max/min limits. Adding the project resource element is how to think about our clusters.

I think we will need to come up with use cases to try and different ways to handle namespaces and projects for our uses.

from terraform-provider-rancher2.

rawmind0 avatar rawmind0 commented on August 29, 2024

Yeah, it's depending of the offering use case, clusters or projects in shared clusters.

Please, reopen issue if needed.

from terraform-provider-rancher2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.