diff --git a/magnum/drivers/common/templates/network.yaml b/magnum/drivers/common/templates/network.yaml new file mode 100644 index 0000000000..a51a62ab4e --- /dev/null +++ b/magnum/drivers/common/templates/network.yaml @@ -0,0 +1,60 @@ +heat_template_version: 2014-10-16 + +description: > + Creates network resources for the cluster. allocate a network and + router for our server. + +parameters: + + fixed_network_cidr: + type: string + description: network range for fixed ip network + + fixed_network_name: + type: string + description: fixed network name + default: "" + + dns_nameserver: + type: string + description: address of a dns nameserver reachable in your environment + + external_network: + type: string + description: uuid/name of a network to use for floating ip addresses + +resources: + fixed_network: + type: OS::Neutron::Net + properties: + name: {get_param: fixed_network_name} + + fixed_subnet: + type: OS::Neutron::Subnet + properties: + cidr: {get_param: fixed_network_cidr} + network: {get_resource: fixed_network} + dns_nameservers: + - {get_param: dns_nameserver} + + extrouter: + type: OS::Neutron::Router + properties: + external_gateway_info: + network: {get_param: external_network} + + extrouter_inside: + type: OS::Neutron::RouterInterface + properties: + router_id: {get_resource: extrouter} + subnet: {get_resource: fixed_subnet} + +outputs: + fixed_network: + description: > + Created fixed network ID + value: {get_resource: fixed_network} + fixed_subnet: + description: > + Created fixed subnet ID + value: {get_resource: fixed_subnet} diff --git a/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml b/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml index 53758574a3..64a1ae3176 100644 --- a/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml +++ b/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml @@ -209,35 +209,18 @@ resources: # address lookup in Kubernetes to work properly # - fixed_network: - type: OS::Neutron::Net + network: + type: ../../common/templates/network.yaml properties: - name: private - - fixed_subnet: - type: OS::Neutron::Subnet - properties: - cidr: {get_param: fixed_network_cidr} - network: {get_resource: fixed_network} - dns_nameservers: - - {get_param: dns_nameserver} - - extrouter: - type: OS::Neutron::Router - properties: - external_gateway_info: - network: {get_param: external_network} - - extrouter_inside: - type: OS::Neutron::RouterInterface - properties: - router_id: {get_resource: extrouter} - subnet: {get_resource: fixed_subnet} + fixed_network_cidr: {get_param: fixed_network_cidr} + dns_nameserver: {get_param: dns_nameserver} + external_network: {get_param: external_network} + fixed_network_name: private api_lb: type: ../../common/templates/lb.yaml properties: - fixed_subnet: {get_resource: fixed_subnet} + fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} protocol: {get_param: loadbalancing_protocol} port: {get_param: kubernetes_port} @@ -245,7 +228,7 @@ resources: etcd_lb: type: ../../common/templates/lb.yaml properties: - fixed_subnet: {get_resource: fixed_subnet} + fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} protocol: HTTP port: 2379 @@ -329,7 +312,7 @@ resources: kube_masters: type: OS::Heat::ResourceGroup depends_on: - - extrouter_inside + - network properties: count: {get_param: number_of_masters} resource_def: @@ -346,8 +329,8 @@ resources: flannel_network_subnetlen: {get_param: flannel_network_subnetlen} flannel_backend: {get_param: flannel_backend} portal_network_cidr: {get_param: portal_network_cidr} - fixed_network: {get_resource: fixed_network} - fixed_subnet: {get_resource: fixed_subnet} + fixed_network: {get_attr: [network, fixed_network]} + fixed_subnet: {get_attr: [network, fixed_subnet]} discovery_url: {get_param: discovery_url} network_driver: {get_param: network_driver} kubernetes_port: {get_param: kubernetes_port} @@ -376,7 +359,7 @@ resources: kube_minions: type: OS::Heat::ResourceGroup depends_on: - - extrouter_inside + - network - kube_masters properties: count: {get_param: number_of_minions} @@ -387,8 +370,8 @@ resources: ssh_key_name: {get_param: ssh_key_name} server_image: {get_param: server_image} minion_flavor: {get_param: minion_flavor} - fixed_network: {get_resource: fixed_network} - fixed_subnet: {get_resource: fixed_subnet} + fixed_network: {get_attr: [network, fixed_network]} + fixed_subnet: {get_attr: [network, fixed_subnet]} flannel_network_cidr: {get_param: flannel_network_cidr} kube_master_ip: {get_attr: [api_address_lb_switch, private_ip]} etcd_server_ip: {get_attr: [etcd_address_lb_switch, private_ip]} diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml index 9e7807fcc0..fea34195b6 100644 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml +++ b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml @@ -273,35 +273,18 @@ resources: # address lookup in Kubernetes to work properly # - fixed_network: - type: OS::Neutron::Net + network: + type: ../../common/templates/network.yaml properties: - name: private - - fixed_subnet: - type: OS::Neutron::Subnet - properties: - cidr: {get_param: fixed_network_cidr} - network: {get_resource: fixed_network} - dns_nameservers: - - {get_param: dns_nameserver} - - extrouter: - type: OS::Neutron::Router - properties: - external_gateway_info: - network: {get_param: external_network} - - extrouter_inside: - type: OS::Neutron::RouterInterface - properties: - router_id: {get_resource: extrouter} - subnet: {get_resource: fixed_subnet} + fixed_network_cidr: {get_param: fixed_network_cidr} + dns_nameserver: {get_param: dns_nameserver} + external_network: {get_param: external_network} + fixed_network_name: private api_lb: type: ../../common/templates/lb.yaml properties: - fixed_subnet: {get_resource: fixed_subnet} + fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} protocol: {get_param: loadbalancing_protocol} port: {get_param: kubernetes_port} @@ -309,7 +292,7 @@ resources: etcd_lb: type: ../../common/templates/lb.yaml properties: - fixed_subnet: {get_resource: fixed_subnet} + fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} protocol: HTTP port: 2379 @@ -396,7 +379,7 @@ resources: kube_masters: type: OS::Heat::ResourceGroup depends_on: - - extrouter_inside + - network properties: count: {get_param: number_of_masters} resource_def: @@ -420,8 +403,8 @@ resources: discovery_url: {get_param: discovery_url} cluster_uuid: {get_param: cluster_uuid} magnum_url: {get_param: magnum_url} - fixed_network: {get_resource: fixed_network} - fixed_subnet: {get_resource: fixed_subnet} + fixed_network: {get_attr: [network, fixed_network]} + fixed_subnet: {get_attr: [network, fixed_subnet]} api_pool_id: {get_attr: [api_lb, pool_id]} etcd_pool_id: {get_attr: [etcd_lb, pool_id]} username: {get_param: username} @@ -449,7 +432,7 @@ resources: kube_minions: type: OS::Heat::ResourceGroup depends_on: - - extrouter_inside + - network properties: count: {get_param: number_of_minions} removal_policies: [{resource_list: {get_param: minions_to_remove}}] @@ -459,8 +442,8 @@ resources: ssh_key_name: {get_param: ssh_key_name} server_image: {get_param: server_image} minion_flavor: {get_param: minion_flavor} - fixed_network: {get_resource: fixed_network} - fixed_subnet: {get_resource: fixed_subnet} + fixed_network: {get_attr: [network, fixed_network]} + fixed_subnet: {get_attr: [network, fixed_subnet]} network_driver: {get_param: network_driver} flannel_network_cidr: {get_param: flannel_network_cidr} kube_master_ip: {get_attr: [api_address_lb_switch, private_ip]} diff --git a/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml b/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml index f07f671ef6..1b9d00c369 100644 --- a/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml +++ b/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml @@ -204,33 +204,17 @@ resources: # network resources. allocate a network and router for our server. # - fixed_network: - type: OS::Neutron::Net - - fixed_subnet: - type: OS::Neutron::Subnet - properties: - cidr: {get_param: fixed_network_cidr} - network: {get_resource: fixed_network} - dns_nameservers: - - {get_param: dns_nameserver} - - extrouter: - type: OS::Neutron::Router + network: + type: ../../common/templates/network.yaml properties: - external_gateway_info: - network: {get_param: external_network} - - extrouter_inside: - type: OS::Neutron::RouterInterface - properties: - router_id: {get_resource: extrouter} - subnet: {get_resource: fixed_subnet} + fixed_network_cidr: {get_param: fixed_network_cidr} + dns_nameserver: {get_param: dns_nameserver} + external_network: {get_param: external_network} api_lb: type: ../../common/templates/lb.yaml properties: - fixed_subnet: {get_resource: fixed_subnet} + fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} protocol: HTTP port: 8080 @@ -373,7 +357,7 @@ resources: mesos_masters: type: OS::Heat::ResourceGroup depends_on: - - extrouter_inside + - network properties: count: {get_param: number_of_masters} resource_def: @@ -383,8 +367,8 @@ resources: server_image: {get_param: server_image} master_flavor: {get_param: master_flavor} external_network: {get_param: external_network} - fixed_network: {get_resource: fixed_network} - fixed_subnet: {get_resource: fixed_subnet} + fixed_network: {get_attr: [network, fixed_network]} + fixed_subnet: {get_attr: [network, fixed_subnet]} secgroup_mesos_id: {get_resource: secgroup_master} api_pool_id: {get_attr: [api_lb, pool_id]} @@ -397,7 +381,7 @@ resources: mesos_slaves: type: OS::Heat::ResourceGroup depends_on: - - extrouter_inside + - network properties: count: {get_param: number_of_slaves} removal_policies: [{resource_list: {get_param: slaves_to_remove}}] @@ -407,8 +391,8 @@ resources: ssh_key_name: {get_param: ssh_key_name} server_image: {get_param: server_image} slave_flavor: {get_param: slave_flavor} - fixed_network: {get_resource: fixed_network} - fixed_subnet: {get_resource: fixed_subnet} + fixed_network: {get_attr: [network, fixed_network]} + fixed_subnet: {get_attr: [network, fixed_subnet]} mesos_masters_ips: {list_join: [' ', {get_attr: [mesos_masters, mesos_master_ip]}]} external_network: {get_param: external_network} wait_condition_timeout: {get_param: wait_condition_timeout} diff --git a/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml b/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml index ca423450ae..6246d00343 100644 --- a/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml +++ b/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml @@ -243,42 +243,17 @@ resources: # etc, as parameters), but I wanted to minmize the amount of # configuration necessary to make this go. - fixed_network: - type: "OS::Neutron::Net" - - # This is the subnet on which we will deploy our server. - fixed_subnet: - type: "OS::Neutron::Subnet" - properties: - cidr: {get_param: fixed_network_cidr} - network_id: - get_resource: fixed_network - dns_nameservers: - - get_param: dns_nameserver - - # create a router attached to the external network provided as a - # parameter to this stack. - extrouter: - type: "OS::Neutron::Router" + network: + type: ../../common/templates/network.yaml properties: - external_gateway_info: - network: - get_param: external_network - - # attached fixed_subnet to our extrouter router. - extrouter_inside: - type: "OS::Neutron::RouterInterface" - properties: - router_id: - get_resource: extrouter - subnet_id: - get_resource: - fixed_subnet + fixed_network_cidr: {get_param: fixed_network_cidr} + dns_nameserver: {get_param: dns_nameserver} + external_network: {get_param: external_network} api_lb: type: ../../common/templates/lb.yaml properties: - fixed_subnet: {get_resource: fixed_subnet} + fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} protocol: {get_param: loadbalancing_protocol} port: {get_param: swarm_port} @@ -286,7 +261,7 @@ resources: etcd_lb: type: ../../common/templates/lb.yaml properties: - fixed_subnet: {get_resource: fixed_subnet} + fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} protocol: HTTP port: 2379 @@ -335,7 +310,7 @@ resources: swarm_masters: type: "OS::Heat::ResourceGroup" depends_on: - - extrouter_inside + - network properties: count: {get_param: number_of_masters} resource_def: @@ -346,8 +321,8 @@ resources: server_flavor: {get_param: master_flavor} docker_volume_size: {get_param: docker_volume_size} docker_storage_driver: {get_param: docker_storage_driver} - fixed_network_id: {get_resource: fixed_network} - fixed_subnet_id: {get_resource: fixed_subnet} + fixed_network_id: {get_attr: [network, fixed_network]} + fixed_subnet_id: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} discovery_url: {get_param: discovery_url} http_proxy: {get_param: http_proxy} @@ -379,7 +354,7 @@ resources: swarm_nodes: type: "OS::Heat::ResourceGroup" depends_on: - - extrouter_inside + - network properties: count: {get_param: number_of_nodes} resource_def: @@ -390,8 +365,8 @@ resources: server_flavor: {get_param: node_flavor} docker_volume_size: {get_param: docker_volume_size} docker_storage_driver: {get_param: docker_storage_driver} - fixed_network_id: {get_resource: fixed_network} - fixed_subnet_id: {get_resource: fixed_subnet} + fixed_network_id: {get_attr: [network, fixed_network]} + fixed_subnet_id: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} http_proxy: {get_param: http_proxy} https_proxy: {get_param: https_proxy}