github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/service/runtime/kubernetes/options.go (about) 1 package kubernetes 2 3 import ( 4 "context" 5 6 "github.com/tickoalcantara12/micro/v3/service/runtime" 7 ) 8 9 type runtimeClassNameKey struct{} 10 11 // RuntimeClassName sets the runtimeClassName pods will be started with, e.g. kata-fc 12 func RuntimeClassName(rcn string) runtime.Option { 13 return func(o *runtime.Options) { 14 if o.Context == nil { 15 o.Context = context.WithValue(context.TODO(), runtimeClassNameKey{}, rcn) 16 } else { 17 o.Context = context.WithValue(o.Context, runtimeClassNameKey{}, rcn) 18 } 19 } 20 } 21 22 func getRuntimeClassName(ctx context.Context) string { 23 if ctx == nil { 24 return "" 25 } 26 return ctx.Value(runtimeClassNameKey{}).(string) 27 }