Hi Devs,

I have now implemented support to specify CPU (number of cores) and Memory
(in MB) in Docker Cartridges. These values will be passed to Kubernetes
when creating a Pod and Kubernetes will limit those resources to containers
accordingly.

If CPU and Memory should not be restricted, above parameter values can be
set to zero. Please find a sample cartridge definition below:

{
    "type": "php",
    "provider": "apache",
    "category": "framework",
    "host": "php.stratos.org",
    "displayName": "php",
    "description": "php Cartridge",
    "version": "7",
    "multiTenant": "false",
    "loadBalancingIPType": "public",
    "portMapping": [
        {
            "protocol": "http",
            "port": "80",
            "proxyPort": "8281"
        }
    ],
    "deployment": {
        "baseDir": "/var/www"
    },
    "iaasProvider": [
        {
            "type": "kubernetes",
            "imageId": "stratos/php:4.1.0-beta",
            "networkInterfaces": [
            ],
            "property": [
            ]
        }
    ],
    "property": [
        {
            "name": "KUBERNETES_CONTAINER_CPU",
            "value": "1"
        },
        {
            "name": "KUBERNETES_CONTAINER_MEMORY",
            "value": "512"
        }
    ]
}

Thanks

-- 
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Reply via email to