Skip to content

Commit ac173d7

Browse files
Using existing env var to confirm CDI is enabled
Signed-off-by: Vishesh Tanksale <vtanksale@nvidia.com>
1 parent df3a86f commit ac173d7

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

cmd/compute-domain-daemon/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,11 @@ func newApp() *cli.App {
204204

205205
// Run invokes the IMEX daemon and manages its lifecycle.
206206
func run(ctx context.Context, cancel context.CancelFunc, flags *Flags) error {
207-
// Verify that CDI container edits were applied by the container runtime.
208-
// If the env var is not set to "true", CDI is likely disabled and the daemon
209-
// cannot function correctly (e.g. the /imexd mount will be missing).
210-
if os.Getenv(common.CDIEditsAppliedEnvKey) != common.CDIEditsAppliedEnvValue {
207+
// Verify that CDI container edits were applied by the container runtime by
208+
// checking for COMPUTE_DOMAIN_UUID, which is always injected as part of the
209+
// CDI edits. If it is missing, CDI is likely disabled and the daemon cannot
210+
// function correctly (e.g. the /imexd mount will be missing).
211+
if flags.computeDomainUUID == "" {
211212
return fmt.Errorf("CDI container edits did not apply -- is CDI enabled in your container runtime?")
212213
}
213214

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ func (s *ComputeDomainDaemonSettings) GetCDIContainerEditsCommon(ctx context.Con
162162
edits := &cdiapi.ContainerEdits{
163163
ContainerEdits: &cdispec.ContainerEdits{
164164
Env: []string{
165-
fmt.Sprintf("%s=%s", common.CDIEditsAppliedEnvKey, common.CDIEditsAppliedEnvValue),
166165
fmt.Sprintf("CLIQUE_ID=%s", s.manager.cliqueID),
167166
fmt.Sprintf("COMPUTE_DOMAIN_UUID=%s", cd.UID),
168167
fmt.Sprintf("COMPUTE_DOMAIN_NAME=%s", cd.Name),

internal/common/util.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ import (
2929

3030
const dumpPath = "/tmp/goroutine-stacks.dump"
3131

32-
// CDIEditsAppliedEnvKey and CDIEditsAppliedEnvValue is a key/value
33-
// pair injected via CDI container edits into the CD daemon container. The CD
34-
// daemon checks for this key/value pair at startup to verify that CDI edits were
35-
// applied by the container runtime. If not present, CDI is likely disabled.
36-
const (
37-
CDIEditsAppliedEnvKey = "NVIDIA_CDI_EDITS_APPLIED"
38-
CDIEditsAppliedEnvValue = "true"
39-
)
40-
4132
// Set up SIGUSR2 handler: if triggered, acquire stack traces for all goroutines
4233
// in this process. Dump to file, and fall back to emitting to stderr if file
4334
// output didn't work.

0 commit comments

Comments
 (0)