mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
Add podresources v1 API
This commit is contained in:
parent
d0e06cf3e0
commit
a989bece00
@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
# This script generates `*/api.pb.go` from the protobuf file `*/api.proto`.
|
# This script generates `*/api.pb.go` from the protobuf file `*/api.proto`.
|
||||||
# Example:
|
# Example:
|
||||||
# kube::protoc::generate_proto "${POD_RESOURCES_ALPHA}"
|
# kube::protoc::generate_proto "${POD_RESOURCES}"
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd -P)"
|
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd -P)"
|
||||||
POD_RESOURCES_ALPHA="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1alpha1/"
|
POD_RESOURCES="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/"
|
||||||
|
|
||||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||||
kube::protoc::generate_proto "${POD_RESOURCES_ALPHA}"
|
kube::protoc::generate_proto "${POD_RESOURCES}"
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# This script generates `/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1alpha1/api.pb.go`
|
# This script generates `/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/api.pb.go`
|
||||||
# from the protobuf file `/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1alpha1/api.proto`
|
# from the protobuf file `/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/api.proto`
|
||||||
# for pods.
|
# for pods.
|
||||||
# Usage: `hack/update-generated-pod-resources.sh`.
|
# Usage: `hack/update-generated-pod-resources.sh`.
|
||||||
|
|
||||||
|
@ -24,26 +24,26 @@ set -o nounset
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
POD_RESOURCES_ALPHA="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1alpha1/"
|
POD_RESOURCES="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/"
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
|
|
||||||
function cleanup {
|
function cleanup {
|
||||||
rm -rf "${POD_RESOURCES_ALPHA}/_tmp/"
|
rm -rf "${POD_RESOURCES}/_tmp/"
|
||||||
}
|
}
|
||||||
|
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
mkdir -p "${POD_RESOURCES_ALPHA}/_tmp"
|
mkdir -p "${POD_RESOURCES}/_tmp"
|
||||||
cp "${POD_RESOURCES_ALPHA}/api.pb.go" "${POD_RESOURCES_ALPHA}/_tmp/"
|
cp "${POD_RESOURCES}/api.pb.go" "${POD_RESOURCES}/_tmp/"
|
||||||
|
|
||||||
ret=0
|
ret=0
|
||||||
KUBE_VERBOSE=3 "${KUBE_ROOT}/hack/update-generated-pod-resources.sh"
|
KUBE_VERBOSE=3 "${KUBE_ROOT}/hack/update-generated-pod-resources.sh"
|
||||||
diff -I "gzipped FileDescriptorProto" -I "0x" -Naupr "${POD_RESOURCES_ALPHA}/_tmp/api.pb.go" "${POD_RESOURCES_ALPHA}/api.pb.go" || ret=$?
|
diff -I "gzipped FileDescriptorProto" -I "0x" -Naupr "${POD_RESOURCES}/_tmp/api.pb.go" "${POD_RESOURCES}/api.pb.go" || ret=$?
|
||||||
if [[ $ret -eq 0 ]]; then
|
if [[ $ret -eq 0 ]]; then
|
||||||
echo "Generated pod resources api is up to date."
|
echo "Generated pod resources api is up to date."
|
||||||
cp "${POD_RESOURCES_ALPHA}/_tmp/api.pb.go" "${POD_RESOURCES_ALPHA}/"
|
cp "${POD_RESOURCES}/_tmp/api.pb.go" "${POD_RESOURCES}/"
|
||||||
else
|
else
|
||||||
echo "Generated pod resources api is out of date. Please run hack/update-generated-pod-resources.sh"
|
echo "Generated pod resources api is out of date. Please run hack/update-generated-pod-resources.sh"
|
||||||
exit 1
|
exit 1
|
||||||
|
30
staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/BUILD
Normal file
30
staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/BUILD
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = ["api.pb.go"],
|
||||||
|
importmap = "k8s.io/kubernetes/vendor/k8s.io/kubelet/pkg/apis/podresources/v1alpha1",
|
||||||
|
importpath = "k8s.io/kubelet/pkg/apis/podresources/v1alpha1",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/github.com/gogo/protobuf/gogoproto:go_default_library",
|
||||||
|
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
|
||||||
|
"//vendor/google.golang.org/grpc:go_default_library",
|
||||||
|
"//vendor/google.golang.org/grpc/codes:go_default_library",
|
||||||
|
"//vendor/google.golang.org/grpc/status:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "package-srcs",
|
||||||
|
srcs = glob(["**"]),
|
||||||
|
tags = ["automanaged"],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "all-srcs",
|
||||||
|
srcs = [":package-srcs"],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
1400
staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/api.pb.go
Normal file
1400
staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/api.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,48 @@
|
|||||||
|
// To regenerate api.pb.go run hack/update-generated-pod-resources.sh
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package v1;
|
||||||
|
|
||||||
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
|
||||||
|
option (gogoproto.goproto_stringer_all) = false;
|
||||||
|
option (gogoproto.stringer_all) = true;
|
||||||
|
option (gogoproto.goproto_getters_all) = true;
|
||||||
|
option (gogoproto.marshaler_all) = true;
|
||||||
|
option (gogoproto.sizer_all) = true;
|
||||||
|
option (gogoproto.unmarshaler_all) = true;
|
||||||
|
option (gogoproto.goproto_unrecognized_all) = false;
|
||||||
|
|
||||||
|
|
||||||
|
// PodResourcesLister is a service provided by the kubelet that provides information about the
|
||||||
|
// node resources consumed by pods and containers on the node
|
||||||
|
service PodResourcesLister {
|
||||||
|
rpc List(ListPodResourcesRequest) returns (ListPodResourcesResponse) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPodResourcesRequest is the request made to the PodResourcesLister service
|
||||||
|
message ListPodResourcesRequest {}
|
||||||
|
|
||||||
|
// ListPodResourcesResponse is the response returned by List function
|
||||||
|
message ListPodResourcesResponse {
|
||||||
|
repeated PodResources pod_resources = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PodResources contains information about the node resources assigned to a pod
|
||||||
|
message PodResources {
|
||||||
|
string name = 1;
|
||||||
|
string namespace = 2;
|
||||||
|
repeated ContainerResources containers = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContainerResources contains information about the resources assigned to a container
|
||||||
|
message ContainerResources {
|
||||||
|
string name = 1;
|
||||||
|
repeated ContainerDevices devices = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContainerDevices contains information about the devices assigned to a container
|
||||||
|
message ContainerDevices {
|
||||||
|
string resource_name = 1;
|
||||||
|
repeated string device_ids = 2;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user