Overview

CLI command
add-cartridge
DescriptionAdd a cartridge definition.
Command format
add-cartridge -p <JSON_FILE_PATH>

The path to the JSON file that defines the cartridge needs to be defined as the  <JSON_FILE_PATH>  value.

Parameter definitions

Short optionLong optionDescriptionRequiredExample value
-p
--resource-pathFolder path where the JSON file that defines the cartridge is storedYes<STRATOS_SOURCE_HOME>/samples/cartridge/mock/php.json

Sample cartridge JSON

{
  "type": "php",
  "provider": "apache",
  "category": "data",
  "host": "php.stratos.org",
  "displayName": "php",
  "description": "php Cartridge",
  "version": "7",
  "multiTenant": "false",
  "portMapping": [
    {
	  "name": "http-80",
      "protocol": "http",
      "port": "80",
      "proxyPort": "8280"
    },
    {
      "name": "http-22",
      "protocol": "tcp",
      "port": "22",
      "proxyPort": "8222"
    }
  ],
  "deployment": {
    
  },
  "iaasProvider": [
    {
      "type": "mock",
      "imageId": "RegionOne/b4ca55e3-58ab-4937-82ce-817ebd10240e",
      "networkInterfaces": [
        {
          "name": "network-non-routable",
          "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e"
        }
      ],
      "property": [
        {
          "name": "instanceType",
          "value": "RegionOne/aa5f45a2-c6d6-419d-917a-9dd2e3888594"
        },
        {
          "name": "keyPair",
          "value": "reka"
        },
        {
          "name": "securityGroups",
          "value": "default"
        }
      ]
    }
  ]
}

In Stratos 4.1.1, you can specify the kubernetesPortType as NodePort or ClusterIP in Port Mapping.

Access URLs are generated only for the NodePort service type.

{
  "type": "php",
  "category": "framework",
  "provider": "apache",
  "host": "stratos.org",
  "displayName": "PHP",
  "description": "PHP Cartridge",
  "version": "7",
  "multiTenant": true,
  "loadBalancingIPType": "private",
  "metadataKeys": [],
  "portMapping": [
    {
      "name": "http-80",
      "protocol": "http",
      "port": 80,
      "proxyPort": 8280,
      "kubernetesPortType": ""
    },
    {
      "name": "http-80",
      "protocol": "https",
      "port": 443,
      "proxyPort": 8243,
      "kubernetesPortType": ""
    }
  ],
  "iaasProvider": [
    {
      "type": "mock",
      "imageId": "ap-southeast-1/ami-2e0d5a7c",
      "property": [
        {
          "name": "instanceType",
          "value": "m1.medium"
        },
        {
          "name": "keyPair",
          "value": "xxxxxxxx"
        }
      ],
      "networkInterfaces": [
        {
          "networkUuid": "fb9c21f4-0672-48b2-8279-77334bb63a53"
        },
        {
          "networkUuid": "1e43f86f-4165-4f2e-8017-dd4cfb5548b0"
        }
      ]
    },
    {
      "type": "kubernetes",
      "imageId": "stratos/php:4.1.0",
      "property": [
        {
          "name": "KUBERNETES_CONTAINER_CPU",
          "value": "0"
        },
        {
          "name": "KUBERNETES_CONTAINER_MEMORY",
          "value": "0"
        },
        {
          "name": "KUBERNETES_SERVICE_SESSION_AFFINITY",
          "value": "ClientIP"
        },
        {
          "name": "payload_parameter.START_CMD",
          "value": "PCA"
        }
      ],
      "networkInterfaces": []
    }
  ]
}

For information on all the properties that can be used in a cartridge definition, see the Cartridge Property Definitions.

Example

Use case: Add the cartridge that is defined in the <STRATOS_SOURCE_HOME>/samples/cartridge/mock/php.json file.

add-cartridge -p <STRATOS_SOURCE_HOME>/samples/cartridges/mock/php.json

Sample output

Successfully added cartridge.
  • No labels