Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions pkg/kubelet/hyper/hyper.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,6 @@ func (r *runtime) GetPods(all bool) ([]*kubecontainer.Pod, error) {

var kubepods []*kubecontainer.Pod
for _, podInfo := range podInfos {
if !all && podInfo.Status != "running" {
continue
}

var pod kubecontainer.Pod
var containers []*kubecontainer.Container

Expand Down Expand Up @@ -861,8 +857,33 @@ func (r *runtime) RemoveImage(image kubecontainer.ImageSpec) error {
// stream the log. Set 'follow' to false and specify the number of lines (e.g.
// "100" or "all") to tail the log.
func (r *runtime) GetContainerLogs(pod *api.Pod, containerID kubecontainer.ContainerID, logOptions *api.PodLogOptions, stdout, stderr io.Writer) error {
// TODO: get container logs for hyper
return fmt.Errorf("Hyper: GetContainerLogs unimplemented")
glog.V(4).Infof("Hyper: running logs on container %s", containerID.ID)

args := append([]string{}, "logs")
if logOptions.Follow {
args = append(args, "--follow")
}
if *logOptions.SinceSeconds != 0 {
args = append(args, fmt.Sprintf("--since=%d", *logOptions.SinceSeconds))
}
if *logOptions.TailLines != 0 {
args = append(args, fmt.Sprintf("--tail=%d", *logOptions.TailLines))
}
if logOptions.Timestamps {
args = append(args, "--timestamps")
}

command := r.buildCommand(args...)
p, err := kubecontainer.StartPty(command)
if err != nil {
return err
}
defer p.Close()

if stdout != nil {
go io.Copy(stdout, p)
}
return command.Wait()
}

// Runs the command in the container of the specified pod
Expand Down Expand Up @@ -909,7 +930,6 @@ func (r *runtime) ExecInContainer(containerID kubecontainer.ContainerID, cmd []s
go io.Copy(stdout, p)
}
return command.Wait()

}

func (r *runtime) AttachContainer(containerID kubecontainer.ContainerID, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool) error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubelet/hyper/hyperclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (
HYPER_PROTO = "unix"
HYPER_ADDR = "/var/run/hyper.sock"
HYPER_SCHEME = "http"
HYPER_MINVERSION = "0.3.0"
HYPER_MINVERSION = "0.4.0"
DEFAULT_IMAGE_TAG = "latest"

KEY_ID = "id"
Expand Down