diff --git a/tests/integration/smoke_test.go b/tests/integration/smoke_test.go index 1fda16fcd..a07e03769 100644 --- a/tests/integration/smoke_test.go +++ b/tests/integration/smoke_test.go @@ -17,6 +17,7 @@ limitations under the License. package integration import ( + "regexp" "strings" "testing" @@ -132,11 +133,14 @@ func (suite *SmokeSuite) TestOperatorGetFlexvolumePath() { rawLog, err := suite.k8sh.Clientset.Pods(sysNamespace).GetLogs(opPodName, &v1.PodLogOptions{}).Do().Raw() require.Nil(suite.T(), err) - logStr := string(rawLog) + r := regexp.MustCompile(`discovered flexvolume dir path from source.*\n`) + logStmt := string(r.Find(rawLog)) + logger.Infof("flexvolume discovery log statement: %s", logStmt) // verify that the volume plugin dir was discovered by the operator pod and that it did not come from // an env var or the default - assert.True(suite.T(), strings.Contains(logStr, "discovered flexvolume dir path from source")) - assert.False(suite.T(), strings.Contains(logStr, "discovered flexvolume dir path from source env var")) - assert.False(suite.T(), strings.Contains(logStr, "discovered flexvolume dir path from source default")) + require.NotEmpty(suite.T(), logStmt) + assert.True(suite.T(), strings.Contains(logStmt, "discovered flexvolume dir path from source")) + assert.False(suite.T(), strings.Contains(logStmt, "discovered flexvolume dir path from source env var")) + assert.False(suite.T(), strings.Contains(logStmt, "discovered flexvolume dir path from source default")) } diff --git a/tests/scripts/kubeadm.sh b/tests/scripts/kubeadm.sh index 116f49331..353147405 100755 --- a/tests/scripts/kubeadm.sh +++ b/tests/scripts/kubeadm.sh @@ -21,11 +21,17 @@ usage(){ install_master(){ # This is needed on K8S 1.6 to fix a regression. https://github.com/kubernetes/kubernetes/issues/47109 - if [[ $KUBE_VERSION == v1.6* ]] ; - then + if [[ $KUBE_VERSION == v1.6* ]] ; then cat << EOF | sudo tee -a /etc/systemd/system/kubelet.service.d/11-disable_attachdetach_controller.conf [Service] Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --enable-controller-attach-detach=false" +EOF + sudo systemctl daemon-reload + elif [[ $KUBE_VERSION == v1.8* ]] ; then + # for k8s 1.8, use a non default value for volume plugins + cat << EOF | sudo tee -a /etc/systemd/system/kubelet.service.d/11-volume_plugin_dir.conf +[Service] +Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --volume-plugin-dir=/var/lib/kubelet/volumeplugins" EOF sudo systemctl daemon-reload fi @@ -60,6 +66,16 @@ EOF #install k8s node install_node(){ echo "inside install node function" + + # for k8s 1.8, use a non default value for volume plugins + if [[ $KUBE_VERSION == v1.8* ]] ; then + cat << EOF | sudo tee -a /etc/systemd/system/kubelet.service.d/11-volume_plugin_dir.conf +[Service] +Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --volume-plugin-dir=/var/lib/kubelet/volumeplugins" +EOF + sudo systemctl daemon-reload + fi + echo "kubeadm join ${1} ${2} ${3} ${4} ${5} --skip-preflight-checks" sudo kubeadm join ${1} ${2} ${3} ${4} ${5} --skip-preflight-checks || true }