tests: use a non default volume plugin dir path for k8s 1.8

This commit is contained in:
Jared Watts committed 2017-11-27 12:09:44 -08:00
1 parent 8ef8718efb
commit de7e6dbd56
2 files changed
+26 -6

No files matched your search

+8 -4
View File
@@ -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"))
}
+18 -2
View File
@@ -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
}