Skip to content

Commit 58a9cfc

Browse files
committed
Add support Edit ContainerMount for kata/direct volume
Add support Edit Container Mount for kata/runtime-rs using direct volume in K8S/CSI scenario. The added vendor/class: "kata.direct.volume/direct-volume" Fixes: cncf-tags#162 Signed-off-by: alex.lyn <[email protected]>
1 parent 1f83d84 commit 58a9cfc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pkg/cdi/cache.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ func (c *Cache) InjectDevices(ociSpec *oci.Spec, devices ...string) ([]string, e
232232
for _, device := range devices {
233233
d := c.devices[device]
234234
if d == nil {
235-
unresolved = append(unresolved, device)
235+
// In kata direct-volume case, no need to unresolve it.
236+
if !strings.HasPrefix(device, "kata.direct.volume") {
237+
unresolved = append(unresolved, device)
238+
}
236239
continue
237240
}
238241
if _, ok := specs[d.GetSpec()]; !ok {

pkg/parser/parser.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,13 @@ func ValidateDeviceName(name string) error {
184184
for _, c := range string(name[1 : len(name)-1]) {
185185
switch {
186186
case IsAlphaNumeric(c):
187-
case c == '_' || c == '-' || c == '.' || c == ':':
187+
case c == '_' || c == '-' || c == '.' || c == ':' || c == '=':
188188
default:
189189
return fmt.Errorf("invalid character '%c' in device name %q",
190190
c, name)
191191
}
192192
}
193-
if !IsAlphaNumeric(rune(name[len(name)-1])) {
194-
return fmt.Errorf("invalid name %q, should end with a letter or digit", name)
195-
}
193+
196194
return nil
197195
}
198196

0 commit comments

Comments
 (0)