Beispiel #1
0
func GetStart() ([]RunOutput, error) {
	out := make([]RunOutput, 0)

	pods := []string{}
	etc, err := config.Etc()
	if err != nil {
		return out, err
	}

	for _, dir := range etc.Run {
		p, _ := convention.Pods(dir)
		pods = append(pods, p...)
	}

	for _, p := range pods {
		o, _ := RunPods(p)
		out = append(out, o)
		// out = append(out, RunOutput{
		// 	ContainerId: "x",
		// })

		// ps := GetStatus()
		// fmt.Println(ps)
	}

	return out, nil
}
Beispiel #2
0
func MakeCmd(p config.Pod) (string, error) {
	etc, _ := config.Etc()

	ct := p.Spec.Containers[0]

	args := []string{}
	args = append(args, "/usr/bin/docker run -d")

	args = append(args, fmt.Sprintf("-l \"pid=%v\"", p.Id))

	for _, s := range ct.Ports {
		args = append(args, fmt.Sprintf("-p \"%v:%v\"", s.HostPort, s.ContainerPort))
	}

	for _, s := range etc.Env {
		args = append(args, fmt.Sprintf("-e \"%v=%v\"", s.Name, s.Value))
	}

	for _, s := range ct.Env {
		args = append(args, fmt.Sprintf("-e \"%v=%v\"", s.Name, s.Value))
	}

	for _, s := range ct.VolumeMounts {
		args = append(args, fmt.Sprintf("-v \"%s:%s\"", s.HostPath, s.MountPath))
	}

	args = append(args, ct.Image)

	command := strings.Join(args, " \\\n")
	return command, nil
}
Beispiel #3
0
func TestEtc(t *testing.T) {
	etc, err := config.Etc()

	for _, dir := range etc.Run {
		t.Log(dir)
	}

	t.Logf("%#v", etc)

	if err != nil {
		t.Fatalf("Err: #v", err)
	}
}