Merge pull request #49182 from juju-solutions/feature/increase-cidr

Automatic merge from submit-queue (batch tested with PRs 49058, 49072, 49137, 49182, 49045)

Set default CIDR to /16 for Juju deployments

**What this PR does / why we need it**: Increase the number of IPs on a deployment

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes https://github.com/juju-solutions/bundle-canonical-kubernetes/issues/272

**Special notes for your reviewer**:

**Release note**:

```Set default CIDR to /16 for Juju deployments
```
This commit is contained in:
Kubernetes Submit Queue 2017-07-19 10:27:27 -07:00 committed by GitHub
commit 7dc0322b0c
2 changed files with 10 additions and 9 deletions

View File

@ -9,7 +9,7 @@ options:
description: The local domain for cluster dns description: The local domain for cluster dns
service-cidr: service-cidr:
type: string type: string
default: 10.152.183.0/24 default: 10.152.0.0/16
description: CIDR to user for Kubernetes services. Cannot be changed after deployment. description: CIDR to user for Kubernetes services. Cannot be changed after deployment.
allow-privileged: allow-privileged:
type: string type: string

View File

@ -22,6 +22,7 @@ import shutil
import socket import socket
import string import string
import json import json
import ipaddress
import charms.leadership import charms.leadership
@ -783,18 +784,18 @@ def create_kubeconfig(kubeconfig, server, ca, key=None, certificate=None,
def get_dns_ip(): def get_dns_ip():
'''Get an IP address for the DNS server on the provided cidr.''' '''Get an IP address for the DNS server on the provided cidr.'''
# Remove the range from the cidr. interface = ipaddress.IPv4Interface(service_cidr())
ip = service_cidr().split('/')[0] # Add .10 at the end of the network
# Take the last octet off the IP address and replace it with 10. ip = interface.network.network_address + 10
return '.'.join(ip.split('.')[0:-1]) + '.10' return ip.exploded
def get_kubernetes_service_ip(): def get_kubernetes_service_ip():
'''Get the IP address for the kubernetes service based on the cidr.''' '''Get the IP address for the kubernetes service based on the cidr.'''
# Remove the range from the cidr. interface = ipaddress.IPv4Interface(service_cidr())
ip = service_cidr().split('/')[0] # Add .1 at the end of the network
# Remove the last octet and replace it with 1. ip = interface.network.network_address + 1
return '.'.join(ip.split('.')[0:-1]) + '.1' return ip.exploded
def handle_etcd_relation(reldata): def handle_etcd_relation(reldata):