Skip to content

Conversation

@manusa
Copy link
Member

@manusa manusa commented Dec 10, 2025

At the moment, the config and kubernetes modules are tightly coupled.

While reviewing the changes in #559, the current state proves to be a problem since workarounds are required to be able to easily unmarshal the configuration.
Ideally, configuration unmarshalling and parsing should be part of the pkg/config package, while the api package should focus just on defining the structs and interfaces.

This PR attempts to decouple kubernetes from the config module by providing config API interfaces. kubernetes->api->config->...

I'm not proud of how it looks like, but I think that it's a step in the right direction.
Suggestions for further improvements are welcome ;)


Decouples the pkg/kubernetes module from pkg/config by introducing interfaces for configuration access. This allows pkg/kubernetes to depend on abstractions rather than the concrete StaticConfig type.

Changes:

  • Add AuthProvider, ClusterProvider, DeniedResourcesProvider, and ExtendedProvider interfaces in pkg/api/config
  • Move cluster provider strategy constants to pkg/api/config
  • Move GroupVersionKind struct to pkg/api/config
  • Update pkg/kubernetes to use the new interfaces
  • StaticConfig now implements the Config interface

@manusa manusa force-pushed the refactor/decouple-config branch from d8451c1 to aeb75d7 Compare December 10, 2025 15:21
@manusa manusa changed the title refactor(config): extract config interfaces to pkg/api/config refactor(config)!: extract config interfaces to pkg/api/config Dec 10, 2025
@manusa manusa requested review from Cali0707 and nader-ziada and removed request for Cali0707 December 10, 2025 15:23
Copy link
Collaborator

@nader-ziada nader-ziada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of creating the interfaces for other packages to use, so there is no dependency on pkg/config

added some small suggestions

Decouples the pkg/kubernetes module from pkg/config by introducing
interfaces for configuration access. This allows pkg/kubernetes to
depend on abstractions rather than the concrete StaticConfig type.

Changes:
- Add AuthProvider, ClusterProvider, DeniedResourcesProvider, and
  ExtendedProvider interfaces in pkg/api/config
- Move cluster provider strategy constants to pkg/api/config
- Move GroupVersionKind struct to pkg/api/config
- Update pkg/kubernetes to use the new interfaces
- StaticConfig now implements the Config interface

Signed-off-by: Marc Nuri <[email protected]>
@manusa manusa force-pushed the refactor/decouple-config branch from aeb75d7 to 522795c Compare December 10, 2025 16:55
@nader-ziada
Copy link
Collaborator

thanks @manusa

/lgtm

@manusa
Copy link
Member Author

manusa commented Dec 10, 2025

@Cali0707 note that this will break downstream again :(

@nader-ziada
Copy link
Collaborator

@Cali0707 note that this will break downstream again :(

there is already another breaking change from the drop-in reload PR that is not synced downstream yet

@Cali0707
Copy link
Collaborator

Yep I will do another sync later, will aim to do one per week

@nader-ziada nader-ziada merged commit d07482e into containers:main Dec 10, 2025
6 checks passed
@manusa manusa deleted the refactor/decouple-config branch December 11, 2025 05:33
@manusa
Copy link
Member Author

manusa commented Dec 11, 2025

Yep I will do another sync later, will aim to do one per week

🙌 I'll try to get more involved in the process. I want to check before the end of the week to see if we can better reorganize upstream so that the syncing process could be streamlined even more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants