Skip to content

Add resource quotas to create project tool#52

Open
JonCrowther wants to merge 1 commit into
rancher:mainfrom
JonCrowther:add-project-resource-quotas
Open

Add resource quotas to create project tool#52
JonCrowther wants to merge 1 commit into
rancher:mainfrom
JonCrowther:add-project-resource-quotas

Conversation

@JonCrowther

Copy link
Copy Markdown
Contributor

Improve the current project creation tool with the notion of resource quotas. Tested with gpt:20b and sonnet.

@JonCrowther JonCrowther self-assigned this Mar 10, 2026

@raulcabello raulcabello left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems complicated to create projects with quotas using Liz. I'm not sure if users will understand how to use this tool properly.

RequestsStorage int `json:"requestsStorage,omitempty" jsonschema:"the amount of storage resources (MiB) reserved for containers in the project"`
LimitsCPU int `json:"limitsCpu,omitempty" jsonschema:"the maximum amount of CPU resources (mCPUs) that can be used by containers in the project"`
LimitsMemory int `json:"limitsMemory,omitempty" jsonschema:"the maximum amount of memory resources (MiB) that can be used by containers in the project"`
Extended map[string]any `json:"extended,omitempty" jsonschema:"a map of any additional resource quotas to be applied to the project, where the key is the name of the resource quota and the value is the quantity (e.g., '10Gi' for storage)"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this field used for? LLM tries to add a string in the Extended field and returns an error.

Comment on lines +279 to +299
cpuLimit (string, optional): The maximum amount of CPU resources (in mCPUs) that can be used by containers in the project.
cpuReservation (string, optional): The amount of CPU resources (in mCPUs) reserved for containers in the project.
memoryLimit (string, optional): The maximum amount of memory resources (in MiB) that can be used by containers in the project.
memoryReservation (string, optional): The amount of memory resources (in MiB) reserved for containers in the project.
resourceQuota (object, optional): An optional object specifying resource quotas for the project.
namespaceDefaultResourceQuota (object, optional): An optional object specifying default resource quotas for namespaces in the project.
Parameters for resourceQuota and namespaceDefaultResourceQuota JSON objects:
pods (int, optional): The maximum number of pods that can be created in the project or in each namespace within the project.
services (int, optional): The maximum number of services that can be created in the project or in each namespace within the project.
replicationControllers (int, optional): The maximum number of replication controllers that can be created in the project or in each namespace within the project.
secrets (int, optional): The maximum number of secrets that can be created in the project or in each namespace within the project.
configMaps (int, optional): The maximum number of config maps that can be created in the project or in each namespace within the project.
persistentVolumeClaims (int, optional): The maximum number of persistent volume claims that can be created in the project or in each namespace within the project.
servicesNodePorts (int, optional): The maximum number of service node ports that can be created in the project or in each namespace within the project.
servicesLoadBalancers (int, optional): The maximum number of service load balancers that can be created in the project or in each namespace within the project.
requestsCpu (int, optional): The amount of CPU resources (in mCPUs) that is requested by default for each namespace within the project.
requestsMemory (int, optional): The amount of memory resources (in MiB) that is requested by default for each namespace within the project.
requestsStorage (int, optional): The amount of storage resources (in MiB) that is requested by default for each namespace within the project.
limitsCPU (int, optional): The maximum amount of CPU resources (in mCPUs) that can be used by the project or by each namespace within the project.
limitsMemory (int, optional): The maximum amount of memory resources (in MiB) that can be used by the project or by each namespace within the project.
extended (object, optional): An optional field that can be used to specify any additional resource quotas in the format required by the Rancher API. This field is useful for specifying quotas that are not covered by the other fields, such as quotas for custom resources or for specific Kubernetes features. The value of this field should be a JSON object that represents the additional quotas to be applied to the project or namespaces within the project. The key should be the name of the quota field and the value should be the quota limit in the appropriate unit.`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These parameters need to be described in the jsonschema of the params struct as discussed. This is what we send to the LLM now:

{
                "name": "createProject",
                "description": "Creates a project resource for a specified cluster with the given containerResourceQuota.\n\t\tParameters:\n\t\tcluster (string): The name of the cluster the project belongs to.\n\t\tname (string): The name of the project to be created.\n\t\tdescription (string, optional): An optional description for the project.\n\t\tdisplayName (string, optional): An optional display name for the project.\n\t\tcpuLimit (string, optional): The maximum amount of CPU resources (in mCPUs) that can be used by containers in the project.\n\t\tcpuReservation (string, optional): The amount of CPU resources (in mCPUs) reserved for containers in the project.\n\t\tmemoryLimit (string, optional): The maximum amount of memory resources (in MiB) that can be used by containers in the project.\n\t\tmemoryReservation (string, optional): The amount of memory resources (in MiB) reserved for containers in the project.",
                "parameters": {
                    "type": "object",
                    "required": [
                        "cluster",
                        "name"
                    ],
                    "properties": {
                        "cluster": {
                            "type": "string",
                            "description": "the cluster that the project belongs to"
                        },
                        "containerDefaultResourceLimit": {
                            "type": "object",
                            "description": "optional default resource limits to be applied to containers created within the project",
                            "properties": {
                                "cpuLimit": {
                                    "type": "integer",
                                    "description": "the maximum amount of CPU resources (mCPUs) that can be used by containers in the project"
                                },
                                "cpuReservation": {
                                    "type": "integer",
                                    "description": "the amount of CPU resources (mCPUs) reserved for containers in the project"
                                },
                                "memoryLimit": {
                                    "type": "integer",
                                    "description": "the maximum amount of memory resources (MiB) that can be used by containers in the project"
                                },
                                "memoryReservation": {
                                    "type": "integer",
                                    "description": "the amount of memory resources (MiB) reserved for containers in the project"
                                }
                            },
                            "additionalProperties": false
                        },
                        "description": {
                            "type": "string",
                            "description": "an optional description for the project"
                        },
                        "displayName": {
                            "type": "string",
                            "description": "an optional display name for the project"
                        },
                        "name": {
                            "type": "string",
                            "description": "the name of the project to be created"
                        },
                        "namespaceDefaultResourceQuota": {
                            "type": "object",
                            "description": "optional default resource quotas to be applied to namespaces created within the project",
                            "properties": {
                                "configMaps": {
                                    "type": "integer",
                                    "description": "the maximum number of config maps that can be created in the project"
                                },
                                "extended": {
                                    "type": "object",
                                    "description": "a map of any additional resource quotas to be applied to the project, where the key is the name of the resource quota and the value is the quantity (e.g., '10Gi' for storage)",
                                    "additionalProperties": true
                                },
                                "limitsCpu": {
                                    "type": "integer",
                                    "description": "the maximum amount of CPU resources (mCPUs) that can be used by containers in the project"
                                },
                                "limitsMemory": {
                                    "type": "integer",
                                    "description": "the maximum amount of memory resources (MiB) that can be used by containers in the project"
                                },
                                "persistentVolumeClaims": {
                                    "type": "integer",
                                    "description": "the maximum number of persistent volume claims that can be created in the project"
                                },
                                "pods": {
                                    "type": "integer",
                                    "description": "the maximum number of pods that can be created in the project"
                                },
                                "replicationControllers": {
                                    "type": "integer",
                                    "description": "the maximum number of replication controllers that can be created in the project"
                                },
                                "requestsCpu": {
                                    "type": "integer",
                                    "description": "the amount of CPU resources (mCPUs) reserved for containers in the project"
                                },
                                "requestsMemory": {
                                    "type": "integer",
                                    "description": "the amount of memory resources (MiB) reserved for containers in the project"
                                },
                                "requestsStorage": {
                                    "type": "integer",
                                    "description": "the amount of storage resources (MiB) reserved for containers in the project"
                                },
                                "secrets": {
                                    "type": "integer",
                                    "description": "the maximum number of secrets that can be created in the project"
                                },
                                "services": {
                                    "type": "integer",
                                    "description": "the maximum number of services that can be created in the project"
                                },
                                "servicesLoadBalancers": {
                                    "type": "integer",
                                    "description": "the maximum number of services with load balancers that can be created in the project"
                                },
                                "servicesNodePorts": {
                                    "type": "integer",
                                    "description": "the maximum number of services with node ports that can be created in the project"
                                }
                            },
                            "additionalProperties": false
                        },
                        "resourceQuota": {
                            "type": "object",
                            "description": "optional resource quotas to be applied to the project",
                            "properties": {
                                "configMaps": {
                                    "type": "integer",
                                    "description": "the maximum number of config maps that can be created in the project"
                                },
                                "extended": {
                                    "type": "object",
                                    "description": "a map of any additional resource quotas to be applied to the project, where the key is the name of the resource quota and the value is the quantity (e.g., '10Gi' for storage)",
                                    "additionalProperties": true
                                },
                                "limitsCpu": {
                                    "type": "integer",
                                    "description": "the maximum amount of CPU resources (mCPUs) that can be used by containers in the project"
                                },
                                "limitsMemory": {
                                    "type": "integer",
                                    "description": "the maximum amount of memory resources (MiB) that can be used by containers in the project"
                                },
                                "persistentVolumeClaims": {
                                    "type": "integer",
                                    "description": "the maximum number of persistent volume claims that can be created in the project"
                                },
                                "pods": {
                                    "type": "integer",
                                    "description": "the maximum number of pods that can be created in the project"
                                },
                                "replicationControllers": {
                                    "type": "integer",
                                    "description": "the maximum number of replication controllers that can be created in the project"
                                },
                                "requestsCpu": {
                                    "type": "integer",
                                    "description": "the amount of CPU resources (mCPUs) reserved for containers in the project"
                                },
                                "requestsMemory": {
                                    "type": "integer",
                                    "description": "the amount of memory resources (MiB) reserved for containers in the project"
                                },
                                "requestsStorage": {
                                    "type": "integer",
                                    "description": "the amount of storage resources (MiB) reserved for containers in the project"
                                },
                                "secrets": {
                                    "type": "integer",
                                    "description": "the maximum number of secrets that can be created in the project"
                                },
                                "services": {
                                    "type": "integer",
                                    "description": "the maximum number of services that can be created in the project"
                                },
                                "servicesLoadBalancers": {
                                    "type": "integer",
                                    "description": "the maximum number of services with load balancers that can be created in the project"
                                },
                                "servicesNodePorts": {
                                    "type": "integer",
                                    "description": "the maximum number of services with node ports that can be created in the project"
                                }
                            },
                            "additionalProperties": false
                        }
                    },
                    "additionalProperties": false
                }
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants