Skip to content

Commit

Permalink
Bump tags.cncf.io/container-device-interface to v0.7.1
Browse files Browse the repository at this point in the history
This includes migrating from cdi.GetRegistry() to cdi.Configure() and
cdi.GetDefaultCache() as applicable.

Signed-off-by: Evan Lezar <[email protected]>
  • Loading branch information
elezar committed Apr 6, 2024
1 parent 19600fa commit a40cf31
Show file tree
Hide file tree
Showing 18 changed files with 287 additions and 149 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ require (
gopkg.in/inf.v0 v0.9.1
gopkg.in/yaml.v3 v3.0.1
sigs.k8s.io/yaml v1.4.0
tags.cncf.io/container-device-interface v0.6.2
tags.cncf.io/container-device-interface v0.7.1
)

require (
Expand Down Expand Up @@ -238,7 +238,7 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
tags.cncf.io/container-device-interface/specs-go v0.6.0 // indirect
tags.cncf.io/container-device-interface/specs-go v0.7.0 // indirect
)

replace github.com/opencontainers/runc => github.com/opencontainers/runc v1.1.1-0.20240131200429-02120488a4c0
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
src.elv.sh v0.16.0-rc1.0.20220116211855-fda62502ad7f h1:pjVeIo9Ba6K1Wy+rlwX91zT7A+xGEmxiNRBdN04gDTQ=
tags.cncf.io/container-device-interface v0.6.2 h1:dThE6dtp/93ZDGhqaED2Pu374SOeUkBfuvkLuiTdwzg=
tags.cncf.io/container-device-interface v0.6.2/go.mod h1:Shusyhjs1A5Na/kqPVLL0KqnHQHuunol9LFeUNkuGVE=
tags.cncf.io/container-device-interface/specs-go v0.6.0 h1:V+tJJN6dqu8Vym6p+Ru+K5mJ49WL6Aoc5SJFSY0RLsQ=
tags.cncf.io/container-device-interface/specs-go v0.6.0/go.mod h1:hMAwAbMZyBLdmYqWgYcKH0F/yctNpV3P35f+/088A80=
tags.cncf.io/container-device-interface v0.7.1 h1:MATNCbAD1su9U6zwQe5BrQ2vGGp1GBayD70bYaxYCNE=
tags.cncf.io/container-device-interface v0.7.1/go.mod h1:h1JVuOqTQVORp8DziaWKUCDNzAmN+zeCbqbqD30D0ZQ=
tags.cncf.io/container-device-interface/specs-go v0.7.0 h1:w/maMGVeLP6TIQJVYT5pbqTi8SCw/iHZ+n4ignuGHqg=
tags.cncf.io/container-device-interface/specs-go v0.7.0/go.mod h1:hMAwAbMZyBLdmYqWgYcKH0F/yctNpV3P35f+/088A80=
8 changes: 5 additions & 3 deletions libpod/container_internal_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,16 @@ func (c *Container) generateSpec(ctx context.Context) (s *spec.Spec, cleanupFunc

// Warning: CDI may alter g.Config in place.
if len(c.config.CDIDevices) > 0 {
registry := cdi.GetRegistry(
registry, err := cdi.NewCache(
cdi.WithAutoRefresh(false),
)
if err != nil {
return nil, nil, fmt.Errorf("creating CDI registry: %w", err)
}
if err := registry.Refresh(); err != nil {
logrus.Debugf("The following error was triggered when refreshing the CDI registry: %v", err)
}
_, err := registry.InjectDevices(g.Config, c.config.CDIDevices...)
if err != nil {
if _, err := registry.InjectDevices(g.Config, c.config.CDIDevices...); err != nil {
return nil, nil, fmt.Errorf("setting up CDI devices: %w", err)
}
}
Expand Down
8 changes: 5 additions & 3 deletions pkg/specgen/generate/config_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ import (
// DevicesFromPath computes a list of devices
func DevicesFromPath(g *generate.Generator, devicePath string) error {
if isCDIDevice(devicePath) {
registry := cdi.GetRegistry(
registry, err := cdi.NewCache(
cdi.WithAutoRefresh(false),
)
if err != nil {
return fmt.Errorf("creating CDI registry: %w", err)
}
if err := registry.Refresh(); err != nil {
logrus.Debugf("The following error was triggered when refreshing the CDI registry: %v", err)
}
_, err := registry.InjectDevices(g.Config, devicePath)
if err != nil {
if _, err = registry.InjectDevices(g.Config, devicePath); err != nil {
return fmt.Errorf("setting up CDI devices: %w", err)
}
return nil
Expand Down
8 changes: 5 additions & 3 deletions pkg/specgen/generate/config_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ import (
// DevicesFromPath computes a list of devices
func DevicesFromPath(g *generate.Generator, devicePath string) error {
if isCDIDevice(devicePath) {
registry := cdi.GetRegistry(
registry, err := cdi.NewCache(
cdi.WithAutoRefresh(false),
)
if err != nil {
return fmt.Errorf("creating CDI registry: %w", err)
}
if err := registry.Refresh(); err != nil {
logrus.Debugf("The following error was triggered when refreshing the CDI registry: %v", err)
}
_, err := registry.InjectDevices(g.Config, devicePath)
if err != nil {
if _, err := registry.InjectDevices(g.Config, devicePath); err != nil {
return fmt.Errorf("setting up CDI devices: %w", err)
}
return nil
Expand Down
7 changes: 3 additions & 4 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1397,14 +1397,13 @@ gopkg.in/yaml.v3
## explicit; go 1.12
sigs.k8s.io/yaml
sigs.k8s.io/yaml/goyaml.v2
# tags.cncf.io/container-device-interface v0.6.2
## explicit; go 1.19
tags.cncf.io/container-device-interface/internal/multierror
# tags.cncf.io/container-device-interface v0.7.1
## explicit; go 1.20
tags.cncf.io/container-device-interface/internal/validation
tags.cncf.io/container-device-interface/internal/validation/k8s
tags.cncf.io/container-device-interface/pkg/cdi
tags.cncf.io/container-device-interface/pkg/parser
# tags.cncf.io/container-device-interface/specs-go v0.6.0
# tags.cncf.io/container-device-interface/specs-go v0.7.0
## explicit; go 1.19
tags.cncf.io/container-device-interface/specs-go
# github.com/opencontainers/runc => github.com/opencontainers/runc v1.1.1-0.20240131200429-02120488a4c0

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 30 additions & 21 deletions vendor/tags.cncf.io/container-device-interface/pkg/cdi/cache.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a40cf31

Please sign in to comment.