d8334cf884
This commit is an initial (read: janky) approach to forwarding state from an allocrunner hook to a taskrunner using a similar `hookResources` approach that tr's use internally. It should eventually probably be replaced with something a little bit more message based, but for things that only come from pre-run hooks, and don't change, it's probably fine for now.
30 lines
579 B
Go
30 lines
579 B
Go
package structs
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/hashicorp/nomad/client/pluginmanager/csimanager"
|
|
)
|
|
|
|
// AllocHookResources contains data that is provided by AllocRunner Hooks for
|
|
// consumption by TaskRunners
|
|
type AllocHookResources struct {
|
|
CSIMounts map[string]*csimanager.MountInfo
|
|
|
|
mu sync.RWMutex
|
|
}
|
|
|
|
func (a *AllocHookResources) GetCSIMounts() map[string]*csimanager.MountInfo {
|
|
a.mu.RLock()
|
|
defer a.mu.RUnlock()
|
|
|
|
return a.CSIMounts
|
|
}
|
|
|
|
func (a *AllocHookResources) SetCSIMounts(m map[string]*csimanager.MountInfo) {
|
|
a.mu.Lock()
|
|
defer a.mu.Unlock()
|
|
|
|
a.CSIMounts = m
|
|
}
|