Skip to content

Commit 8db28ec

Browse files
committed
change computedomain path from config()
Signed-off-by: Swati Gupta <[email protected]>
1 parent feba8f8 commit 8db28ec

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

cmd/compute-domain-kubelet-plugin/computedomain.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const (
4343
informerResyncPeriod = 10 * time.Minute
4444
cleanupInterval = 10 * time.Minute
4545

46+
ComputeDomainDaemonConfigFilesDirName = "domains"
4647
ComputeDomainDaemonConfigTemplatePath = "/templates/compute-domain-daemon-config.tmpl.cfg"
4748
)
4849

@@ -66,13 +67,10 @@ type ComputeDomainDaemonSettings struct {
6667
nodesConfigPath string
6768
}
6869

69-
func (c Config) ComputeDomainDaemonSettingsRoot() string {
70-
return filepath.Join(c.DriverPluginPath(), "domains")
71-
}
72-
73-
func NewComputeDomainManager(config *Config, configFilesRoot, cliqueID string) *ComputeDomainManager {
70+
func NewComputeDomainManager(config *Config, cliqueID string) *ComputeDomainManager {
7471
factory := nvinformers.NewSharedInformerFactory(config.clientsets.Nvidia, informerResyncPeriod)
7572
informer := factory.Resource().V1beta1().ComputeDomains().Informer()
73+
configFilesRoot := filepath.Join(config.DriverPluginPath(), ComputeDomainDaemonConfigFilesDirName)
7674

7775
m := &ComputeDomainManager{
7876
config: config,

cmd/compute-domain-kubelet-plugin/device_state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func NewDeviceState(ctx context.Context, config *Config) (*DeviceState, error) {
9090
return nil, fmt.Errorf("error getting cliqueID: %w", err)
9191
}
9292

93-
computeDomainManager := NewComputeDomainManager(config, config.ComputeDomainDaemonSettingsRoot(), cliqueID)
93+
computeDomainManager := NewComputeDomainManager(config, cliqueID)
9494

9595
if err := cdi.CreateStandardDeviceSpecFile(allocatable); err != nil {
9696
return nil, fmt.Errorf("unable to create base CDI spec file: %v", err)

cmd/compute-domain-kubelet-plugin/driver.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ const (
4343
// that deadline, retryable errors are retried (with backoff) via the
4444
// workqueue abstraction.
4545
ErrorRetryMaxTimeout = 45 * time.Second
46+
// DriverPrepUprepFlockPath is the path to a lock file used to make sure
47+
// that calls to nodePrepareResource() / nodeUnprepareResource() never
48+
// interleave, node-globally.
49+
DriverPrepUprepFlockFileName = "pu.lock"
4650
)
4751

4852
// permanentError defines an error indicating that it is permanent.
@@ -61,23 +65,18 @@ type driver struct {
6165
pulock *flock.Flock
6266
}
6367

64-
// DriverPrepUprepFlockPath is the path to a lock file used to make sure
65-
// that calls to nodePrepareResource() / nodeUnprepareResource() never
66-
// interleave, node-globally.
67-
func (c Config) DriverPrepUprepFlockPath() string {
68-
return filepath.Join(c.DriverPluginPath(), "pu.lock")
69-
}
70-
7168
func NewDriver(ctx context.Context, config *Config) (*driver, error) {
7269
state, err := NewDeviceState(ctx, config)
7370
if err != nil {
7471
return nil, err
7572
}
7673

74+
puLockPath := filepath.Join(config.DriverPluginPath(), DriverPrepUprepFlockFileName)
75+
7776
driver := &driver{
7877
client: config.clientsets.Core,
7978
state: state,
80-
pulock: flock.NewFlock(config.DriverPrepUprepFlockPath()),
79+
pulock: flock.NewFlock(puLockPath),
8180
}
8281

8382
helper, err := kubeletplugin.Start(

0 commit comments

Comments
 (0)