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

[controller] Add labels to BlockDevices #76

Merged
merged 16 commits into from
Aug 28, 2024
Prev Previous commit
Next Next commit
fix linter issues
Signed-off-by: Aleksandr Zimin <alexandr.zimin@flant.com>
AleksZimin committed Aug 19, 2024
commit d4818d29e1ca1268a1f967f8ffcb26cddff8e093
8 changes: 1 addition & 7 deletions images/agent/src/pkg/controller/block_device.go
Original file line number Diff line number Diff line change
@@ -127,7 +127,6 @@ func BlockDeviceReconcile(ctx context.Context, cl kclient.Client, log logger.Log

// add new api device to the map, so it won't be deleted as fantom
apiBlockDevices[candidate.Name] = *device

}
}

@@ -166,11 +165,7 @@ func hasBlockDeviceDiff(blockDevice v1alpha1.BlockDevice, candidate internal.Blo
newLabels := GetBlockDeviceLabels(blockDevice)
equal := reflect.DeepEqual(newLabels, blockDevice.Labels)

if equal {
return false
}

return true
return !equal
}

func GetAPIBlockDevices(ctx context.Context, kc kclient.Client, metrics monitoring.Metrics) (map[string]v1alpha1.BlockDevice, error) {
@@ -549,7 +544,6 @@ func UpdateAPIBlockDevice(ctx context.Context, kc kclient.Client, metrics monito
}

func GetBlockDeviceLabels(blockDevice v1alpha1.BlockDevice) map[string]string {

if blockDevice.Labels == nil {
blockDevice.Labels = make(map[string]string)
}
Original file line number Diff line number Diff line change
@@ -73,7 +73,6 @@ func getLLVRequestedSize(llv *v1alpha1.LVMLogicalVolume, lvg *v1alpha1.LvmVolume
}
}
}

return resource.Quantity{}, nil
}