1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-10 21:52:01 +02:00

Merge branch 'master' into git-secrets

This commit is contained in:
ben-toogood
2020-04-23 15:01:47 +01:00
committed by GitHub
14 changed files with 411 additions and 109 deletions

View File

@@ -1,6 +1,7 @@
package runtime
import (
"context"
"io"
)
@@ -68,6 +69,10 @@ type CreateOptions struct {
Image string
// Specify secrets to use when pulling the image
ImagePullSecrets []string
// Namespace to create the service in
Namespace string
// Specify the context to use
Context context.Context
}
// ReadOptions queries runtime services
@@ -78,6 +83,10 @@ type ReadOptions struct {
Version string
// Type of service
Type string
// Namespace the service is running in
Namespace string
// Specify the context to use
Context context.Context
}
// CreateType sets the type of service to create
@@ -98,6 +107,20 @@ func CreateImage(img string) CreateOption {
func CreateImagePullSecret(secrets ...string) CreateOption {
return func(o *CreateOptions) {
o.ImagePullSecrets = append(o.ImagePullSecrets, secrets...)
}
}
// CreateNamespace sets the namespace
func CreateNamespace(ns string) CreateOption {
return func(o *CreateOptions) {
o.Namespace = ns
}
}
// CreateContext sets the context
func CreateContext(ctx context.Context) CreateOption {
return func(o *CreateOptions) {
o.Context = ctx
}
}
@@ -159,6 +182,66 @@ func ReadType(t string) ReadOption {
}
}
// ReadNamespace sets the namespace
func ReadNamespace(ns string) ReadOption {
return func(o *ReadOptions) {
o.Namespace = ns
}
}
// ReadContext sets the context
func ReadContext(ctx context.Context) ReadOption {
return func(o *ReadOptions) {
o.Context = ctx
}
}
type UpdateOption func(o *UpdateOptions)
type UpdateOptions struct {
// Namespace the service is running in
Namespace string
// Specify the context to use
Context context.Context
}
// UpdateNamespace sets the namespace
func UpdateNamespace(ns string) UpdateOption {
return func(o *UpdateOptions) {
o.Namespace = ns
}
}
// UpdateContext sets the context
func UpdateContext(ctx context.Context) UpdateOption {
return func(o *UpdateOptions) {
o.Context = ctx
}
}
type DeleteOption func(o *DeleteOptions)
type DeleteOptions struct {
// Namespace the service is running in
Namespace string
// Specify the context to use
Context context.Context
}
// DeleteNamespace sets the namespace
func DeleteNamespace(ns string) DeleteOption {
return func(o *DeleteOptions) {
o.Namespace = ns
}
}
// DeleteContext sets the context
func DeleteContext(ctx context.Context) DeleteOption {
return func(o *DeleteOptions) {
o.Context = ctx
}
}
// LogsOption configures runtime logging
type LogsOption func(o *LogsOptions)
@@ -168,6 +251,10 @@ type LogsOptions struct {
Count int64
// Stream new lines?
Stream bool
// Namespace the service is running in
Namespace string
// Specify the context to use
Context context.Context
}
// LogsExistingCount confiures how many existing lines to show
@@ -183,3 +270,17 @@ func LogsStream(stream bool) LogsOption {
l.Stream = stream
}
}
// LogsNamespace sets the namespace
func LogsNamespace(ns string) LogsOption {
return func(o *LogsOptions) {
o.Namespace = ns
}
}
// LogsContext sets the context
func LogsContext(ctx context.Context) LogsOption {
return func(o *LogsOptions) {
o.Context = ctx
}
}