Fixes for runtime builder (#2029)

* util/tar: add archive util funcs

* runtime: add store, builder options

* runtime/local: update RuntimeSource func

* runtime/builder/golang: use tar util

* store/s3: make keys safe

* runtime: add entrypoint options

* runtime/builder: remove debugging

* wip: integrate builder into k8s runtime

* runtime/builder/golang: build for a linux architecture

* runtime/kubernetes: write builds to the users namespace

* runtime/local/source: fixes for mono-repo builds

* runtime/local: stop checking out source (the responsibility is on the client)

* runtime/builder: fix golang tests

* runtime/local: fix out of bounds panic

* Update

* revert changes

* runtime/local/source: refactor git package (wip)

* runtime/kubernetes: map err not found

* fix TestRunGenericRemote test

* runtime/local: fix update not reassining source

* Tidy go mod

* runtime.Pending => runtime.Starting

* store/s3: only use credentials option when set

* store/s3: add tls config option
This commit is contained in:
ben-toogood
2020-10-02 09:54:26 +01:00
committed by GitHub
parent 231cfc48f0
commit 0a6e451539
6 changed files with 111 additions and 106 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/micro/go-micro/v3/logger"
log "github.com/micro/go-micro/v3/logger"
"github.com/micro/go-micro/v3/runtime"
"github.com/micro/go-micro/v3/util/kubernetes/api"
"github.com/micro/go-micro/v3/util/kubernetes/client"
)
@@ -218,7 +219,7 @@ func (k *kubernetes) getService(labels map[string]string, opts ...client.GetOpti
// set status from waiting
if v := state.Waiting; v != nil {
status = runtime.Pending
status = runtime.Starting
}
svc.Status(status, nil)
@@ -577,7 +578,13 @@ func (k *kubernetes) Delete(s *runtime.Service, opts ...runtime.DeleteOption) er
ns := client.DeleteNamespace(options.Namespace)
k.client.Delete(&client.Resource{Name: credentialsName(s), Kind: "secret"}, ns)
return service.Stop(k.client, ns)
if err := service.Stop(k.client, ns); err == api.ErrNotFound {
return runtime.ErrNotFound
} else if err != nil {
return err
}
return nil
}
// Start starts the runtime
@@ -741,7 +748,7 @@ func (k *kubernetes) DeleteNamespace(ns string) error {
func transformStatus(depStatus string) runtime.ServiceStatus {
switch strings.ToLower(depStatus) {
case "pending":
return runtime.Pending
return runtime.Starting
case "containercreating":
return runtime.Starting
case "imagepullbackoff":
@@ -759,7 +766,7 @@ func transformStatus(depStatus string) runtime.ServiceStatus {
case "failed":
return runtime.Error
case "waiting":
return runtime.Pending
return runtime.Starting
case "terminated":
return runtime.Stopped
default: