Commit Graph

15 Commits

Author SHA1 Message Date
Sascha Grunert 27761cabf9 Convert `k8s.io/kubelet/pkg/apis/podresources` from gogo to protoc
Use standard protoc for the pod resources instead of gogo.

Part of kubernetes#96564

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

Kubernetes-commit: 532d48fe6adebcd4be43979ff189140f2d047f30
2025-07-17 13:33:46 +02:00
Patrick Ohly c4a7fd5cb7 DRA kubelet: adapt to v1alpha3 API
This adds the ability to select specific requests inside a claim for a
container.

NodePrepareResources is always called, even if the claim is not used by any
container. This could be useful for drivers where that call has some effect
other than injecting CDI device IDs into containers. It also ensures that
drivers can validate configs.

The pod resource API can no longer report a class for each claim because there
is no such 1:1 relationship anymore. Instead, that API reports claim,
API devices (with driver/pool/device as ID) and CDI device IDs. The kubelet
itself doesn't extract that information from the claim. Instead, it relies on
drivers to report this information when the claim gets prepared. This isolates
the kubelet from API changes.

Because of a faulty E2E test, kubelet was told to contact the wrong driver for
a claim. This was not visible in the kubelet log output. Now changes to the
claim info cache are getting logged. While at it, naming of variables and some
existing log output gets harmonized.

Co-authored-by: Oksana Baranova <oksana.baranova@intel.com>
Co-authored-by: Ed Bartosh <eduard.bartosh@intel.com>

Kubernetes-commit: 877829aeaa9b87d457bf1a3e59ae228e8aa1b1f0
2024-07-17 15:09:02 +02:00
Moshe Levi 0ce2bcfd40 kubelet podresources: extend List to support Dynamic Resources and implement Get API
Signed-off-by: Moshe Levi <moshele@nvidia.com>

Kubernetes-commit: 2a568bcfc821edd46e43cd072ba2a23456c9605e
2023-03-14 01:34:54 +02:00
Tim Hockin 189da6f245 Set proto go_package: podresources API
This 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: a2603fdb81ab2160ec80f2063a258d18854e80e3
2023-01-14 10:22:56 -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
Artyom Lukianov 93cd3d97e3 Extend pod resource API response to return the memory manager information
Signed-off-by: Artyom Lukianov <alukiano@redhat.com>

Kubernetes-commit: 24023f9fcc7a2031d81a53add1e0054319f0b0f0
2021-04-05 17:15:36 +03:00
Francesco Romani 5bb58afe54 node: podresources: add generated files
Signed-off-by: Francesco Romani <fromani@redhat.com>

Kubernetes-commit: 8b79ad65335d5f82822aba64ef436c519dcfdef3
2021-02-03 16:26:16 +01:00
Francesco Romani f73b3cd2cb node: podresources: add GetAllocatableResources API
Extend the podresources API adding the GetAllocatableResources endpoint,
as specified in the KEP
https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2043-pod-resource-concrete-assigments

Signed-off-by: Francesco Romani <fromani@redhat.com>

Kubernetes-commit: c44f8214dbd6072416acf3b3ad405838ccf4e93c
2020-11-11 10:30:58 +01: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
Alexey Perevalov 77bc9b8ae4 Generate podresources API for TopologyInfo and cpu_ids
Signed-off-by: Alexey Perevalov <alexey.perevalov@huawei.com>

Kubernetes-commit: db0a515be0cfc3fe10ff6b48212dd56ea3bb50c2
2020-10-28 12:43:13 +03:00
Alexey Perevalov 8001f72d88 Add TopologyInfo and cpu_ids into podresources
Signed-off-by: Alexey Perevalov <alexey.perevalov@huawei.com>

Kubernetes-commit: ce921c039b933d4ec9ccb2c3db0aea3b9c56283a
2020-10-22 11:47:34 +03:00
Renaud Gaubert 3a7ef55e24 Update generated files
Kubernetes-commit: 68cf24c087752ace54fea33678d063196afd285e
2020-10-10 12:57:15 -07:00
Renaud Gaubert 8fadf102c0 Add podresources v1 API
Kubernetes-commit: a989bece009496c7d862d42fd32cab9eaf3a21f2
2020-10-10 12:54:21 -07:00