Action Asim's Feedback

This commit is contained in:
Ben Toogood
2020-02-06 09:17:10 +00:00
parent d8110b70a3
commit aa58a9749b
5 changed files with 15 additions and 42 deletions

View File

@@ -327,7 +327,8 @@ func (k *kubernetes) List() ([]*runtime.Service, error) {
func (k *kubernetes) Update(s *runtime.Service) error {
// create new kubernetes micro service
service := newService(s, runtime.CreateOptions{
Type: k.options.Type,
Type: k.options.Type,
Source: k.options.Source,
})
// update build time annotation
@@ -343,8 +344,8 @@ func (k *kubernetes) Delete(s *runtime.Service) error {
// create new kubernetes micro service
service := newService(s, runtime.CreateOptions{
Type: k.options.Type,
BaseImage: k.options.Source,
Type: k.options.Type,
Source: k.options.Source,
})
return service.Stop(k.client)

View File

@@ -34,6 +34,13 @@ func newService(s *runtime.Service, c runtime.CreateOptions) *service {
kservice := client.NewService(name, version, c.Type)
kdeploy := client.NewDeployment(name, version, c.Type)
if len(s.Source) > 0 {
for _, c := range kdeploy.Spec.Template.PodSpec.Containers {
c.Image = s.Source
c.Command = []string{name}
}
}
// attach our values to the deployment; name, version, source
kdeploy.Metadata.Annotations["name"] = s.Name
kdeploy.Metadata.Annotations["version"] = s.Version

View File

@@ -51,8 +51,8 @@ type CreateOptions struct {
Output io.Writer
// Type of service to create
Type string
// Base image for docker
BaseImage string
// Source of the code
Source string
}
// ReadOptions queries runtime services
@@ -94,13 +94,6 @@ func WithOutput(out io.Writer) CreateOption {
}
}
// WithBaseImage sets the docker img
func WithBaseImage(img string) CreateOption {
return func(o *CreateOptions) {
o.BaseImage = img
}
}
// ReadService returns services with the given name
func ReadService(service string) ReadOption {
return func(o *ReadOptions) {