Don't override 'ipip' option for installer by default

Test should use default value of 'ipip' setting for the
deployment script, unless it's explicitly set from tests
or exported to environment variables.

Also since at the moment 'ipip' is disabled for all
existing tests, we need to add a separate test for
deploying Calico with tunnels. Scenario:

 1. Enable 'ipip' in the settings
 2. Install k8s.
 3. Check Calico IPIP tunnels exist
 4. Basic check of running containers on nodes.
 5. Create nginx pod.
 6. Check created pod is reached
 7. Delete pod.

Change-Id: I4d1e2417b3f4b27e7ca15afebdc3de4bef63a177
This commit is contained in:
Artem Panchenko 2016-09-23 16:31:59 +03:00
parent 1f820d2644
commit 47c83cf4e8
3 changed files with 48 additions and 9 deletions

View File

@ -58,7 +58,6 @@ KUBE_VERSION = os.environ.get("KUBE_VERSION", "v1.3.5")
KUBE_NETWORK_PLUGIN = os.environ.get("KUBE_NETWORK_PLUGIN", "calico")
KUBE_PROXY_MODE = os.environ.get("KUBE_PROXY_MODE", "iptables")
IPIP_USAGE = get_var_as_bool('IPIP_USAGE', True)
DOCKER_VERSION = float(os.environ.get("DOCKER_VERSION", "1.12"))
HYPERKUBE_IMAGE_REPO = os.environ.get('HYPERKUBE_IMAGE_REPO',
@ -91,7 +90,6 @@ DEFAULT_CUSTOM_YAML = {
"etcd_deployment_type": ETCD_DEPLOYMENT_TYPE,
"hyperkube_image_tag": HYPERKUBE_IMAGE_TAG,
"hyperkube_image_repo": HYPERKUBE_IMAGE_REPO,
"ipip": IPIP_USAGE,
"kube_version": KUBE_VERSION,
"use_hyperkube_cni": str("true"),
"searchdomains": SEARCH_DOMAINS,
@ -106,10 +104,11 @@ CALICO = {
"calico_cni_ipam_download_url": os.environ.get(
'CALICO_CNI_IPAM_DOWNLOAD_URL'),
"calico_cni_ipam_checksum": os.environ.get('CALICO_CNI_IPAM_CHECKSUM'),
"ipip": get_var_as_bool('IPIP_USAGE', None),
}
for key, val in CALICO.items():
if val:
if val is not None:
DEFAULT_CUSTOM_YAML[key] = val
DEPLOY_CONFIG = '/tmp/ccp-globals.yaml'

View File

@ -68,7 +68,7 @@ underlay_opts = [
# KUBE_ADMIN_PASS = os.environ.get('KUBE_ADMIN_PASS', 'changeme')
# KUBE_HOST = os.environ.get('KUBE_HOST', None)
# KUBE_VERSION = os.environ.get("KUBE_VERSION", "v1.3.0")
# IPIP_USAGE = get_var_as_bool('IPIP_USAGE', True)
# IPIP_USAGE = get_var_as_bool('IPIP_USAGE', None)
# DEPLOY_SCRIPT = os.environ.get("DEPLOY_SCRIPT", None)
# Deploy options for a new K8S cluster
@ -76,7 +76,7 @@ k8s_deploy_opts = [
ct.Cfg('kube_version', ct.String(),
help="", default="v1.3.5"),
ct.Cfg('ipip_usage', ct.Boolean(),
help="", default=True),
help="", default=False),
ct.Cfg('deploy_script', ct.String(),
help="", default=None),
ct.Cfg('kube_settings', ct.JSONDict(),

View File

@ -11,6 +11,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
import pytest
import base_test
@ -139,8 +141,6 @@ class TestFuelCCPInstaller(base_test.SystemBaseTest,
self.check_number_kube_nodes(underlay, k8sclient)
self.check_list_required_images(underlay,
required_images=required_images)
if kube_settings['ipip']:
self.calico_ipip_exists(underlay)
self.check_etcd_health(underlay)
nginx = self.get_nginx_spec()
pod = k8s_actions.check_pod_create(body=nginx)
@ -182,8 +182,6 @@ class TestFuelCCPInstaller(base_test.SystemBaseTest,
self.check_number_kube_nodes(underlay, k8sclient)
self.check_list_required_images(underlay,
required_images=required_images)
if kube_settings['ipip']:
self.calico_ipip_exists(underlay)
self.check_etcd_health(underlay)
nginx = self.get_nginx_spec()
pod = k8s_actions.check_pod_create(body=nginx)
@ -225,6 +223,48 @@ class TestFuelCCPInstaller(base_test.SystemBaseTest,
self.check_nginx_pod_is_reached(underlay, pod.status.pod_ip)
k8s_actions.check_pod_delete(pod)
@pytest.mark.test_k8s_installed_with_ipip
@pytest.mark.revert_snapshot(ext.SNAPSHOT.underlay)
@pytest.mark.fail_snapshot
def test_k8s_installed_with_ipip(self, underlay, k8s_actions, show_step):
"""Test for deploying an k8s environment with IPIP tunnels for Calico
and check it
Scenario:
1. Enable 'ipip' in the settings
2. Install k8s.
3. Check Calico IPIP tunnels exist
4. Basic check of running containers on nodes.
5. Create nginx pod.
6. Check created pod is reached
7. Delete pod.
Duration: 1200
"""
show_step(1)
custom_yaml = copy.deepcopy(self.kube_settings)
custom_yaml['ipip'] = True
show_step(2)
k8s_actions.install_k8s(custom_yaml=custom_yaml)
show_step(3)
self.calico_ipip_exists(underlay)
show_step(4)
self.check_list_required_images(
underlay, required_images=self.base_images)
show_step(5)
nginx = self.get_nginx_spec()
pod = k8s_actions.check_pod_create(body=nginx)
show_step(6)
self.check_nginx_pod_is_reached(underlay, pod.status.pod_ip)
show_step(7)
k8s_actions.check_pod_delete(pod)
@pytest.mark.fuel_ccp_installer_idempotency
@pytest.mark.system