Skip to content

Commit b160157

Browse files
committed
[OCTRL-1091] new kubernetes_direct and fairmq controlmodes
1 parent c6d5cc9 commit b160157

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

common/controlmode/controlmode.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const (
4141
HOOK
4242
KUBECTL_DIRECT
4343
KUBECTL_FAIRMQ
44+
KUBERNETES_DIRECT
45+
KUBERNETES_FAIRMQ
4446
)
4547

4648
func (cm ControlMode) String() string {
@@ -57,6 +59,10 @@ func (cm ControlMode) String() string {
5759
return "kubectl_direct"
5860
case KUBECTL_FAIRMQ:
5961
return "kubectl_fairmq"
62+
case KUBERNETES_DIRECT:
63+
return "kubernetes_direct"
64+
case KUBERNETES_FAIRMQ:
65+
return "kubernetes_fairmq"
6066
}
6167
return "direct"
6268
}
@@ -81,6 +87,10 @@ func (cm *ControlMode) UnmarshalText(b []byte) error {
8187
*cm = KUBECTL_DIRECT
8288
case "kubectl_fairmq":
8389
*cm = KUBECTL_FAIRMQ
90+
case "kubernetes_direct":
91+
*cm = KUBERNETES_DIRECT
92+
case "kubernetes_fairmq":
93+
*cm = KUBERNETES_FAIRMQ
8494
default:
8595
*cm = DIRECT
8696
}

core/task/task.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ func (t *Task) BuildTaskCommand(role parentRole) (err error) {
288288
class.Control.Mode == controlmode.DIRECT ||
289289
class.Control.Mode == controlmode.FAIRMQ ||
290290
class.Control.Mode == controlmode.KUBECTL_DIRECT ||
291-
class.Control.Mode == controlmode.KUBECTL_FAIRMQ {
291+
class.Control.Mode == controlmode.KUBECTL_FAIRMQ ||
292+
class.Control.Mode == controlmode.KUBERNETES_DIRECT ||
293+
class.Control.Mode == controlmode.KUBERNETES_FAIRMQ {
292294
var varStack map[string]string
293295

294296
// First we get the full varStack from the parent role, and
@@ -396,7 +398,8 @@ func (t *Task) BuildTaskCommand(role parentRole) (err error) {
396398
}
397399

398400
if class.Control.Mode == controlmode.FAIRMQ ||
399-
class.Control.Mode == controlmode.KUBECTL_FAIRMQ {
401+
class.Control.Mode == controlmode.KUBECTL_FAIRMQ ||
402+
class.Control.Mode == controlmode.KUBERNETES_FAIRMQ {
400403
// FIXME read this from configuration
401404
// if the task class doesn't provide an id, we generate one ourselves
402405
if !utils.StringSliceContains(cmd.Arguments, "--id") {
@@ -640,7 +643,9 @@ func (t *Task) BuildPropertyMap(bindMap channel.BindMap) (propMap controlcommand
640643
if class.Control.Mode == controlmode.FAIRMQ ||
641644
class.Control.Mode == controlmode.DIRECT ||
642645
class.Control.Mode == controlmode.KUBECTL_DIRECT ||
643-
class.Control.Mode == controlmode.KUBECTL_FAIRMQ {
646+
class.Control.Mode == controlmode.KUBECTL_FAIRMQ ||
647+
class.Control.Mode == controlmode.KUBERNETES_DIRECT ||
648+
class.Control.Mode == controlmode.KUBERNETES_FAIRMQ {
644649
for _, inbCh := range channel.MergeInbound(parent.CollectInboundChannels(), class.Bind) {
645650
// We get the FairMQ-formatted propertyMap from the inbound channel spec
646651
var chanProps controlcommands.PropertyMap

0 commit comments

Comments
 (0)