Commit Graph

11 Commits

Author SHA1 Message Date
Evan Lezar 9afe88e41b Add CDI devices to device plugin API
This change adds CDI device IDs to the ContainerAllocateResponse in the
device plugin API. This allows a device plugin to specify CDI devices
by their unique fully-qualified CDI device names using the related field
in the CRI specification.

Signed-off-by: Evan Lezar <elezar@nvidia.com>

Kubernetes-commit: b57c7e2fe4bb466ff1614aa9df7cc164e90b24b6
2023-05-16 15:12:32 +02:00
Tim Hockin 558a8ec0e0 Set proto go_package: kubelet deviceplugin API
This exposes that the hand-written code used the wrong package name.

This also creates some diff to the *.pb.go files to note that in the
"options".

You can dump the gzipped blob with the following program (thanks
StackOverflow!):

```go
package main

import (
	"bytes"
	"compress/gzip"
	"encoding/json"
	"fmt"
	"os"

	"io/ioutil"

	proto "github.com/golang/protobuf/proto"
	dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
)

func main() {
	m := map[string][]byte{
		"before": blobv1,
		"after": blobv2,
	}
	arg := os.Args[1]
	dump(m[arg])
}

func dump(bytes []byte) {
	fd, err := decodeFileDesc(bytes)
	if err != nil {
		panic(err)
	}
	b, err := json.MarshalIndent(fd, "", "  ")
	if err != nil {
		panic(err)
	}
	fmt.Println(string(b))
}

// decompress does gzip decompression.
func decompress(b []byte) ([]byte, error) {
	r, err := gzip.NewReader(bytes.NewReader(b))
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	out, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	return out, nil
}

func decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) {
	raw, err := decompress(enc)
	if err != nil {
		return nil, fmt.Errorf("failed to decompress enc: %v", err)
	}

	fd := new(dpb.FileDescriptorProto)
	if err := proto.Unmarshal(raw, fd); err != nil {
		return nil, fmt.Errorf("bad descriptor: %v", err)
	}
	return fd, nil
}
```

Kubernetes-commit: 22ddeb02c1e7245ad3e8ae6835f2bd9ac10c3497
2023-01-14 10:27:13 -08:00
Davanum Srinivas 279c758121 Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: a9593d634c6a053848413e600dadbf974627515f
2022-07-19 20:54:13 -04:00
Angus Lees bcb28af0cf Rename deviceIDs -> device_ids to follow protobuf naming conventions
The protocol buffer [styleguide] says field names should use
underscore_separated_names.

Code generation tools rely on this convention to split words and
generate language-specific accessors/properties in the local style
conventions (ie: it's more than just a style convention).  For
example, the previous `deviceIDs` name caused Rust proto tools to
generate field names like `device_i_ds` which is just weird.

[styleguide]: https://developers.google.com/protocol-buffers/docs/style#message-and-field-names

Rename `deviceIDs` field to `device_ids`, and use a gogo-specific
option to keep the existing `DeviceIDs` golang name (otherwise it
would generate `DeviceIds`).

Note this doesn't affect protocol buffer / gRPC wire encoding, which
uses numeric values.

Kubernetes-commit: 815dcd5b3174f9ccaa3789f1b688a809223ca860
2020-06-05 12:27:02 +10:00
Nabarun Pal 916f97b0c2 update gogo/protobuf to v1.3.2
gogo/protobuf@v1.3.2 fixes https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3121

Ref: https://github.com/kubernetes/client-go/issues/927

Signed-off-by: Nabarun Pal <pal.nabarun95@gmail.com>

Kubernetes-commit: 9cada2ec3ba793597606a1df1375ff8e8311ccf3
2021-01-27 18:01:27 +05:30
Carlos Panato a22c6a5382 [go1.15] updatestaging pb.go files using the hack scripts
Kubernetes-commit: 3dec5781ade54eb47cf8d1dc8428f33d8739f10b
2021-01-27 11:50:33 +01:00
Kevin Klues 83a091b032 Add GetPreferredAllocation() call to the device plugin api.proto
The details of this API can be found in:
https://github.com/kubernetes/enhancements/pull/1121

Kubernetes-commit: 202c4f0816be76ece0a9ba8b94192f458e55b35a
2020-07-02 15:15:46 +00:00
drfish 97d98d762a Fix typo from reseting to resetting
Kubernetes-commit: 5a44cd65fd9687410003a5933203f01ff9299ea1
2020-01-10 21:35:06 +08:00
Davanum Srinivas b929782e22 update generated files
Kubernetes-commit: b3853138a4f1a0637ec3c38a5c59f8228765b261
2020-01-13 17:56:56 -05:00
chenyaqi01 56e9dcaef1 fix inconsistent comment in device plugin api
Kubernetes-commit: f8d3c45d1a9fb25ab3df697a0a59c05c7d60d586
2019-10-11 10:26:19 +08:00
Davanum Srinivas 4398d8f461 Move pkg/kubelet/pluginregistration and deviceplugin
Change-Id: I06adcb43bd278b430ffad2010869e1524c8cc4ff

Kubernetes-commit: d30c489c54c5e6d41ae3a1e1fcd96d24dba4fc51
2019-10-06 15:24:24 -04:00