mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-07 21:40:44 +00:00
Dependency injection for oas servicemap (#895)
* Update main.go, main.go, and 3 more files... * WIP * Update main.go, oas_controller.go, and 3 more files... * Update main.go, oas_generator.go, and servicemap.go * Update loader.go and resolver.go * Update oas_generator.go * Update oas_generator.go, specgen_test.go, and 3 more files... * Update service_map_controller_test.go * Update oas_controller_test.go
This commit is contained in:
11
agent/pkg/dependency/container.go
Normal file
11
agent/pkg/dependency/container.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package dependency
|
||||
|
||||
var typeIntializerMap = make(map[DependencyContainerType]func() interface{}, 0)
|
||||
|
||||
func RegisterGenerator(name DependencyContainerType, fn func() interface{}) {
|
||||
typeIntializerMap[name] = fn
|
||||
}
|
||||
|
||||
func GetInstance(name DependencyContainerType) interface{} {
|
||||
return typeIntializerMap[name]()
|
||||
}
|
8
agent/pkg/dependency/type_names.go
Normal file
8
agent/pkg/dependency/type_names.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package dependency
|
||||
|
||||
type DependencyContainerType string
|
||||
|
||||
const (
|
||||
ServiceMapGeneratorDependency = "ServiceMapGeneratorDependency"
|
||||
OasGeneratorDependency = "OasGeneratorDependency"
|
||||
)
|
Reference in New Issue
Block a user