cri_hook: remove annotation check

This commit is contained in:
Ed Bartosh 2024-05-22 12:30:28 +03:00
parent 8eac8b5edd
commit ca6f8f3020
4 changed files with 0 additions and 47 deletions

View File

@ -32,9 +32,6 @@ const (
configJSON = "config.json"
fpgaRegionEnvPrefix = "FPGA_REGION_"
fpgaAfuEnvPrefix = "FPGA_AFU_"
annotationName = "com.intel.fpga.mode"
annotationValue = "fpga.intel.com/region"
)
// Stdin defines structure for standard JSONed input of the OCI platform hook.
@ -220,16 +217,6 @@ func getStdin(reader io.Reader) (*Stdin, error) {
return nil, err
}
// Check if device plugin annotation is set
if stdinJ.Annotations.ComIntelFpgaMode == "" {
return nil, errors.Errorf("annotation %s is not set", annotationName)
}
// Check if device plugin annotation is set
if stdinJ.Annotations.ComIntelFpgaMode != annotationValue {
return nil, errors.Errorf("annotation %s has incorrect value '%s'", annotationName, stdinJ.Annotations.ComIntelFpgaMode)
}
if stdinJ.Bundle == "" {
return nil, errors.New("'bundle' field is not set in the stdin JSON")
}

View File

@ -73,16 +73,6 @@ func TestGetStdin(t *testing.T) {
stdinJSON: "stdin-incorrect-JSON.json",
expectedErr: true,
},
{
name: "no annotations",
stdinJSON: "stdin-no-annotations.json",
expectedErr: true,
},
{
name: "annotation is not set",
stdinJSON: "stdin-incorrect-intel-annotation.json",
expectedErr: true,
},
}
for _, tc := range tcases {
t.Run(tc.name, func(t *testing.T) {

View File

@ -1,17 +0,0 @@
{
"annotations": {
"io.kubernetes.container.hash": "b202a1fa",
"io.kubernetes.container.name": "test-container",
"io.kubernetes.container.restartCount": "0",
"io.kubernetes.pod.name": "test-fpga-region",
"io.kubernetes.pod.namespace": "default",
"io.kubernetes.pod.terminationGracePeriod": "30",
"io.kubernetes.pod.uid": "942e94c1-72d3-11e8-b221-c81f66f62fcc",
"com.intel.fpga.mode": "incorrect value"
},
"bundle": "testdata",
"id": "1c40dd8efd268a47d7fb9f75d00f50c20af49d07d8d3c5fb948e68abb6d5ecf9",
"ociVersion": "1.0.0",
"pid": 39638,
"status": ""
}

View File

@ -1,7 +0,0 @@
{
"bundle": "testdata",
"id": "1c40dd8efd268a47d7fb9f75d00f50c20af49d07d8d3c5fb948e68abb6d5ecf9",
"ociVersion": "1.0.0",
"pid": 39638,
"status": ""
}