Template addresses for etcd

Add a yml file that kolla-kubernetes will use to express variables.
The variables in this yml will have priority over variables in
/etc/kolla/globals.yml when deploying kolla-kubernetes.

Liyi also noted that we should use kolla_virtual_ip_address in
/etc/kolla/globals.yml as the host ip in the meantime.

Partially-implements: blueprint openstack-services

Change-Id: Iae480c42ddb68f3861bd6229dcab64e39cd2d9eb
This commit is contained in:
Ryan Hallisey 2016-05-26 12:43:38 -04:00
parent 6a061eb58a
commit 86a40b86c3
8 changed files with 45 additions and 37 deletions

View File

@ -14,7 +14,7 @@ spec:
name: creating-glance-database
#TODO: Assign the IP to be mariadb's serivce ip exposed by Kubernetes
command: ["usr/bin/ansible", "localhost", "-vvvv", "-m", "mysql_db",
"-a", "login_host='10.0.0.236'
"-a", "login_host='{{ kolla_internal_vip_address }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ glance_database_name }}'"]
@ -35,7 +35,7 @@ spec:
name: creating-glance-user-and-permissions
#TODO: Assign the IP to be mariadb's serivce ip exposed by Kubernetes
command: ["/usr/bin/ansible", "localhost", "-vvvv", "-m", "mysql_user",
"-a", "login_host='10.0.0.236'
"-a", "login_host='{{ kolla_internal_vip_address }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ glance_database_name }}'

View File

@ -14,7 +14,7 @@ spec:
name: creating-keystone-database
#TODO: Assign the IP to be mariadb's serivce ip exposed by Kubernetes
command: ["usr/bin/ansible", "localhost", "-m", "mysql_db",
"-a", "login_host='10.18.57.43'
"-a", "login_host='{{ kolla_internal_vip_address }}'
login_port='{{ mariadb_port }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
@ -36,7 +36,7 @@ spec:
name: creating-keystone-user-and-permissions
#TODO: Assign the IP to be mariadb's serivce ip exposed by Kubernetes
command: ["/usr/bin/ansible", "localhost", "-m", "mysql_user",
"-a", "login_host='10.18.57.43'
"-a", "login_host='{{ kolla_internal_vip_address }}'
login_port='{{ mariadb_port }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
@ -58,25 +58,6 @@ spec:
- name: ANSIBLE_LIBRARY
value: "/usr/share/ansible"
- image: "{{ keystone_image_full }}"
name: keystone-config
volumeMounts:
- mountPath: {{ container_config_directory }}
name: keystone-config
readOnly: true
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: KOLLA_KUBERNETES_BOOTSTRAP
value: ""
- name: KOLLA_CONFIG_STRATEGY
value: "{{ config_strategy }}"
#TODO: Replace with templated values
- name: ETCD_HOST
value: "127.0.0.1"
- name: ETCD_PORT
value: "4001"
- image: "{{ keystone_image_full }}"
name: keystone-endpoints
# TODO: figure out why openstack_auth.* is not readered properly
@ -99,14 +80,14 @@ spec:
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: KOLLA_KUBERNETES_BOOTSTRAP
value: ""
- name: KOLLA_CONFIG_STRATEGY
value: "{{ config_strategy }}"
#TODO: Replace with templated values
- name: ETCD_HOST
value: "127.0.0.1"
value: "{{ etcd_ip_address }}"
- name: ETCD_PORT
value: "4001"
value: "{{ etcd_port }}"
volumes:
- name: keystone-config
configMap:

View File

@ -23,14 +23,14 @@ spec:
- name: KOLLA_KUBERNETES_BOOTSTRAP
value: ""
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
value: "{{ config_strategy }}"
#TODO: Replace with templated values
- name: ETCD_HOST
value: "127.0.0.1"
value: "{{ etcd_ip_address }}"
- name: ETCD_PORT
value: "4001"
value: "{{ etcd_port }}"
- name: DB_ROOT_PASSWORD
value: {{ database_password }}
value: "{{ database_password }}"
volumes:
- name: mariadb-config
configMap:

View File

@ -0,0 +1,16 @@
---
# Any config options specified here will overwrite anything in globals.yml
# at run time.
##############################
# Kolla Kubernetes options
##############################
# For now, set kolla_internal_vip_address in /etc/kolla/globals.yml to use as
# the ip address for all the services.
# kolla_internal_vip_address: "10.10.10.254"
########################
# Kubernetes Cluster
########################
etcd_ip_address: "127.0.0.1"
etcd_port: "4001"

View File

@ -26,6 +26,11 @@ def find_config_file(filename):
filepath = os.path.join('/etc/kolla', filename)
if os.access(filepath, os.R_OK):
return filepath
filepath = os.path.join('/etc/kolla-kubernetes', filename)
if os.access(filepath, os.R_OK):
return filepath
raise exception.KollaDirNotFoundException(
'Unable to detect kolla-kubernetes directory'
)

View File

@ -45,6 +45,12 @@ def _create_working_directory():
def _load_variables_from_file(project_name):
jvars = utils.JvarsDict()
f = file_utils.find_config_file('kolla-kubernetes.yml')
if os.path.exists(f):
with open(f, 'r') as gf:
jvars.set_global_vars(yaml.load(gf))
else:
LOG.warning('Unable to load %s', f)
f = file_utils.find_config_file('globals.yml')
if os.path.exists(f):
with open(f, 'r') as gf:

View File

@ -14,12 +14,11 @@ spec:
name: kolla-logs
env:
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
#TODO: Replace with templated values
value: "{{ config_strategy }}"
- name: ETCD_HOST
value: "127.0.0.1"
value: "{{ etcd_ip_address }}"
- name: ETCD_PORT
value: "4001"
value: "{{ etcd_port }}"
volumes:
- name: keystone-config
configMap:

View File

@ -15,10 +15,11 @@ spec:
env:
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
#TODO: Replace with templated values
- name: ETCD_HOST
value: "127.0.0.1"
value: {{ etcd_ip_address }}
- name: ETCD_PORT
value: "4001"
value: {{ etcd_port }}
volumes:
- name: mariadb-config
configMap: