Skip to content

Commit

Permalink
fix kube_network option
Browse files Browse the repository at this point in the history
  • Loading branch information
Smana committed Apr 15, 2016
1 parent f657467 commit 8cf8e08
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
============
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
8 changes: 3 additions & 5 deletions bin/kargo
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with Foobar. If not, see <http://www.gnu.org/licenses/>.

__version__ = '0.2.4'
__version__ = '0.2.5'

import os
import argparse
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/kargo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# (c) 2016, Smaine Kahlouch <smainklh@gmail.com>
__author__ = 'smana'
__version__ = '0.2.4'
__version__ = '0.2.5'
2 changes: 1 addition & 1 deletion src/kargo/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/kargo/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 8cf8e08

Please sign in to comment.