Support older kubernetes version

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2018-09-07 21:51:45 +01:00
parent 22f4f00ea3
commit 399919dffa
4 changed files with 66 additions and 20 deletions

View File

@ -40,11 +40,17 @@ trap cleanup EXIT
# deploy_kind will deploy a kubernetes-in-docker cluster
deploy_kind() {
local KIND_CONFIG="kind-config.yaml"
if [ ! -z "${KIND_KUBEADM_1_11_FORCE:-}" ]; then
KIND_CONFIG="kind-config-force.yaml"
fi
# create the kind cluster
kind create \
--name="${KIND_CLUSTER_NAME}" \
--image="${KIND_IMAGE}" \
--config "${REPO_ROOT}"/test/fixtures/kind-config.yaml
--config "${REPO_ROOT}"/test/fixtures/"${KIND_CONFIG}"
export KUBECONFIG="${HOME}/.kube/kind-config-${KIND_CLUSTER_NAME}"

View File

@ -52,11 +52,15 @@ func RunE2ETests(t *testing.T) {
}
glog.Infof("Installing cert-manager helm chart")
InstallHelmChart(t, releaseName, "./contrib/charts/cert-manager", certManagerDeploymentNamespace, "./test/fixtures/cert-manager-values.yaml")
var extraArgs []string
if os.Getenv("DISABLE_WEBHOOK") == "true" {
extraArgs = append(extraArgs, "--set", "webhook.enabled=false")
}
InstallHelmChart(t, releaseName, "./contrib/charts/cert-manager", certManagerDeploymentNamespace, "./test/fixtures/cert-manager-values.yaml", extraArgs...)
glog.Infof("Installing pebble chart")
// 10 minute timeout for pebble install due to large images
extraArgs := []string{"--timeout", "600"}
extraArgs = []string{"--timeout", "600"}
if framework.TestContext.PebbleImageRepo != "" {
extraArgs = append(extraArgs, "--set", "image.repository="+framework.TestContext.PebbleImageRepo)
}

53
test/fixtures/kind-config-force.yaml vendored Normal file
View File

@ -0,0 +1,53 @@
# this config is a copy of kind-config.yaml, but with an additional lifecycle
# hook that downloads kubeadm 1.11.2 which is able to bootstrap kubernetes 1.10
# clusters needed during tests.
#
# this config file is similar to the default, except we set the cluster's
# service cidr range to be 10.0.0.0/16.
# we do this because we need a fixed/predictable clusterIP of 10.0.0.15 for the
# nginx-ingress service, in order to perform HTTP01 validations during tests.
apiVersion: kind.sigs.k8s.io/v1alpha1
kind: Config
# number of nodes in the cluster (currently only 1 is supported)
numNodes: 1
# template for kubeadm config, "" -> the default template
kubeadmConfigTemplate: |
# config generated by kind
apiVersion: kubeadm.k8s.io/v1alpha2
kind: MasterConfiguration
clusterName: {{.ClusterName}}
# on docker for mac we have to expose the api server via port forward,
# so we need to ensure the cert is valid for localhost so we can talk
# to the cluster after rewriting the kubeconfig to point to localhost
apiServerCertSANs: [localhost]
kubernetesVersion: {{.KubernetesVersion}}
{{if ne .UnifiedControlPlaneImage ""}}
# optionally specify a unified control plane image
unifiedControlPlaneImage: {{.UnifiedControlPlaneImage}}:{{.DockerStableTag}}
{{end}}
networking:
# Don't think setting pod subnet is currently required
# podSubnet: ""
serviceSubnet: 10.0.0.0/16
kubeletConfiguration:
baseConfig:
clusterDNS:
- 10.0.0.10
nodeLifecycle:
preKubeadm:
# we download kubeadm 1.11.x here manually as earlier version of kubeadm do
# not support the kubeadm MasterConfiguration structure
- name: download kubeadm 1.11.2
mustSucceed: true
command:
- /bin/bash
- -c
- |
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
curl -o /usr/bin/kubeadm https://storage.googleapis.com/kubernetes-release/release/v1.11.2/bin/linux/amd64/kubeadm
chmod +x /usr/bin/kubeadm

View File

@ -30,20 +30,3 @@ kubeadmConfigTemplate: |
baseConfig:
clusterDNS:
- 10.0.0.10
nodeLifecycle:
preKubeadm:
# we download kubeadm 1.11.x here manually as earlier version of kubeadm do
# not support the kubeadm MasterConfiguration structure
- name: download kubeadm 1.11.2
mustSucceed: true
command:
- /bin/bash
- -c
- |
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
curl -o /usr/bin/kubeadm https://storage.googleapis.com/kubernetes-release/release/v1.11.2/bin/linux/amd64/kubeadm
chmod +x /usr/bin/kubeadm