github-vet / github-vet/rangeloop-pointer-findings
kubermatic/kubermatic: pkg/clusterdeletion/clusterregistry.go; 27 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [kubermatic/kubermatic](https://www.github.com/kubermatic/kubermatic) at [pkg/clusterdeletion/clusterregistry.go](https://github.com/kubermatic/kubermatic/blob/46bc5b15a6ef9c91a5067796f07684f028e01804/pkg/clusterdeletion/clusterregistry.go#L67-L93)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.
>
[Click here to see the code in its original context.](https://github.com/kubermatic/kubermatic/blob/46bc5b15a6ef9c91a5067796f07684f028e01804/pkg/clusterdeletion/clusterregistry.go#L67-L93)
Click here to show the 27 line(s) of Go which triggered the analyzer.
```go
for _, imageRegistry := range imageRegistryConfigs.Items {
if err := userClusterClient.Delete(ctx, &imageRegistry); err != nil {
return false, fmt.Errorf("failed to delete ImageRegistryConfig %q: %v", imageRegistry.GetName(), err)
}
// The registry operator doesn't remove its finalizer when the registry has no storage config
storageConfigEmpty, err := hasEmptyStorageConfig(imageRegistry)
if err != nil {
return false, fmt.Errorf("failed to check if storage config is empty for registryConfig %q: %v", imageRegistry.GetName(), err)
}
if !storageConfigEmpty {
continue
}
if !kuberneteshelper.HasFinalizer(&imageRegistry, openshiftImageRegistryFinalizer) {
continue
}
log.Debugw("ImageregistryConfig has no storage configured but finalizer, removing it", "name", imageRegistry.GetName())
oldImageRegistry := imageRegistry.DeepCopy()
kuberneteshelper.RemoveFinalizer(&imageRegistry, openshiftImageRegistryFinalizer)
if err := userClusterClient.Patch(ctx, &imageRegistry, ctrlruntimeclient.MergeFrom(oldImageRegistry)); err != nil {
return false, fmt.Errorf("failed to remove %q finalizer from imageRegistryConfig %q: %v", openshiftImageRegistryFinalizer, imageRegistry.GetName(), err)
}
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {HasFinalizer 2} was not found in the callgraph; reference was passed directly to third-party code
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 46bc5b15a6ef9c91a5067796f07684f028e01804
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.