Skip to content
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
1 change: 1 addition & 0 deletions changelogs/unreleased/648-akhilerm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
update get call to use empty object instead of deepcopy object while updating the resources
11 changes: 7 additions & 4 deletions cmd/ndm_daemonset/controller/blockdevicestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ func (c *Controller) UpdateBlockDevice(blockDevice apis.BlockDevice, oldBlockDev

blockDeviceCopy := blockDevice.DeepCopy()
if oldBlockDevice == nil {
oldBlockDevice = blockDevice.DeepCopy()
oldBlockDevice = &apis.BlockDevice{}
err = c.Clientset.Get(context.TODO(), client.ObjectKey{
Namespace: oldBlockDevice.Namespace,
Name: oldBlockDevice.Name}, oldBlockDevice)
Namespace: blockDeviceCopy.Namespace,
Name: blockDeviceCopy.Name}, oldBlockDevice)
if err != nil {
klog.Errorf("eventcode=%s msg=%s : %v, err:%v rname=%v",
"ndm.blockdevice.update.failure",
"Failed to update block device : unable to get blockdevice object",
oldBlockDevice.ObjectMeta.Name, err, blockDeviceCopy.ObjectMeta.Name)
blockDeviceCopy.ObjectMeta.Name, err, blockDeviceCopy.ObjectMeta.Name)
return err
}
}
Expand Down Expand Up @@ -327,6 +327,9 @@ func mergeMetadata(newMetadata, oldMetadata metav1.ObjectMeta) metav1.ObjectMeta

// Patch older label with new label. If there is a new key then it will be added
// if it is an existing key then value will be overwritten with value from new label
if oldMetadata.Labels == nil {
oldMetadata.Labels = make(map[string]string)
}
for key, value := range newMetadata.Labels {
oldMetadata.Labels[key] = value
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/epoll/epoll.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"errors"
"os"
"syscall"

"k8s.io/klog"
)

const (
Expand Down Expand Up @@ -189,6 +191,7 @@ func (e *Epoll) dispatchEvent(ev *syscall.EpollEvent) {
if !ok {
return
}
klog.V(4).Infof("epoll event for file %s dispatched", w.FileName)

e.eventChan <- Event{
fileName: w.FileName,
Expand All @@ -200,7 +203,9 @@ func (e *Epoll) listen() {
events := make([]syscall.EpollEvent, 2)
for e.active {
// TODO: Handle errors here
klog.V(4).Info("waiting for epoll events...")
count, _ := syscall.EpollWait(e.epfd, events, timeout)
klog.V(4).Infof("received %d events from epoll. dispatching...", count)
for i := 0; e.active && i < count; i++ {
e.dispatchEvent(&events[i])
}
Expand Down