diff --git a/bootstrap/glance/glance-job.yml.j2 b/bootstrap/glance/glance-job.yml.j2 index c41c5c735..b2ea2da82 100644 --- a/bootstrap/glance/glance-job.yml.j2 +++ b/bootstrap/glance/glance-job.yml.j2 @@ -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 }}' diff --git a/bootstrap/keystone/keystone-job.yml.j2 b/bootstrap/keystone/keystone-job.yml.j2 index 643e779ab..9afb77330 100644 --- a/bootstrap/keystone/keystone-job.yml.j2 +++ b/bootstrap/keystone/keystone-job.yml.j2 @@ -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: diff --git a/bootstrap/mariadb/mariadb-job.yml.j2 b/bootstrap/mariadb/mariadb-job.yml.j2 index 0432d463e..192d68221 100644 --- a/bootstrap/mariadb/mariadb-job.yml.j2 +++ b/bootstrap/mariadb/mariadb-job.yml.j2 @@ -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: diff --git a/etc/kolla-kubernetes/kolla-kubernetes.yml b/etc/kolla-kubernetes/kolla-kubernetes.yml new file mode 100644 index 000000000..2f5a4ae6b --- /dev/null +++ b/etc/kolla-kubernetes/kolla-kubernetes.yml @@ -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" diff --git a/kolla_kubernetes/common/file_utils.py b/kolla_kubernetes/common/file_utils.py index 4f2812048..0900a7a06 100644 --- a/kolla_kubernetes/common/file_utils.py +++ b/kolla_kubernetes/common/file_utils.py @@ -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' ) diff --git a/kolla_kubernetes/service.py b/kolla_kubernetes/service.py index 16c28cad2..c1e3b9e99 100644 --- a/kolla_kubernetes/service.py +++ b/kolla_kubernetes/service.py @@ -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: diff --git a/services/keystone/keystone-pod.yml.j2 b/services/keystone/keystone-pod.yml.j2 index 03d532cc2..b675b5daa 100644 --- a/services/keystone/keystone-pod.yml.j2 +++ b/services/keystone/keystone-pod.yml.j2 @@ -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: diff --git a/services/mariadb/mariadb-pod.yml.j2 b/services/mariadb/mariadb-pod.yml.j2 index 89420768e..c3c444883 100644 --- a/services/mariadb/mariadb-pod.yml.j2 +++ b/services/mariadb/mariadb-pod.yml.j2 @@ -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: