tinkerbell / hegel

Instance Metadata Service
https://tinkerbell.org
Apache License 2.0
98 stars 33 forks source link

Look at all namespace unless overridden #370

Closed willemm closed 2 months ago

willemm commented 3 months ago

Description

Removes the default setting where not specifying the kubernetes-namespace defaults it to whatever namespace the controller is running in

Why is this needed

https://github.com/tinkerbell/cluster-api-provider-tinkerbell/issues/385

With this change, you can create hardware resources in different namespaces.

Fixes: #

How Has This Been Tested?

We have a cluster-api setup where we're adding some bare metal nodes to a cluster. With this change, the hardware resources that previously only worked from the tink-system namespace now also work from a different namespace. I also tested the old working setup and that still works as well. The change is minimal, so it shouldn't impact much. I haven't tested if the --kubernetes-namespace setting would restrict it to one namespace again.

How are existing users impacted? What migration steps/scripts do we need?

The Role and RoleBinding resources in the helm chart (or whatever other deployment method) need to be changed to ClusterRole and ClusterRoleBinding, otherwise it will not be able to read from the other namespaces.

Otherwise no migration steps are needed, unless users have multiple instances of hegel running in different namespaces, or have another reason why they specifically don't want resources in a different namespace to be picked up.

This could probably be avoided by having the helm chart add the kubernetes-namespace argument to the deployment and have it pull the value from the downward api somehow, but it seems to me that having it default to looking at all namespaces would be preferrable for most users.

Checklist:

I have:

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 56.34%. Comparing base (d8923f9) to head (733cb22). Report is 10 commits behind head on main.

Files Patch % Lines
internal/backend/kubernetes/backend.go 0.00% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #370 +/- ## ========================================== + Coverage 55.60% 56.34% +0.74% ========================================== Files 27 27 Lines 633 630 -3 ========================================== + Hits 352 355 +3 + Misses 267 259 -8 - Partials 14 16 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.