01af88a83d110d8842e30a46b74763e818fa1cad
[snaps.git] / snaps / domain / cluster_template.py
1 # Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs")
2 #                    and others.  All rights reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16
17 class ClusterTemplate(object):
18     """
19     Class for OpenStack cluster template domain object
20     """
21
22     def __init__(self, **kwargs):
23         """
24         Constructor
25         :param id: the cluster template's UUID
26         :param name: the cluster template's name
27         :param image: name or ID of the base image in Glance used to boot the
28                       cluster's servers. The image must have the attribute
29                       'os-distro' defined as appropriate for the cluster
30                       driver
31         :param keypair: name or ID of the keypair to gain cluster machine
32                         access
33         :param network_driver: The name of a network driver for providing the
34                                networks for the containers. Note that this is
35                                different and separate from the Neutron network
36                                for the bay/cluster. The operation and
37                                networking model are specific to the particular
38                                driver
39         :param external_net: name or IDof the external Neutron network to
40                              provide connectivity to the cluster
41         :param floating_ip_enabled: Whether enable or not using the floating IP
42                                     of cloud provider. Some cloud providers
43                                     used floating IP, some used public IP,
44                                     thus Magnum provide this option for
45                                     specifying the choice of using floating IP
46         :param docker_volume_size: The size in GB for the local storage on each
47                                    server for the Docker daemon to cache the
48                                    images and host the containers. Cinder
49                                    volumes provide the storage. The default is
50                                    25 GB. For the devicemapper storage driver,
51                                    the minimum value is 3GB. For the overlay
52                                    storage driver, the minimum value is 1GB.
53         :param server_type: server type string
54         :param flavor: name or ID of the nova flavor for booting the node
55                        servers
56         :param master_flavor: name or ID of the nova flavor of the master node
57                               for this cluster
58         :param coe: ContainerOrchestrationEngine enum instance
59         :param fixed_net: name of a Neutron network to provide connectivity
60                           to the internal network for the cluster
61         :param fixed_subnet: Fixed subnet that are using to allocate network
62                              address for nodes in bay/cluster
63         :param registry_enabled: Docker images by default are pulled from the
64                                  public Docker registry, but in some cases,
65                                  users may want to use a private registry.
66                                  This option provides an alternative registry
67                                  based on the Registry V2: Magnum will create a
68                                  local registry in the bay/cluster backed by
69                                  swift to host the images
70         :param insecure_registry: The URL pointing to the user's own private
71                                   insecure docker registry to deploy and run
72                                   docker containers
73         :param docker_storage_driver: DockerStorageDriver enum instance to
74                                       manage storage for the images and
75                                       container's writable layer
76         :param dns_nameserver: The DNS nameserver for the servers and
77                                containers in the bay/cluster to use.
78                                This is configured in the private Neutron
79                                network for the bay/cluster.
80         :param public: denotes whether or not the cluster type is public
81         :param tls_disabled: denotes whether or not TLS should be enabled
82         :param http_proxy: host:port for a proxy to use when direct HTTP
83                            access from the servers to sites on the external
84                            internet is blocked
85         :param https_proxy: host:port for a proxy to use when direct HTTPS
86                             access from the servers to sites on the external
87                             internet is blocked
88         :param no_proxy: comma separated list of IPs that should not be
89                          redirected through the proxy
90         :param volume_driver: The name of a volume driver for managing the
91                               persistent storage for the containers. The
92                               functionality supported are specific to the
93                               driver
94         :param master_lb_enabled: Since multiple masters may exist in a
95                                   bay/cluster, a Neutron load balancer is
96                                   created to provide the API endpoint for the
97                                   bay/cluster and to direct requests to the
98                                   masters. In some cases, such as when the
99                                   LBaaS service is not available, this option
100                                   can be set to false to create a bay/cluster
101                                   without the load balancer. In this case, one
102                                   of the masters will serve as the API endpoint
103         :param labels: Arbitrary labels in the form of a dict. The accepted
104                        keys and valid values are defined in the bay/cluster
105                        drivers. They are used as a way to pass additional
106                        parameters that are specific to a bay/cluster driver.
107         """
108         self.id = kwargs.get('id')
109         self.name = kwargs.get('name')
110         self.image = kwargs.get('image')
111         self.keypair = kwargs.get('keypair')
112         self.network_driver = kwargs.get('network_driver')
113         self.external_net = kwargs.get('external_net')
114         self.floating_ip_enabled = kwargs.get('floating_ip_enabled')
115         self.docker_volume_size = int(kwargs.get('docker_volume_size', 3))
116         self.server_type = kwargs.get('server_type')
117         self.flavor = kwargs.get('flavor')
118         self.master_flavor = kwargs.get('master_flavor')
119         self.coe = kwargs.get('coe')
120         self.fixed_net = kwargs.get('fixed_net')
121         self.fixed_subnet = kwargs.get('fixed_subnet')
122         self.registry_enabled = kwargs.get('registry_enabled')
123         self.insecure_registry = kwargs.get('insecure_registry')
124         self.docker_storage_driver = kwargs.get('docker_storage_driver')
125         self.dns_nameserver = kwargs.get('dns_nameserver')
126         self.public = kwargs.get('public', False)
127         self.tls_disabled = kwargs.get('tls_disabled')
128         self.http_proxy = kwargs.get('http_proxy')
129         self.https_proxy = kwargs.get('https_proxy')
130         self.no_proxy = kwargs.get('no_proxy')
131         self.volume_driver = kwargs.get('volume_driver')
132         self.master_lb_enabled = kwargs.get('master_lb_enabled', True)
133         self.labels = kwargs.get('labels')