Changing "daemonset" flag in service def to "kind" param

We want to alling with k8s definitions and it would be more convenient
to have one param instead of several flags.

Change-Id: I2db5a09dba5af508ad0f40f3c17ab22395e86576
Depends-On: I378f7fd3e89ac12e9f6d16fca3591d09ff33d4f9
Depends-On: Iecff0370dbec342779b0d07a96b84a196522ca77
Depends-On: I44b62597413322846c1ac538df860175ba560956
This commit is contained in:
Andrey Pavlov 2016-10-24 14:29:43 +03:00
parent f6ae9c6884
commit 6885730b6e
3 changed files with 24 additions and 22 deletions

View File

@ -11,9 +11,9 @@ Application definition template
service:
name: service-name
kind: DaemonSet
ports:
- internal-port:external-port
daemonset: true
host-net: true
hostPID: true
containers:
@ -77,24 +77,26 @@ Parameters description
**service**
+---------------+-----------------------------------------------+----------+------------------+---------+
| Name | Description | Required | Schema | Default |
+===============+===============================================+==========+==================+=========+
| name | Name of the service. | true | string | |
+---------------+-----------------------------------------------+----------+------------------+---------+
| containers | List of containers under multi-container pod | true | container_ array | |
+---------------+-----------------------------------------------+----------+------------------+---------+
| ports | k8s Service will be created if specified | false | internal-port: | |
| | (with NodePort type for now) | | external-port | |
| | Only internal or both internal:external ports | | array | |
| | can be specified | | | |
+---------------+-----------------------------------------------+----------+------------------+---------+
| daemonset | Create DaemonSet instead of Deployment | false | boolean | false |
+---------------+-----------------------------------------------+----------+------------------+---------+
| host-net | Use the hosts network namespace | false | boolean | false |
+---------------+-----------------------------------------------+----------+------------------+---------+
| hostPID | Use the hosts pid namespace | false | boolean | false |
+---------------+-----------------------------------------------+----------+------------------+---------+
+---------------+-----------------------------------------------+----------+------------------+------------+
| Name | Description | Required | Schema | Default |
+===============+===============================================+==========+==================+============+
| name | Name of the service. | true | string | |
+---------------+-----------------------------------------------+----------+------------------+------------+
| kind | Kind of k8s object to use for containers | false | one of: | Deployment |
| | deployment | | ["Deployment", | |
| | | | "Daemonset"] | |
+---------------+-----------------------------------------------+----------+------------------+------------+
| containers | List of containers under multi-container pod | true | container_ array | |
+---------------+-----------------------------------------------+----------+------------------+------------+
| ports | k8s Service will be created if specified | false | internal-port: | |
| | (with NodePort type for now) | | external-port | |
| | Only internal or both internal:external ports | | array | |
| | can be specified | | | |
+---------------+-----------------------------------------------+----------+------------------+------------+
| host-net | Use the hosts network namespace | false | boolean | false |
+---------------+-----------------------------------------------+----------+------------------+------------+
| hostPID | Use the hosts pid namespace | false | boolean | false |
+---------------+-----------------------------------------------+----------+------------------+------------+
.. _container:

View File

@ -98,7 +98,7 @@ def parse_role(component, topology, configmaps):
affinity = templates.serialize_affinity(service, topology)
replicas = CONF.replicas.get(service_name)
if service.get("daemonset", False):
if service.get("kind") == 'DaemonSet':
if replicas is not None:
LOG.error("Replicas was specified for %s, but it's implemented "
"using Kubernetes DaemonSet that will deploy service on "

View File

@ -138,8 +138,8 @@ SERVICE_SCHEMA = {
]
}
},
"daemonset": {
"type": "boolean"
"kind": {
"enum": ["Deployment", "DaemonSet"]
},
"host-net": {
"type": "boolean"