mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #19524 from derekparker/rkt-image-size
Auto commit by PR queue bot
This commit is contained in:
commit
171c2ecbe7
4
Godeps/Godeps.json
generated
4
Godeps/Godeps.json
generated
@ -340,8 +340,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/coreos/rkt/api/v1alpha",
|
"ImportPath": "github.com/coreos/rkt/api/v1alpha",
|
||||||
"Comment": "v0.13.0-98-gddfa976",
|
"Comment": "v0.15.0-22-g8ac03ac",
|
||||||
"Rev": "ddfa97689c1f8e89aff51368300c34da4c74091b"
|
"Rev": "8ac03ace42034b4d6b31af9e3ef574b9e71ccc1a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/cpuguy83/go-md2man/md2man",
|
"ImportPath": "github.com/cpuguy83/go-md2man/md2man",
|
||||||
|
1
Godeps/_workspace/src/github.com/coreos/rkt/api/v1alpha/README.md
generated
vendored
1
Godeps/_workspace/src/github.com/coreos/rkt/api/v1alpha/README.md
generated
vendored
@ -10,3 +10,4 @@ For more information, see:
|
|||||||
- #1208
|
- #1208
|
||||||
- #1359
|
- #1359
|
||||||
- #1468
|
- #1468
|
||||||
|
- [API Service Subcommand](../../Documentation/subcommands/api-service.md)
|
||||||
|
51
Godeps/_workspace/src/github.com/coreos/rkt/api/v1alpha/api.pb.go
generated
vendored
51
Godeps/_workspace/src/github.com/coreos/rkt/api/v1alpha/api.pb.go
generated
vendored
@ -226,6 +226,10 @@ type Image struct {
|
|||||||
ImportTimestamp int64 `protobuf:"varint,5,opt,name=import_timestamp" json:"import_timestamp,omitempty"`
|
ImportTimestamp int64 `protobuf:"varint,5,opt,name=import_timestamp" json:"import_timestamp,omitempty"`
|
||||||
// JSON-encoded byte array that represents the image manifest, optional.
|
// JSON-encoded byte array that represents the image manifest, optional.
|
||||||
Manifest []byte `protobuf:"bytes,6,opt,name=manifest,proto3" json:"manifest,omitempty"`
|
Manifest []byte `protobuf:"bytes,6,opt,name=manifest,proto3" json:"manifest,omitempty"`
|
||||||
|
// Size is the size in bytes of this image in the store.
|
||||||
|
Size int64 `protobuf:"varint,7,opt,name=size" json:"size,omitempty"`
|
||||||
|
// Annotations on this image.
|
||||||
|
Annotations []*KeyValue `protobuf:"bytes,8,rep,name=annotations" json:"annotations,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Image) Reset() { *m = Image{} }
|
func (m *Image) Reset() { *m = Image{} }
|
||||||
@ -239,6 +243,13 @@ func (m *Image) GetBaseFormat() *ImageFormat {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Image) GetAnnotations() []*KeyValue {
|
||||||
|
if m != nil {
|
||||||
|
return m.Annotations
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Network describes the network information of a pod.
|
// Network describes the network information of a pod.
|
||||||
type Network struct {
|
type Network struct {
|
||||||
// Name of the network that a pod belongs to, required.
|
// Name of the network that a pod belongs to, required.
|
||||||
@ -265,6 +276,8 @@ type App struct {
|
|||||||
// Exit code of the app. optional, only valid if it's returned by InspectPod() and
|
// Exit code of the app. optional, only valid if it's returned by InspectPod() and
|
||||||
// the app has already exited.
|
// the app has already exited.
|
||||||
ExitCode int32 `protobuf:"zigzag32,4,opt,name=exit_code" json:"exit_code,omitempty"`
|
ExitCode int32 `protobuf:"zigzag32,4,opt,name=exit_code" json:"exit_code,omitempty"`
|
||||||
|
// Annotations for this app.
|
||||||
|
Annotations []*KeyValue `protobuf:"bytes,5,rep,name=annotations" json:"annotations,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *App) Reset() { *m = App{} }
|
func (m *App) Reset() { *m = App{} }
|
||||||
@ -278,21 +291,40 @@ func (m *App) GetImage() *Image {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *App) GetAnnotations() []*KeyValue {
|
||||||
|
if m != nil {
|
||||||
|
return m.Annotations
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Pod describes a pod's information.
|
// Pod describes a pod's information.
|
||||||
|
// If a pod is in Embryo, Preparing, AbortedPrepare state,
|
||||||
|
// only id and state will be returned.
|
||||||
|
//
|
||||||
|
// If a pod is in other states, the pod manifest and
|
||||||
|
// apps will be returned when 'detailed' is true in the request.
|
||||||
|
//
|
||||||
|
// A valid pid of the stage1 process of the pod will be returned
|
||||||
|
// if the pod is Running has run once.
|
||||||
|
//
|
||||||
|
// Networks are only returned when a pod is in Running.
|
||||||
type Pod struct {
|
type Pod struct {
|
||||||
// ID of the pod, in the form of a UUID, required.
|
// ID of the pod, in the form of a UUID.
|
||||||
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
||||||
// PID of the pod, optional, only valid if it's returned by InspectPod(). A negative value means the pod has exited.
|
// PID of the stage1 process of the pod.
|
||||||
Pid int32 `protobuf:"zigzag32,2,opt,name=pid" json:"pid,omitempty"`
|
Pid int32 `protobuf:"zigzag32,2,opt,name=pid" json:"pid,omitempty"`
|
||||||
// State of the pod, required.
|
// State of the pod.
|
||||||
State PodState `protobuf:"varint,3,opt,name=state,enum=v1alpha.PodState" json:"state,omitempty"`
|
State PodState `protobuf:"varint,3,opt,name=state,enum=v1alpha.PodState" json:"state,omitempty"`
|
||||||
// List of apps in the pod, required.
|
// List of apps in the pod.
|
||||||
Apps []*App `protobuf:"bytes,4,rep,name=apps" json:"apps,omitempty"`
|
Apps []*App `protobuf:"bytes,4,rep,name=apps" json:"apps,omitempty"`
|
||||||
// Network information of the pod, optional, non-empty if the pod is running in private net.
|
// Network information of the pod.
|
||||||
// Note that a pod can be in multiple networks.
|
// Note that a pod can be in multiple networks.
|
||||||
Networks []*Network `protobuf:"bytes,5,rep,name=networks" json:"networks,omitempty"`
|
Networks []*Network `protobuf:"bytes,5,rep,name=networks" json:"networks,omitempty"`
|
||||||
// JSON-encoded byte array that represents the pod manifest of the pod, required.
|
// JSON-encoded byte array that represents the pod manifest of the pod.
|
||||||
Manifest []byte `protobuf:"bytes,6,opt,name=manifest,proto3" json:"manifest,omitempty"`
|
Manifest []byte `protobuf:"bytes,6,opt,name=manifest,proto3" json:"manifest,omitempty"`
|
||||||
|
// Annotations on this pod.
|
||||||
|
Annotations []*KeyValue `protobuf:"bytes,7,rep,name=annotations" json:"annotations,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Pod) Reset() { *m = Pod{} }
|
func (m *Pod) Reset() { *m = Pod{} }
|
||||||
@ -313,6 +345,13 @@ func (m *Pod) GetNetworks() []*Network {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Pod) GetAnnotations() []*KeyValue {
|
||||||
|
if m != nil {
|
||||||
|
return m.Annotations
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type KeyValue struct {
|
type KeyValue struct {
|
||||||
// Key part of the key-value pair.
|
// Key part of the key-value pair.
|
||||||
Key string `protobuf:"bytes,1,opt" json:"Key,omitempty"`
|
Key string `protobuf:"bytes,1,opt" json:"Key,omitempty"`
|
||||||
|
34
Godeps/_workspace/src/github.com/coreos/rkt/api/v1alpha/api.proto
generated
vendored
34
Godeps/_workspace/src/github.com/coreos/rkt/api/v1alpha/api.proto
generated
vendored
@ -73,6 +73,12 @@ message Image {
|
|||||||
|
|
||||||
// JSON-encoded byte array that represents the image manifest, optional.
|
// JSON-encoded byte array that represents the image manifest, optional.
|
||||||
bytes manifest = 6;
|
bytes manifest = 6;
|
||||||
|
|
||||||
|
// Size is the size in bytes of this image in the store.
|
||||||
|
int64 size = 7;
|
||||||
|
|
||||||
|
// Annotations on this image.
|
||||||
|
repeated KeyValue annotations = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Network describes the network information of a pod.
|
// Network describes the network information of a pod.
|
||||||
@ -109,6 +115,9 @@ message App {
|
|||||||
// Exit code of the app. optional, only valid if it's returned by InspectPod() and
|
// Exit code of the app. optional, only valid if it's returned by InspectPod() and
|
||||||
// the app has already exited.
|
// the app has already exited.
|
||||||
sint32 exit_code = 4;
|
sint32 exit_code = 4;
|
||||||
|
|
||||||
|
// Annotations for this app.
|
||||||
|
repeated KeyValue annotations = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PodState defines the possible states of the pod.
|
// PodState defines the possible states of the pod.
|
||||||
@ -133,25 +142,38 @@ enum PodState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pod describes a pod's information.
|
// Pod describes a pod's information.
|
||||||
|
// If a pod is in Embryo, Preparing, AbortedPrepare state,
|
||||||
|
// only id and state will be returned.
|
||||||
|
//
|
||||||
|
// If a pod is in other states, the pod manifest and
|
||||||
|
// apps will be returned when 'detailed' is true in the request.
|
||||||
|
//
|
||||||
|
// A valid pid of the stage1 process of the pod will be returned
|
||||||
|
// if the pod is Running has run once.
|
||||||
|
//
|
||||||
|
// Networks are only returned when a pod is in Running.
|
||||||
message Pod {
|
message Pod {
|
||||||
// ID of the pod, in the form of a UUID, required.
|
// ID of the pod, in the form of a UUID.
|
||||||
string id = 1;
|
string id = 1;
|
||||||
|
|
||||||
// PID of the pod, optional, only valid if it's returned by InspectPod(). A negative value means the pod has exited.
|
// PID of the stage1 process of the pod.
|
||||||
sint32 pid = 2;
|
sint32 pid = 2;
|
||||||
|
|
||||||
// State of the pod, required.
|
// State of the pod.
|
||||||
PodState state = 3;
|
PodState state = 3;
|
||||||
|
|
||||||
// List of apps in the pod, required.
|
// List of apps in the pod.
|
||||||
repeated App apps = 4;
|
repeated App apps = 4;
|
||||||
|
|
||||||
// Network information of the pod, optional, non-empty if the pod is running in private net.
|
// Network information of the pod.
|
||||||
// Note that a pod can be in multiple networks.
|
// Note that a pod can be in multiple networks.
|
||||||
repeated Network networks = 5;
|
repeated Network networks = 5;
|
||||||
|
|
||||||
// JSON-encoded byte array that represents the pod manifest of the pod, required.
|
// JSON-encoded byte array that represents the pod manifest of the pod.
|
||||||
bytes manifest = 6;
|
bytes manifest = 6;
|
||||||
|
|
||||||
|
// Annotations on this pod.
|
||||||
|
repeated KeyValue annotations = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message KeyValue {
|
message KeyValue {
|
||||||
|
76
Godeps/_workspace/src/github.com/coreos/rkt/api/v1alpha/client_example.go
generated
vendored
Normal file
76
Godeps/_workspace/src/github.com/coreos/rkt/api/v1alpha/client_example.go
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
// Copyright 2015 The rkt Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
// Note that if your project uses Godep to manage dependencies, then
|
||||||
|
// you need to change following the import paths.
|
||||||
|
"github.com/coreos/rkt/api/v1alpha"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
conn, err := grpc.Dial("localhost:15441", grpc.WithInsecure())
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
c := v1alpha.NewPublicAPIClient(conn)
|
||||||
|
defer conn.Close()
|
||||||
|
|
||||||
|
// List pods.
|
||||||
|
podResp, err := c.ListPods(context.Background(), &v1alpha.ListPodsRequest{
|
||||||
|
// Specify the request: Fetch and print only running pods and their details.
|
||||||
|
Detail: true,
|
||||||
|
Filters: []*v1alpha.PodFilter{
|
||||||
|
{
|
||||||
|
States: []v1alpha.PodState{v1alpha.PodState_POD_STATE_RUNNING},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, p := range podResp.Pods {
|
||||||
|
fmt.Printf("Pod %q is running\n", p.Id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// List images.
|
||||||
|
imgResp, err := c.ListImages(context.Background(), &v1alpha.ListImagesRequest{
|
||||||
|
// In this request, we fetch the details of images whose names are prefixed with "coreos.com".
|
||||||
|
Detail: true,
|
||||||
|
Filters: []*v1alpha.ImageFilter{
|
||||||
|
{
|
||||||
|
Prefixes: []string{"coreos.com"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(3)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, im := range imgResp.Images {
|
||||||
|
fmt.Printf("Found image %q\n", im.Name)
|
||||||
|
}
|
||||||
|
}
|
@ -88,7 +88,7 @@ func (r *Runtime) ListImages() ([]kubecontainer.Image, error) {
|
|||||||
images[i] = kubecontainer.Image{
|
images[i] = kubecontainer.Image{
|
||||||
ID: image.Id,
|
ID: image.Id,
|
||||||
RepoTags: []string{buildImageName(image)},
|
RepoTags: []string{buildImageName(image)},
|
||||||
//TODO: fill in the size of the image
|
Size: image.Size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return images, nil
|
return images, nil
|
||||||
|
@ -300,21 +300,25 @@ func TestListImages(t *testing.T) {
|
|||||||
Id: "sha512-a2fb8f390702",
|
Id: "sha512-a2fb8f390702",
|
||||||
Name: "quay.io/coreos/alpine-sh",
|
Name: "quay.io/coreos/alpine-sh",
|
||||||
Version: "latest",
|
Version: "latest",
|
||||||
|
Size: 400,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Id: "sha512-c6b597f42816",
|
Id: "sha512-c6b597f42816",
|
||||||
Name: "coreos.com/rkt/stage1-coreos",
|
Name: "coreos.com/rkt/stage1-coreos",
|
||||||
Version: "0.10.0",
|
Version: "0.10.0",
|
||||||
|
Size: 400,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[]kubecontainer.Image{
|
[]kubecontainer.Image{
|
||||||
{
|
{
|
||||||
ID: "sha512-a2fb8f390702",
|
ID: "sha512-a2fb8f390702",
|
||||||
RepoTags: []string{"quay.io/coreos/alpine-sh:latest"},
|
RepoTags: []string{"quay.io/coreos/alpine-sh:latest"},
|
||||||
|
Size: 400,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: "sha512-c6b597f42816",
|
ID: "sha512-c6b597f42816",
|
||||||
RepoTags: []string{"coreos.com/rkt/stage1-coreos:0.10.0"},
|
RepoTags: []string{"coreos.com/rkt/stage1-coreos:0.10.0"},
|
||||||
|
Size: 400,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user