hajimari
hajimari copied to clipboard
Duplicated application groups
Describe the bug Application groups injected via ingress annotations and customApps are not merged. This results in the group appearing twice:
I checked the that they written exactly the same: Admin
To Reproduce Steps to reproduce the behavior:
- Add following annotation
hajimari.io/enable: "true" hajimari.io/icon: logos:kubernetes hajimari.io/info: Kubernetes dashboard hajimari.io/group: Admin
- Add following custom app
customApps: - group: Admin apps: - name: Test url: 'https://example.com' icon: 'mdi:test-tube' info: This is a test app
- See the duplication
Expected behavior
Both apps showing in the same group
Screenshots
See above
Desktop (please complete the following information):
- OS: Windows
- Browser Frirefox
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version 105.0.3
Additional context NA
I saw this when the case was different in the annotation and the custom app, not sure if there are other cases where it happens as well.
@ullbergm - that was my thought as I had problems with the case before. But I double-checked including seeing if there were any extra leading/trailing spaces and there are none I can see.
Did the de-duplication work for you when the cases match between the ingress and custom app?
It did.
I think the problem is that when customApps are loaded from the config the group name is turned in to lower-case but that is not happening with ingressApps: https://github.com/toboshii/hajimari/blob/main/internal/hajimari/customapps/customapps.go#L30 vs https://github.com/toboshii/hajimari/blob/main/internal/kube/wrappers/ingress.go#L61
@toboshii The current fix I put in is to normalize the group names when loaded from the config/kubernetes api. The drawback is that if the theme changes in the future then we may want to retain the case of the group names.
Incidentally, there is also an issue if you have extra spaces like @angelnu said which is fixed with a strings.TrimSpace() when loading/comparing the objects.
edit: changed my mind
Thanks @ullbergm - I can confirm that after removing the capital case (Admin -> admin) then both groups are merged as expected.