runtime/kubernetes: rewrite to improve support of multiple versions of a single service (#2035)
* wip: refactor kubernetes package * runtime/kubernetes: fix invalid labels * runtime/kubernetes: handle delete service not found error * Misc Fixes * runtime: add ServiceAccount option * router/static: return noop table * add kubernetes router * runtime: add port option * store/file: set directory * store/file: pass options to blob store * Revert changes to static router * Fix merge error * runtime/kubernetes: Debug => Error logs * runtime/kubernetes: fix double if
This commit is contained in:
@@ -11,14 +11,14 @@ type Option func(o *Options)
|
||||
|
||||
// Options configure runtime
|
||||
type Options struct {
|
||||
// Service type to manage
|
||||
Type string
|
||||
// Client to use when making requests
|
||||
Client client.Client
|
||||
// Base image to use
|
||||
Image string
|
||||
// Source of the services repository
|
||||
Source string
|
||||
// Service type to manage
|
||||
Type string
|
||||
}
|
||||
|
||||
// WithSource sets the base image / repository
|
||||
@@ -71,6 +71,8 @@ type CreateOptions struct {
|
||||
Retries int
|
||||
// Specify the image to use
|
||||
Image string
|
||||
// Port to expose
|
||||
Port string
|
||||
// Namespace to create the service in
|
||||
Namespace string
|
||||
// Specify the context to use
|
||||
@@ -81,6 +83,8 @@ type CreateOptions struct {
|
||||
Resources *Resources
|
||||
// Volumes to mount
|
||||
Volumes map[string]string
|
||||
// ServiceAccount to start the container with
|
||||
ServiceAccount string
|
||||
}
|
||||
|
||||
// ReadOptions queries runtime services
|
||||
@@ -132,6 +136,13 @@ func CreateEntrypoint(e string) CreateOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithServiceAccount sets the ServiceAccount
|
||||
func WithServiceAccount(s string) CreateOption {
|
||||
return func(o *CreateOptions) {
|
||||
o.ServiceAccount = s
|
||||
}
|
||||
}
|
||||
|
||||
// WithSecret sets a secret to provide the service with
|
||||
func WithSecret(key, value string) CreateOption {
|
||||
return func(o *CreateOptions) {
|
||||
@@ -191,6 +202,13 @@ func WithVolume(name, path string) CreateOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithPort sets the port to expose
|
||||
func WithPort(p string) CreateOption {
|
||||
return func(o *CreateOptions) {
|
||||
o.Port = p
|
||||
}
|
||||
}
|
||||
|
||||
// ResourceLimits sets the resources for the service to use
|
||||
func ResourceLimits(r *Resources) CreateOption {
|
||||
return func(o *CreateOptions) {
|
||||
|
Reference in New Issue
Block a user