From 6885730b6eb634e3fd85ed8d6e34160836bc774d Mon Sep 17 00:00:00 2001 From: Andrey Pavlov Date: Mon, 24 Oct 2016 14:29:43 +0300 Subject: [PATCH] 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 --- doc/source/dsl.rst | 40 ++++++++++++++++++---------------- fuel_ccp/deploy.py | 2 +- fuel_ccp/validation/service.py | 4 ++-- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/doc/source/dsl.rst b/doc/source/dsl.rst index c120261a..09079c0a 100644 --- a/doc/source/dsl.rst +++ b/doc/source/dsl.rst @@ -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 host’s network namespace | false | boolean | false | -+---------------+-----------------------------------------------+----------+------------------+---------+ -| hostPID | Use the host’s 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 host’s network namespace | false | boolean | false | ++---------------+-----------------------------------------------+----------+------------------+------------+ +| hostPID | Use the host’s pid namespace | false | boolean | false | ++---------------+-----------------------------------------------+----------+------------------+------------+ .. _container: diff --git a/fuel_ccp/deploy.py b/fuel_ccp/deploy.py index d5e90233..9f793c60 100644 --- a/fuel_ccp/deploy.py +++ b/fuel_ccp/deploy.py @@ -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 " diff --git a/fuel_ccp/validation/service.py b/fuel_ccp/validation/service.py index afc8e0a5..4ea18d11 100644 --- a/fuel_ccp/validation/service.py +++ b/fuel_ccp/validation/service.py @@ -138,8 +138,8 @@ SERVICE_SCHEMA = { ] } }, - "daemonset": { - "type": "boolean" + "kind": { + "enum": ["Deployment", "DaemonSet"] }, "host-net": { "type": "boolean"