Commit Graph

22 Commits

Author SHA1 Message Date
Sascha Grunert 3c7be0577a Convert `k8s.io/kubelet/pkg/apis/deviceplugin` from gogo to protoc
Use standard protoc for the device plugin API instead of gogo.

Part of kubernetes#96564

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>

Kubernetes-commit: 3026020b44a097a6f95a884e1e7f966c12675c0f
2025-07-17 13:47:44 +02:00
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
Tim Hockin 62e4faf81a Call update-proto-bindings from update-codegen
One script to bring them all ...

Kubernetes-commit: 4dae505d531e149881788dc36148602967419c75
2023-01-05 15:41:51 -08:00
Tim Hockin 16286abe1c Merge 5 fragile proto-bindings scripts into 1
Each of these scripts is basically identical, and all were too brittle.
Now they should be more resilient and easier to manage.  The script
still needs to be updated if we add new ones, which I do not love.

More cleanup to follow.

Kubernetes-commit: e0ecccff3f5148cc167117ac73233b4edc1640d8
2023-01-05 13:53:59 -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
Davanum Srinivas e94dab0e48 OWNERS cleanup - Jan 2021 Week 1
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9682b7248fb69733c2a0ee53618856e87b067f16
2022-01-03 10:59:47 -05:00
Davanum Srinivas 00d6744c8e Cleanup OWNERS files (No Activity in the last year)
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 497e9c1971c9e7d0193bc6d11503ec4ad527f1d5
2021-12-10 15:18:50 -05:00
Davanum Srinivas 7a49d3b22e Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9405e9b55ebcd461f161859a698b949ea3bde31d
2021-12-09 21:31:26 -05: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
Anthony ARNAUD 3f4a6a9389 Port deviceManager in windows container manager
Kubernetes-commit: 8bdc3d897018862c654a7fb0b4094abd7df45eb2
2020-07-21 12:35:49 +02:00
David Ashpole c5a2be5f9e consistently use double quotes in proto files
Kubernetes-commit: 296f7c91bb52cd724ce6d6d120d5d41ed459d677
2020-09-03 13:50:03 -07:00
Jeremy Shih 96b39cb21c fix golint failures
some packages under staging/src/k8s.io/sample-apiserver/

Kubernetes-commit: a39f502fc058fbba8258a84617a6ed3700ee4343
2020-08-31 17:17:28 +08: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
Kevin Klues 4e51df3aae Update whitespace in device plugin api.proto
Kubernetes-commit: 9c4198952413685106fa4aef0537154a08e900fd
2020-07-02 15:15:41 +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 76f250ec4d Fix device plugin generator script
Kubernetes-commit: fa9a55617bbbbe274195f9f2915e7364c1cb3de5
2019-11-20 12:53:09 +08: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