Runtime hacks (#1344)

* Add Args/Image to runtime

* remove the hacks
This commit is contained in:
Asim Aslam
2020-03-13 18:39:59 +00:00
committed by GitHub
parent 3543b275e0
commit e803fb0855
12 changed files with 166 additions and 102 deletions

View File

@@ -54,14 +54,12 @@ func newService(s *runtime.Service, c runtime.CreateOptions) *service {
kdeploy.Metadata.Annotations["group"] = "micro"
// update the deployment is a custom source is provided
if len(c.Source) > 0 {
if len(c.Image) > 0 {
for i := range kdeploy.Spec.Template.PodSpec.Containers {
kdeploy.Spec.Template.PodSpec.Containers[i].Image = c.Source
kdeploy.Spec.Template.PodSpec.Containers[i].Image = c.Image
kdeploy.Spec.Template.PodSpec.Containers[i].Command = []string{}
kdeploy.Spec.Template.PodSpec.Containers[i].Args = []string{name}
kdeploy.Spec.Template.PodSpec.Containers[i].Args = []string{}
}
kdeploy.Metadata.Annotations["source"] = c.Source
}
// define the environment values used by the container
@@ -76,11 +74,15 @@ func newService(s *runtime.Service, c runtime.CreateOptions) *service {
kdeploy.Spec.Template.PodSpec.Containers[0].Env = append(kdeploy.Spec.Template.PodSpec.Containers[0].Env, env...)
}
// specify the command to exec
if strings.HasPrefix(c.Source, "github.com") && len(c.Command) > 0 {
// set the command if specified
if len(c.Command) > 0 {
kdeploy.Spec.Template.PodSpec.Containers[0].Command = c.Command
}
if len(c.Args) > 0 {
kdeploy.Spec.Template.PodSpec.Containers[0].Args = c.Args
}
return &service{
Service: s,
kservice: kservice,