OK. In my opinion, service create will follow this way:
1. get bay stack, check whether it is in UPDATE_COMPLETE or CREATE_COMPLETE state. if no, return state error.
2. create namespace service with k8s api.
3. get the response of the creating namespace service. check the ports, whether it has "node_port". if no, return service.
4. get the bay stack template, and then modify the template. I pick part of my template here:
service_pool_template = """
%(service_pool)s:
type: OS::Neutron::Pool
properties:
protocol: {get_param: loadbalancing_protocol}
subnet: {get_resource: fixed_subnet}
lb_method: ROUND_ROBIN
vip:
protocol_port: %(port)s
service_output_template = """
%(service_address)s:
value:
str_replace:
template: service_ip_address
params:
service_ip_address: {get_attr: [%(service_pool_floating)s, floating_ip_address]}
description: >
This is the Service endpoint of %(service_pool)s.
"""
service_pool_template is using to create pool and floating ip for service.
service_pool_memeber_template is using to create pool member for pool. every node will be a pool member.
service_output_template is using to output the floating ip as the service ip.
5. update the bay stack with new template.
OK. In my opinion, service create will follow this way: pool_template = """ pool)s: protocol}
1. get bay stack, check whether it is in UPDATE_COMPLETE or CREATE_COMPLETE state. if no, return state error.
2. create namespace service with k8s api.
3. get the response of the creating namespace service. check the ports, whether it has "node_port". if no, return service.
4. get the bay stack template, and then modify the template. I pick part of my template here:
service_
%(service_
type: OS::Neutron::Pool
properties:
protocol: {get_param: loadbalancing_
subnet: {get_resource: fixed_subnet}
lb_method: ROUND_ROBIN
vip:
protocol_port: %(port)s
%(service_ pool_floating) s: :FloatingIP network: {get_param: external_network}
type: OS::Neutron:
depends_on:
- extrouter_inside
properties:
floating_
port_id: {get_attr: [%(service_pool)s, vip, port_id]}
"""
service_ pool_memeber_ template = """ pool_member) s: :PoolMember
%(service_
type: OS::Neutron:
properties:
pool_id: {get_resource: %(service_pool)s}
address: {get_attr: [kube_minions, kube_minion_ip, %(node_count)s]}
protocol_port: %(node_port)s
"""
service_ output_ template = """ address) s: ip_address: {get_attr: [%(service_ pool_floating) s, floating_ ip_address] }
%(service_
value:
str_replace:
template: service_ip_address
params:
service_
description: >
This is the Service endpoint of %(service_pool)s.
"""
service_ pool_template is using to create pool and floating ip for service. pool_memeber_ template is using to create pool member for pool. every node will be a pool member. output_ template is using to output the floating ip as the service ip.
service_
service_
5. update the bay stack with new template.