-
Notifications
You must be signed in to change notification settings - Fork 708
Closed
Labels
area/providerkind/enhancementNew feature or requestNew feature or requestkind/featurenew featurenew featurekind/refactor
Description
Description:
For now, all the resources related process method in k8s provider are coupling deeply with k8s client, we should free these method from it.
| func (r *gatewayAPIReconciler) processGateways(ctx context.Context, managedGC *gwapiv1.GatewayClass, resourceMap *resourceMappings, resourceTree *gatewayapi.Resources) error { |
So I propose a refactor: the basic idea is to separate how we process resources and how we retrieve resources.
By defining Operations interface and ResourceProcessor structure, each provider can maintain their own implemention of Operations, and different provider can share the same ResourceProcessor.
type Operations interface {
ListGateways()
ListHTTPRoutes()
FindReferenceGrant()
...
}
type ResourceProcessor struct {
Operations
}
func (r *ResourceProcessor) ProcessGateways() {
// use r.ListGateways() to retrieve all Gateway resources
}
func (r *ResourceProcessor) ProcessHTTPRoutes() {}
func (r *ResourceProcessor) findReferenceGrant() {}
...we can
- let k8s provider only foucs on how to retrieve resources, so does file provider
- the k8s and file provider can share the same process logic for resources, and we don't need to maintain two places of code for each provider type
[optional Relevant Links:]
Any extra documentation required to understand the issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/providerkind/enhancementNew feature or requestNew feature or requestkind/featurenew featurenew featurekind/refactor