Merge pull request #2898 from RainbowMango/pr_cleanup_atomic_pointer
Remove redundant pointer use of atomic types
This commit is contained in:
commit
472ccb5a2d
|
@ -32,9 +32,9 @@ type ConfigManager interface {
|
||||||
|
|
||||||
// interpreterConfigManager collects the resource interpreter customization.
|
// interpreterConfigManager collects the resource interpreter customization.
|
||||||
type interpreterConfigManager struct {
|
type interpreterConfigManager struct {
|
||||||
initialSynced *atomic.Bool
|
initialSynced atomic.Bool
|
||||||
lister cache.GenericLister
|
lister cache.GenericLister
|
||||||
configuration *atomic.Value
|
configuration atomic.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
// LuaScriptAccessors returns all cached configurations.
|
// LuaScriptAccessors returns all cached configurations.
|
||||||
|
@ -63,12 +63,8 @@ func (configManager *interpreterConfigManager) HasSynced() bool {
|
||||||
// NewInterpreterConfigManager watches ResourceInterpreterCustomization and organizes
|
// NewInterpreterConfigManager watches ResourceInterpreterCustomization and organizes
|
||||||
// the configurations in the cache.
|
// the configurations in the cache.
|
||||||
func NewInterpreterConfigManager(informer genericmanager.SingleClusterInformerManager) ConfigManager {
|
func NewInterpreterConfigManager(informer genericmanager.SingleClusterInformerManager) ConfigManager {
|
||||||
manager := &interpreterConfigManager{
|
manager := &interpreterConfigManager{}
|
||||||
initialSynced: &atomic.Bool{},
|
|
||||||
configuration: &atomic.Value{},
|
|
||||||
}
|
|
||||||
manager.configuration.Store(make(map[schema.GroupVersionKind]CustomAccessor))
|
manager.configuration.Store(make(map[schema.GroupVersionKind]CustomAccessor))
|
||||||
manager.initialSynced.Store(false)
|
|
||||||
|
|
||||||
// In interpret command, rules are not loaded from server, so we don't start informer for it.
|
// In interpret command, rules are not loaded from server, so we don't start informer for it.
|
||||||
if informer != nil {
|
if informer != nil {
|
||||||
|
|
|
@ -31,9 +31,9 @@ type ConfigManager interface {
|
||||||
|
|
||||||
// interpreterConfigManager collect the resource interpreter webhook configuration.
|
// interpreterConfigManager collect the resource interpreter webhook configuration.
|
||||||
type interpreterConfigManager struct {
|
type interpreterConfigManager struct {
|
||||||
configuration *atomic.Value
|
configuration atomic.Value
|
||||||
lister cache.GenericLister
|
lister cache.GenericLister
|
||||||
initialSynced *atomic.Bool
|
initialSynced atomic.Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// HookAccessors return all configured resource interpreter webhook.
|
// HookAccessors return all configured resource interpreter webhook.
|
||||||
|
@ -62,13 +62,10 @@ func (m *interpreterConfigManager) HasSynced() bool {
|
||||||
// NewExploreConfigManager return a new interpreterConfigManager with resourceinterpreterwebhookconfigurations handlers.
|
// NewExploreConfigManager return a new interpreterConfigManager with resourceinterpreterwebhookconfigurations handlers.
|
||||||
func NewExploreConfigManager(inform genericmanager.SingleClusterInformerManager) ConfigManager {
|
func NewExploreConfigManager(inform genericmanager.SingleClusterInformerManager) ConfigManager {
|
||||||
manager := &interpreterConfigManager{
|
manager := &interpreterConfigManager{
|
||||||
configuration: &atomic.Value{},
|
lister: inform.Lister(resourceExploringWebhookConfigurationsGVR),
|
||||||
lister: inform.Lister(resourceExploringWebhookConfigurationsGVR),
|
|
||||||
initialSynced: &atomic.Bool{},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
manager.configuration.Store([]WebhookAccessor{})
|
manager.configuration.Store([]WebhookAccessor{})
|
||||||
manager.initialSynced.Store(false)
|
|
||||||
|
|
||||||
configHandlers := fedinformer.NewHandlerOnEvents(
|
configHandlers := fedinformer.NewHandlerOnEvents(
|
||||||
func(_ interface{}) { manager.updateConfiguration() },
|
func(_ interface{}) { manager.updateConfiguration() },
|
||||||
|
|
Loading…
Reference in New Issue