Commit 25b85339 authored by Yang Li's avatar Yang Li

Merge remote-tracking branch 'origin/master' into release-1.13

parents ee420ebf 9c50dd05
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"containers": [ "containers": [
{ {
"name": "cluster-autoscaler", "name": "cluster-autoscaler",
"image": "k8s.gcr.io/cluster-autoscaler:v1.13.0-rc.2", "image": "k8s.gcr.io/cluster-autoscaler:v1.13.0",
"livenessProbe": { "livenessProbe": {
"httpGet": { "httpGet": {
"path": "/health-check", "path": "/health-check",
......
...@@ -77,6 +77,9 @@ func (as *availabilitySet) AttachDisk(isManagedDisk bool, diskName, diskURI stri ...@@ -77,6 +77,9 @@ func (as *availabilitySet) AttachDisk(isManagedDisk bool, diskName, diskURI stri
ctx, cancel := getContextWithCancel() ctx, cancel := getContextWithCancel()
defer cancel() defer cancel()
// Invalidate the cache right after updating
defer as.cloud.vmCache.Delete(vmName)
_, err = as.VirtualMachinesClient.CreateOrUpdate(ctx, nodeResourceGroup, vmName, newVM) _, err = as.VirtualMachinesClient.CreateOrUpdate(ctx, nodeResourceGroup, vmName, newVM)
if err != nil { if err != nil {
klog.Errorf("azureDisk - attach disk(%s) failed, err: %v", diskName, err) klog.Errorf("azureDisk - attach disk(%s) failed, err: %v", diskName, err)
...@@ -88,8 +91,6 @@ func (as *availabilitySet) AttachDisk(isManagedDisk bool, diskName, diskURI stri ...@@ -88,8 +91,6 @@ func (as *availabilitySet) AttachDisk(isManagedDisk bool, diskName, diskURI stri
} }
} else { } else {
klog.V(2).Infof("azureDisk - attach disk(%s) succeeded", diskName) klog.V(2).Infof("azureDisk - attach disk(%s) succeeded", diskName)
// Invalidate the cache right after updating
as.cloud.vmCache.Delete(vmName)
} }
return err return err
} }
...@@ -139,13 +140,15 @@ func (as *availabilitySet) DetachDiskByName(diskName, diskURI string, nodeName t ...@@ -139,13 +140,15 @@ func (as *availabilitySet) DetachDiskByName(diskName, diskURI string, nodeName t
klog.V(2).Infof("azureDisk - update(%s): vm(%s) - detach disk(%s)", nodeResourceGroup, vmName, diskName) klog.V(2).Infof("azureDisk - update(%s): vm(%s) - detach disk(%s)", nodeResourceGroup, vmName, diskName)
ctx, cancel := getContextWithCancel() ctx, cancel := getContextWithCancel()
defer cancel() defer cancel()
// Invalidate the cache right after updating
defer as.cloud.vmCache.Delete(vmName)
_, err = as.VirtualMachinesClient.CreateOrUpdate(ctx, nodeResourceGroup, vmName, newVM) _, err = as.VirtualMachinesClient.CreateOrUpdate(ctx, nodeResourceGroup, vmName, newVM)
if err != nil { if err != nil {
klog.Errorf("azureDisk - detach disk(%s) failed, err: %v", diskName, err) klog.Errorf("azureDisk - detach disk(%s) failed, err: %v", diskName, err)
} else { } else {
klog.V(2).Infof("azureDisk - detach disk(%s) succeeded", diskName) klog.V(2).Infof("azureDisk - detach disk(%s) succeeded", diskName)
// Invalidate the cache right after updating
as.cloud.vmCache.Delete(vmName)
} }
return err return err
} }
......
...@@ -71,8 +71,12 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod ...@@ -71,8 +71,12 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod
ctx, cancel := getContextWithCancel() ctx, cancel := getContextWithCancel()
defer cancel() defer cancel()
klog.V(2).Infof("azureDisk - update(%s): vm(%s) - attach disk(%s)", nodeResourceGroup, nodeName, diskName)
// Invalidate the cache right after updating
key := buildVmssCacheKey(nodeResourceGroup, ss.makeVmssVMName(ssName, instanceID))
defer ss.vmssVMCache.Delete(key)
klog.V(2).Infof("azureDisk - update(%s): vm(%s) - attach disk(%s)", nodeResourceGroup, nodeName, diskName)
_, err = ss.VirtualMachineScaleSetVMsClient.Update(ctx, nodeResourceGroup, ssName, instanceID, vm) _, err = ss.VirtualMachineScaleSetVMsClient.Update(ctx, nodeResourceGroup, ssName, instanceID, vm)
if err != nil { if err != nil {
detail := err.Error() detail := err.Error()
...@@ -83,9 +87,6 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod ...@@ -83,9 +87,6 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod
} }
} else { } else {
klog.V(2).Infof("azureDisk - attach disk(%s) succeeded", diskName) klog.V(2).Infof("azureDisk - attach disk(%s) succeeded", diskName)
// Invalidate the cache right after updating
key := buildVmssCacheKey(nodeResourceGroup, ss.makeVmssVMName(ssName, instanceID))
ss.vmssVMCache.Delete(key)
} }
return err return err
} }
...@@ -128,15 +129,17 @@ func (ss *scaleSet) DetachDiskByName(diskName, diskURI string, nodeName types.No ...@@ -128,15 +129,17 @@ func (ss *scaleSet) DetachDiskByName(diskName, diskURI string, nodeName types.No
vm.StorageProfile.DataDisks = &disks vm.StorageProfile.DataDisks = &disks
ctx, cancel := getContextWithCancel() ctx, cancel := getContextWithCancel()
defer cancel() defer cancel()
// Invalidate the cache right after updating
key := buildVmssCacheKey(nodeResourceGroup, ss.makeVmssVMName(ssName, instanceID))
defer ss.vmssVMCache.Delete(key)
klog.V(2).Infof("azureDisk - update(%s): vm(%s) - detach disk(%s)", nodeResourceGroup, nodeName, diskName) klog.V(2).Infof("azureDisk - update(%s): vm(%s) - detach disk(%s)", nodeResourceGroup, nodeName, diskName)
_, err = ss.VirtualMachineScaleSetVMsClient.Update(ctx, nodeResourceGroup, ssName, instanceID, vm) _, err = ss.VirtualMachineScaleSetVMsClient.Update(ctx, nodeResourceGroup, ssName, instanceID, vm)
if err != nil { if err != nil {
klog.Errorf("azureDisk - detach disk(%s) from %s failed, err: %v", diskName, nodeName, err) klog.Errorf("azureDisk - detach disk(%s) from %s failed, err: %v", diskName, nodeName, err)
} else { } else {
klog.V(2).Infof("azureDisk - detach disk(%s) succeeded", diskName) klog.V(2).Infof("azureDisk - detach disk(%s) succeeded", diskName)
// Invalidate the cache right after updating
key := buildVmssCacheKey(nodeResourceGroup, ss.makeVmssVMName(ssName, instanceID))
ss.vmssVMCache.Delete(key)
} }
return err return err
......
...@@ -705,15 +705,15 @@ func highestSupportedVersion(versions []string) (*utilversion.Version, error) { ...@@ -705,15 +705,15 @@ func highestSupportedVersion(versions []string) (*utilversion.Version, error) {
return nil, fmt.Errorf("None of the CSI versions reported by this driver are supported") return nil, fmt.Errorf("None of the CSI versions reported by this driver are supported")
} }
// Only CSI 0.x drivers are allowed to use deprecated socket dir. // Only drivers that implement CSI 0.x are allowed to use deprecated socket dir.
func isDeprecatedSocketDirAllowed(versions []string) bool { func isDeprecatedSocketDirAllowed(versions []string) bool {
for _, version := range versions { for _, version := range versions {
if !isV0Version(version) { if isV0Version(version) {
return false return true
} }
} }
return true return false
} }
func isV0Version(version string) bool { func isV0Version(version string) bool {
......
...@@ -617,7 +617,7 @@ func TestValidatePlugin(t *testing.T) { ...@@ -617,7 +617,7 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"0.2.0", "v1.0.0"}, versions: []string{"0.2.0", "v1.0.0"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
...@@ -631,7 +631,7 @@ func TestValidatePlugin(t *testing.T) { ...@@ -631,7 +631,7 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"0.2.0", "v1.2.3"}, versions: []string{"0.2.0", "v1.2.3"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
...@@ -645,7 +645,7 @@ func TestValidatePlugin(t *testing.T) { ...@@ -645,7 +645,7 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"v1.2.3", "v0.3.0"}, versions: []string{"v1.2.3", "v0.3.0"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
...@@ -659,14 +659,14 @@ func TestValidatePlugin(t *testing.T) { ...@@ -659,14 +659,14 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"v1.2.3", "v0.3.0", "2.0.1"}, versions: []string{"v1.2.3", "v0.3.0", "2.0.1"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"v0.3.0", "2.0.1"}, versions: []string{"v0.3.0", "2.0.1"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
...@@ -680,7 +680,7 @@ func TestValidatePlugin(t *testing.T) { ...@@ -680,7 +680,7 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"v1.2.3", "4.9.12", "v0.3.0", "2.0.1"}, versions: []string{"v1.2.3", "4.9.12", "v0.3.0", "2.0.1"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
...@@ -694,7 +694,7 @@ func TestValidatePlugin(t *testing.T) { ...@@ -694,7 +694,7 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"v1.2.3", "boo", "v0.3.0", "2.0.1"}, versions: []string{"v1.2.3", "boo", "v0.3.0", "2.0.1"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
......
...@@ -595,7 +595,7 @@ func testPodFailSubpathError(f *framework.Framework, pod *v1.Pod, errorMsg strin ...@@ -595,7 +595,7 @@ func testPodFailSubpathError(f *framework.Framework, pod *v1.Pod, errorMsg strin
"involvedObject.namespace": f.Namespace.Name, "involvedObject.namespace": f.Namespace.Name,
"reason": "Failed", "reason": "Failed",
}.AsSelector().String() }.AsSelector().String()
err = framework.WaitTimeoutForPodEvent(f.ClientSet, pod.Name, f.Namespace.Name, selector, errorMsg, framework.PodEventTimeout) err = framework.WaitTimeoutForPodEvent(f.ClientSet, pod.Name, f.Namespace.Name, selector, errorMsg, framework.PodStartTimeout)
Expect(err).NotTo(HaveOccurred(), "while waiting for failed event to occur") Expect(err).NotTo(HaveOccurred(), "while waiting for failed event to occur")
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment