...

Source file src/k8s.io/kubernetes/test/e2e/dra/test-driver/app/cdi.go

Documentation: k8s.io/kubernetes/test/e2e/dra/test-driver/app

     1  /*
     2  Copyright 2022 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package app
    18  
    19  // These definitions are sufficient to generate simple CDI files which set env
    20  // variables in a container, which is all that the test driver does.  A real
    21  // driver will either use pre-generated CDI files or can use the
    22  // github.com/container-orchestrated-devices/container-device-interface/pkg/cdi
    23  // helper package to generate files.
    24  //
    25  // This is not done in Kubernetes to minimize dependencies.
    26  
    27  // spec is the base configuration for CDI.
    28  type spec struct {
    29  	Version string `json:"cdiVersion"`
    30  	Kind    string `json:"kind"`
    31  
    32  	Devices []device `json:"devices"`
    33  }
    34  
    35  // device is a "Device" a container runtime can add to a container.
    36  type device struct {
    37  	Name           string         `json:"name"`
    38  	ContainerEdits containerEdits `json:"containerEdits"`
    39  }
    40  
    41  // containerEdits are edits a container runtime must make to the OCI spec to expose the device.
    42  type containerEdits struct {
    43  	Env []string `json:"env,omitempty"`
    44  }
    45  

View as plain text