From 8cf8e08e301166a49bc75477849d99a8981459ec Mon Sep 17 00:00:00 2001 From: Smana Date: Fri, 15 Apr 2016 14:06:08 +0200 Subject: [PATCH] fix kube_network option --- README.md | 12 ++++++++---- bin/kargo | 8 +++----- setup.py | 2 +- src/kargo/__init__.py | 2 +- src/kargo/cloud.py | 2 +- src/kargo/deploy.py | 8 ++++++-- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f95ffee..4ee2ed4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ You should have at least 3 nodes but you can spawn only one instance for tests purposes. Example on GCE: -[![asciicast](https://asciinema.org/a/38yu9fh7r2lq2hd4xlvtngadp.png)](https://asciinema.org/a/38yu9fh7r2lq2hd4xlvtngadp?speed=4) +[![asciicast](https://asciinema.org/a/5in6riip9w93r4zzunlv2vib8.png)](https://asciinema.org/a/5in6riip9w93r4zzunlv2vib8?speed=4) Requirements ============ @@ -188,8 +188,8 @@ Then deploy the cluster with the same options as the running cluster. usage: kargo deploy [-h] [-p KARGO_PATH] [--config CONFIGFILE] [-y] [-i INVENTORY_PATH] [-k SSH_KEY] [-u ANSIBLE_USER] - [-n {flannel,weave,calico}] [--aws] [--gce] [--coreos] - [--ansible-opts ANSIBLE_OPTS] + [-N KUBE_NETWORK] [-n {flannel,weave,calico}] [--aws] + [--gce] [--coreos] [--ansible-opts ANSIBLE_OPTS] optional arguments: -h, --help show this help message and exit @@ -204,6 +204,10 @@ Then deploy the cluster with the same options as the running cluster. ssh key for authentication on remote servers -u ANSIBLE_USER, --user ANSIBLE_USER Ansible SSH user (remote user) + -N KUBE_NETWORK, --kube-network KUBE_NETWORK + Network to be used inside the cluster (/16), (must not + overlap with any of your infrastructure networks). + default: 10.233.0.0/16 -n {flannel,weave,calico}, --network-plugin {flannel,weave,calico} --aws Kubernetes deployment on AWS --gce Kubernetes deployment on GCE @@ -223,4 +227,4 @@ Then deploy the cluster with the same options as the running cluster. example: Deploy a kubernetes cluster on CoreOS servers located on GCE - kargo deploy -u core -p /kargo-dc1 --gce --coreos + kargo deploy -u core -p /kargo-dc1 --gce --coreos --cluster-name mykube --kube-network 10.42.0.0/16 diff --git a/bin/kargo b/bin/kargo index a23155e..ad85a77 100644 --- a/bin/kargo +++ b/bin/kargo @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with Foobar. If not, see . -__version__ = '0.2.4' +__version__ = '0.2.5' import os import argparse @@ -128,8 +128,7 @@ if __name__ == '__main__': ) aws_parser.add_argument('--ami', dest='aws_ami', help='AWS AMI') aws_parser.add_argument( - '--cluster-name', dest='cluster_name', default='k8s-%s' % id_generator(), - help='Name of the cluster' + '--cluster-name', dest='cluster_name', help='Name of the cluster' ) aws_parser.add_argument('--add', dest='add_node', action='store_true', help="Add node to an existing cluster") @@ -161,8 +160,7 @@ if __name__ == '__main__': '--email', dest='service_account_email', help='GCE project ID' ) gce_parser.add_argument( - '--cluster-name', dest='cluster_name', default='k8s-%s' % id_generator(), - help='Name of the cluster' + '--cluster-name', dest='cluster_name', help='Name of the cluster' ) gce_parser.add_argument('--add', dest='add_node', action='store_true', help="Add node to an existing cluster") diff --git a/setup.py b/setup.py index b39a38c..b18070c 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup( name='kargo', - version='0.2.4', + version='0.2.5', description="Kargo kubernetes cluster deployment", author="Smaine Kahlouch", author_email='smainklh@gmail.com', diff --git a/src/kargo/__init__.py b/src/kargo/__init__.py index 19026cc..a81e91c 100644 --- a/src/kargo/__init__.py +++ b/src/kargo/__init__.py @@ -1,3 +1,3 @@ # (c) 2016, Smaine Kahlouch __author__ = 'smana' -__version__ = '0.2.4' +__version__ = '0.2.5' diff --git a/src/kargo/cloud.py b/src/kargo/cloud.py index e26e977..f3b5049 100644 --- a/src/kargo/cloud.py +++ b/src/kargo/cloud.py @@ -221,7 +221,7 @@ def gen_gce_playbook(self): ) else: gce_instance_names.append( - 'k8s-' + cluster_name + '-%s' % id_generator() + 'k8s-' + cluster_name.lower() + '-%s' % id_generator() ) gce_instance_names = ','.join(gce_instance_names) # Define GCE task diff --git a/src/kargo/deploy.py b/src/kargo/deploy.py index ef659a0..45aac61 100644 --- a/src/kargo/deploy.py +++ b/src/kargo/deploy.py @@ -171,9 +171,13 @@ def deploy_kubernetes(self): os.kill(int(os.environ.get('SSH_AGENT_PID')), signal.SIGTERM) sys.exit(1) svc_network, pods_network = self.get_subnets() + cmd = cmd + [ + '-e', 'kube_service_addresses=%s' % svc_network.cidr, + '-e', 'kube_pods_subnet=%s' % pods_network + ] # Add any additionnal Ansible option - if 'ansible-opts' in self.options.keys(): - cmd = cmd + self.options['ansible-opts'].split(' ') + if 'ansible_opts' in self.options.keys(): + cmd = cmd + self.options['ansible_opts'].split(' ') for cloud in ['aws', 'gce']: if self.options[cloud]: cmd = cmd + ['-e', 'cloud_provider=%s' % cloud]