Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle Add event in node event listener #906

Merged
merged 2 commits into from
Apr 23, 2024
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/functests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
kube-version: ['v1.18.20', 'v1.19.16', 'v1.20.15', 'v1.21.14', 'v1.22.17', 'v1.23.17', 'v1.24.17', 'v1.25.16', 'v1.26.14', 'v1.27.11', 'v1.28.7', 'v1.29.2']
kube-version: ['v1.20.15', 'v1.21.14', 'v1.22.17', 'v1.23.17', 'v1.24.17', 'v1.25.16', 'v1.26.15', 'v1.27.13', 'v1.28.9', 'v1.29.4', 'v1.30.0']
os: [ubuntu-20.04, ubuntu-22.04]
exclude:
- os: ubuntu-22.04
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
functests/run-migration-tests.sh "v3.2.2"

- name: Run migration tests with DirectCSI v2.0.9
if: contains(fromJson('["v1.18.20", "v1.19.16", "v1.20.15", "v1.21.14", "v1.22.17"]'), matrix.kube-version)
if: contains(fromJson('["v1.20.15", "v1.21.14", "v1.22.17"]'), matrix.kube-version)
run: |
sudo rm -fr /var/lib/directpv /var/lib/direct-csi
functests/run-migration-tests.sh "v2.0.9"
2 changes: 1 addition & 1 deletion cmd/kubectl-directpv/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func syncNodes(ctx context.Context) (err error) {
// Add missing nodes.
for _, csiNode := range csiNodes {
if !utils.Contains(nodeNames, csiNode) {
node := types.NewNode(directpvtypes.NodeID(csiNode), nil)
node := types.NewNode(directpvtypes.NodeID(csiNode), []types.Device{})
node.Spec.Refresh = true
if _, err = client.NodeClient().Create(ctx, node, metav1.CreateOptions{}); err != nil {
return fmt.Errorf("unable to create node %v; %w", csiNode, err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-directpv/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var (
imagePullSecrets = []string{}
nodeSelector map[string]string
tolerations []corev1.Toleration
k8sVersion = "1.27.0"
k8sVersion = "1.29.0"
kubeVersion *version.Version
legacyFlag bool
declarativeFlag bool
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $ chmod a+x kubectl-directpv
Before starting the installation, it is required to have DirectPV plugin installed on your system. For plugin installation refer [this documentation](#directpv-plugin-installation). If you are not using `krew`, replace `kubectl directpv` by `kubectl-directpv` in below steps.

### Prerequisites
* Kubernetes >= v1.18 on GNU/Linux on amd64.
* Kubernetes >= v1.20 on GNU/Linux on amd64.
* If you use private registry, below images must be pushed into your registry. You could use [this helper script](tools/push-images.sh) to do that.
- quay.io/minio/csi-node-driver-registrar:v2.8.0
- quay.io/minio/csi-provisioner:v3.5.0 _(for Kubernetes >= v1.20)_
Expand Down
4 changes: 2 additions & 2 deletions pkg/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func Install(ctx context.Context, args *Args) (err error) {
case args.DryRun:
if args.KubeVersion == nil {
// default higher version
if args.KubeVersion, err = version.ParseSemantic("1.27.0"); err != nil {
if args.KubeVersion, err = version.ParseSemantic("1.29.0"); err != nil {
klog.Fatalf("this should not happen; %v", err)
}
}
Expand All @@ -112,7 +112,7 @@ func Install(ctx context.Context, args *Args) (err error) {

if args.KubeVersion.Major() != 1 ||
args.KubeVersion.Minor() < 18 ||
args.KubeVersion.Minor() > 27 {
args.KubeVersion.Minor() > 30 {
Praveenrajmani marked this conversation as resolved.
Show resolved Hide resolved
if !args.DryRun {
utils.Eprintf(
args.Quiet,
Expand Down
2 changes: 1 addition & 1 deletion pkg/node/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (handler *nodeEventHandler) ObjectType() runtime.Object {

func (handler *nodeEventHandler) Handle(ctx context.Context, eventType controller.EventType, object runtime.Object) error {
switch eventType {
case controller.UpdateEvent:
case controller.UpdateEvent, controller.AddEvent:
node := object.(*types.Node)
if node.Spec.Refresh {
return Sync(ctx, directpvtypes.NodeID(node.Name))
Expand Down
Loading