From 3470a4a0d81047d9d65a4b1e1e3b18e47865d4b6 Mon Sep 17 00:00:00 2001 From: Narinder Gupta Date: Fri, 23 Dec 2016 12:47:49 -0600 Subject: [PATCH] modified to add load balancer kubernetes. Change-Id: I87218dd9717c386db1ea721821d0d0e1bf4a08f9 Signed-off-by: Narinder Gupta --- ci/config_tpl/juju2/bundle_tpl/keystone.yaml | 2 +- ci/config_tpl/juju2/bundlek8_tpl/bundle.yaml | 4 ++++ ci/config_tpl/juju2/bundlek8_tpl/etcd.yaml | 10 ++++++++ .../juju2/bundlek8_tpl/kubeapi-load-balancer.yaml | 8 +++++++ ci/config_tpl/juju2/bundlek8_tpl/relations.yaml | 28 +++++++++++++++------- ci/default_deployment_config.yaml | 2 ++ ci/genK8Bundle.py | 4 ++++ ci/kubernates/fetch-charms.sh | 1 + 8 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 ci/config_tpl/juju2/bundlek8_tpl/kubeapi-load-balancer.yaml diff --git a/ci/config_tpl/juju2/bundle_tpl/keystone.yaml b/ci/config_tpl/juju2/bundle_tpl/keystone.yaml index bbb23584..5a8e16c1 100644 --- a/ci/config_tpl/juju2/bundle_tpl/keystone.yaml +++ b/ci/config_tpl/juju2/bundle_tpl/keystone.yaml @@ -18,7 +18,7 @@ region: {{ os.region }} admin-role: {{ os.admin.role }} keystone-admin-role: {{ os.admin.role }} - preferred-api-version: 3 + preferred-api-version: 2 {% if os.network.ipv6 %} prefer-ipv6: {{ os.network.ipv6 }} {% endif %} diff --git a/ci/config_tpl/juju2/bundlek8_tpl/bundle.yaml b/ci/config_tpl/juju2/bundlek8_tpl/bundle.yaml index 7af74afa..17281be1 100644 --- a/ci/config_tpl/juju2/bundlek8_tpl/bundle.yaml +++ b/ci/config_tpl/juju2/bundlek8_tpl/bundle.yaml @@ -16,6 +16,10 @@ {% include 'easyrsa.yaml' %} {% include 'etcd.yaml' %} {% include 'subordinate.yaml' %} +{% if os.kubernetes.loadbalancer %} +{% include 'kubeapi-load-balancer.yaml' %} +{% endif %} + relations: - [ 'ntp:juju-info', 'nodes:juju-info' ] diff --git a/ci/config_tpl/juju2/bundlek8_tpl/etcd.yaml b/ci/config_tpl/juju2/bundlek8_tpl/etcd.yaml index ba99d0e9..eaea9543 100644 --- a/ci/config_tpl/juju2/bundlek8_tpl/etcd.yaml +++ b/ci/config_tpl/juju2/bundlek8_tpl/etcd.yaml @@ -1,6 +1,16 @@ etcd: charm: "./{{ ubuntu.release }}/etcd" +{% if os.kubernetes.loadbalancer %} + num_units: 3 +{% else %} num_units: 1 +{% endif %} to: +{% if os.kubernetes.loadbalancer %} +{% for unit_id in to_select() %} + - "nodes/{{ unit_id }}" +{% endfor %} +{% else %} - "nodes/0" +{% endif %} diff --git a/ci/config_tpl/juju2/bundlek8_tpl/kubeapi-load-balancer.yaml b/ci/config_tpl/juju2/bundlek8_tpl/kubeapi-load-balancer.yaml new file mode 100644 index 00000000..08e7b33a --- /dev/null +++ b/ci/config_tpl/juju2/bundlek8_tpl/kubeapi-load-balancer.yaml @@ -0,0 +1,8 @@ + + kubeapi-load-balancer: + charm: "./{{ ubuntu.release }}/kubeapi-load-balancer" + num_units: 1 + expose: true + to: + - "nodes/0" + diff --git a/ci/config_tpl/juju2/bundlek8_tpl/relations.yaml b/ci/config_tpl/juju2/bundlek8_tpl/relations.yaml index fd56090c..63fefab4 100644 --- a/ci/config_tpl/juju2/bundlek8_tpl/relations.yaml +++ b/ci/config_tpl/juju2/bundlek8_tpl/relations.yaml @@ -1,9 +1,19 @@ - - [ "kubernetes-master:kube-api-endpoint", "kubernetes-worker:kube-api-endpoint" ] - - [ "kubernetes-master:cluster-dns", "kubernetes-worker:kube-dns" ] - - [ "kubernetes-master:certificates", "easyrsa:client" ] - - [ "kubernetes-master:etcd", "etcd:db" ] - - [ "kubernetes-worker:certificates", "easyrsa:client" ] - - [ "flannel:etcd", "etcd:db" ] - - [ "flannel:cni", "kubernetes-master:cni" ] - - [ "flannel:cni", "kubernetes-worker:cni" ] - - [ "etcd:certificates", "easyrsa:client" ] +{% if os.kubernetes.loadbalancer %} + - [ 'kubernetes-master:kube-api-endpoint', 'kubeapi-load-balancer:apiserver' ] +{% else %} + - [ 'kubernetes-master:kube-api-endpoint', 'kubernetes-worker:kube-api-endpoint' ] +{% endif %} + - [ 'kubernetes-master:cluster-dns', 'kubernetes-worker:kube-dns' ] + - [ 'kubernetes-master:certificates', 'easyrsa:client' ] + - [ 'kubernetes-master:etcd', 'etcd:db' ] + - [ 'kubernetes-worker:certificates', 'easyrsa:client' ] + - [ 'flannel:etcd', 'etcd:db' ] + - [ 'flannel:cni', 'kubernetes-master:cni' ] + - [ 'flannel:cni', 'kubernetes-worker:cni' ] + - [ 'etcd:certificates', 'easyrsa:client' ] +{% if os.kubernetes.loadbalancer %} + - [ 'kubernetes-master:loadbalancer', 'kubeapi-load-balancer:loadbalancer' ] + - [ 'kubernetes-worker:kube-api-endpoint', 'kubeapi-load-balancer:website' ] + - [ 'kubeapi-load-balancer:certificates', 'easyrsa:client' ] +{% endif %} + diff --git a/ci/default_deployment_config.yaml b/ci/default_deployment_config.yaml index ec6735c4..887b0966 100644 --- a/ci/default_deployment_config.yaml +++ b/ci/default_deployment_config.yaml @@ -30,3 +30,5 @@ os: service: congress: True promise: True + kubernetes: + loadbalancer: False diff --git a/ci/genK8Bundle.py b/ci/genK8Bundle.py index 439d52f9..cfbb6ea5 100644 --- a/ci/genK8Bundle.py +++ b/ci/genK8Bundle.py @@ -162,10 +162,14 @@ except ValueError as err: if 'dpdk' in features: config['os']['network']['dpdk'] = True +if 'lb' in features: + config['os']['kubernetes']['loadbalancer'] = True # Set beta option from extra if 'hugepages' in extra: config['os']['beta']['huge_pages'] = True +if 'lb' in extra: + config['os']['kubernetes']['loadbalancer'] = True if 'mitaka' in extra: config['os']['release'] = 'mitaka' if 'xenial' in extra: diff --git a/ci/kubernates/fetch-charms.sh b/ci/kubernates/fetch-charms.sh index e5bc1fe3..06f48387 100755 --- a/ci/kubernates/fetch-charms.sh +++ b/ci/kubernates/fetch-charms.sh @@ -16,3 +16,4 @@ charm pull cs:~containers/kubernetes-worker $distro/kubernetes-worker charm pull cs:~containers/flannel $distro/flannel charm pull cs:~containers/etcd $distro/etcd charm pull cs:~containers/easyrsa $distro/easyrsa +charm pull cs:~containers/kubeapi-load-balancer $distro/kubeapi-load-balancer -- 2.16.6