Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmd/hostpathplugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func main() {
flag.Int64Var(&cfg.MaxVolumesPerNode, "maxvolumespernode", 0, "limit of volumes per node")
flag.Var(&cfg.Capacity, "capacity", "Simulate storage capacity. The parameter is <kind>=<quantity> where <kind> is the value of a 'kind' storage class parameter and <quantity> is the total amount of bytes for that kind. The flag may be used multiple times to configure different kinds.")
flag.BoolVar(&cfg.EnableAttach, "enable-attach", false, "Enables RPC_PUBLISH_UNPUBLISH_VOLUME capability.")
flag.BoolVar(&cfg.CheckVolumeLifecycle, "check-volume-lifecycle", false, "Can be used to turn some violations of the volume lifecycle into warnings instead of failing the incorrect gRPC call. Disabled by default because of https://github.com/kubernetes/kubernetes/issues/101911.")
flag.Int64Var(&cfg.MaxVolumeSize, "max-volume-size", 1024*1024*1024*1024, "maximum size of volumes in bytes (inclusive)")
flag.BoolVar(&cfg.EnableTopology, "enable-topology", true, "Enables PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS capability.")
flag.BoolVar(&cfg.EnableVolumeExpansion, "node-expand-required", true, "Enables NodeServiceCapability_RPC_EXPAND_VOLUME capacity.")
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
google.golang.org/genproto v0.0.0-20201209185603-f92720507ed4 // indirect
google.golang.org/grpc v1.34.0
k8s.io/apimachinery v0.21.0-alpha.0
k8s.io/klog/v2 v2.4.0
k8s.io/kubernetes v1.20.0
k8s.io/mount-utils v0.20.0 // indirect
k8s.io/utils v0.0.0-20201110183641-67b214c5f920
Expand Down
13 changes: 2 additions & 11 deletions pkg/hostpath/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"google.golang.org/grpc/status"

"github.com/container-storage-interface/spec/lib/go/csi"
"k8s.io/klog/v2"
utilexec "k8s.io/utils/exec"

"github.com/kubernetes-csi/csi-driver-host-path/pkg/state"
Expand Down Expand Up @@ -205,12 +204,8 @@ func (hp *hostPath) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeReque
}

if vol.Attached || !vol.Published.Empty() || !vol.Staged.Empty() {
msg := fmt.Sprintf("Volume '%s' is still used (attached: %v, staged: %v, published: %v) by '%s' node",
return nil, status.Errorf(codes.Internal, "Volume '%s' is still used (attached: %v, staged: %v, published: %v) by '%s' node",
vol.VolID, vol.Attached, vol.Staged, vol.Published, vol.NodeID)
if hp.config.CheckVolumeLifecycle {
return nil, status.Error(codes.Internal, msg)
}
klog.Warning(msg)
}

if err := hp.deleteVolume(volId); err != nil {
Expand Down Expand Up @@ -345,12 +340,8 @@ func (hp *hostPath) ControllerUnpublishVolume(ctx context.Context, req *csi.Cont

// Check to see if the volume is staged/published on a node
if !vol.Published.Empty() || !vol.Staged.Empty() {
msg := fmt.Sprintf("Volume '%s' is still used (staged: %v, published: %v) by '%s' node",
return nil, status.Errorf(codes.Internal, "Volume '%s' is still used (staged: %v, published: %v) by '%s' node",
vol.VolID, vol.Staged, vol.Published, vol.NodeID)
if hp.config.CheckVolumeLifecycle {
return nil, status.Error(codes.Internal, msg)
}
klog.Warning(msg)
}

vol.Attached = false
Expand Down
1 change: 0 additions & 1 deletion pkg/hostpath/hostpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ type Config struct {
EnableAttach bool
EnableTopology bool
EnableVolumeExpansion bool
CheckVolumeLifecycle bool
}

var (
Expand Down
23 changes: 21 additions & 2 deletions release-tools/prow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,21 @@ apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
kubeadmConfigPatches:
- |
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
v: "5"
vmodule: "*csi*=5"
- role: worker
kubeadmConfigPatches:
- |
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
v: "5"
vmodule: "*csi*=5"
featureGates:
$(list_gates "$gates")
runtimeConfig:
Expand All @@ -632,11 +646,16 @@ EOF

# Deletes kind cluster inside a prow job
delete_cluster_inside_prow_job() {
local name="$1"

# Inside a real Prow job it is better to clean up at runtime
# instead of leaving that to the Prow job cleanup code
# because the later sometimes times out (https://github.com/kubernetes-csi/csi-release-tools/issues/24#issuecomment-554765872).
#
# This is also a good time to collect logs.
if [ "$JOB_NAME" ]; then
if kind get clusters | grep -q csi-prow; then
run kind export logs --name=csi-prow ${ARTIFACTS}/cluster-logs/$name
run kind delete cluster --name=csi-prow || die "kind delete failed"
fi
unset KUBECONFIG
Expand Down Expand Up @@ -1252,7 +1271,7 @@ main () {
fi
fi
fi
delete_cluster_inside_prow_job
delete_cluster_inside_prow_job non-alpha
fi

if tests_need_alpha_cluster && [ "${CSI_PROW_E2E_ALPHA_GATES}" ]; then
Expand Down Expand Up @@ -1287,7 +1306,7 @@ main () {
fi
fi
fi
delete_cluster_inside_prow_job
delete_cluster_inside_prow_job alpha
fi
fi

Expand Down
1 change: 0 additions & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ k8s.io/apiserver/pkg/util/feature
# k8s.io/component-base v0.20.0 => k8s.io/component-base v0.20.0
k8s.io/component-base/featuregate
# k8s.io/klog/v2 v2.4.0
## explicit
k8s.io/klog/v2
# k8s.io/kubernetes v1.20.0
## explicit
Expand Down