Skip to content

Commit

Permalink
fix: hub without dedinic
Browse files Browse the repository at this point in the history
Signed-off-by: Airren <[email protected]>
  • Loading branch information
Airren committed Jul 31, 2024
1 parent 3849032 commit f9d8761
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/cnf/CNFManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,16 @@ type Manager struct {
}

func (m *Manager) Run(ctx context.Context) error {
go m.startLeaderElection(m.leaderLock, ctx)
if !m.agentSpec.AsHub {
go m.startLeaderElection(m.leaderLock, ctx)
m.dedinicEngine(ctx)
} else {
m.startLeaderElection(m.leaderLock, ctx)
}
return nil
}

func (m *Manager) dedinicEngine(ctx context.Context) {
dedinic.CNFPodName = os.Getenv("NAUTI_PODNAME")
if dedinic.CNFPodName == "" {
klog.Fatalf("get self pod name failed")
Expand All @@ -68,7 +76,6 @@ func (m *Manager) Run(ctx context.Context) error {

klog.Info("start nri dedicated plugin run")
dedinic.InitNRIPlugin(m.localK8sClient)
return nil
}

// NewCNFManager returns a new CNFController.
Expand Down

0 comments on commit f9d8761

Please sign in to comment.