feat(node-agent): Node Agent CDI Simulator - #728
Conversation
4bcf2a1 to
844989d
Compare
|
Non-blocking suggestion: consider giving the CDI simulator a logger and emitting one line per The reasoning is the same for both. That matters more for CDI than for most surfaces: when the spec is missing or stale, the symptom shows up far away, as containerd refusing container creation or injecting nothing, and the first question is whether the agent wrote the spec at all and with how many devices. Something like: func New(log *slog.Logger) *Simulator { return &Simulator{log: log} }
func (s *Simulator) Apply(_ context.Context, h *host.Host, state *agent.State) error {
nvidiaPath := filepath.Join(h.Run, nvidiaSpecFile)
nriPath := filepath.Join(h.Run, nriSpecFile)
if err := writeSpec(h, nvidiaPath, buildNvidiaSpec(state)); err != nil {
return fmt.Errorf("nvidia.yaml: %w", err)
}
if err := writeSpec(h, nriPath, buildNRISpec(state)); err != nil {
return fmt.Errorf("nvml-mock-nri.yaml: %w", err)
}
s.log.Info("wrote CDI specs", "simulator", name,
"nvidia", nvidiaPath, "nri", nriPath, "devices", len(state.Devices))
return nil
}
Happy to fold this into #734 instead if you'd rather keep this PR as a straight port. |
844989d to
2e37ada
Compare
Signed-off-by: Roman Hlushko <rhlushko@nvidia.com> # Conflicts: # deployments/nvml-mock/helm/nvml-mock/templates/daemonset.yaml
Signed-off-by: Roman Hlushko <rhlushko@nvidia.com>
Signed-off-by: Roman Hlushko <rhlushko@nvidia.com>
Signed-off-by: Roman Hlushko <rhlushko@nvidia.com>
Signed-off-by: Roman Hlushko <rhlushko@nvidia.com>
Signed-off-by: Roman Hlushko <rhlushko@nvidia.com>
2e37ada to
3faf71f
Compare
The base branch was changed.
What This PR Does
Ported the CDI logic as a new node agent Simulator.
Cleaned up nvml-mock scripts from ported logic.
Why
A part of MEP0003.
Checklist
git commit -s)go test -v -race ./...)make lint-fix)Stack created with GitHub Stacks CLI • Give Feedback 💬