Skip to content

Commit

Permalink
Make ports public and cleanup examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mtneug committed Nov 21, 2023
1 parent 328bb39 commit 13c94eb
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 56 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/configuration_taskshim_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func init() {

func (c *TaskShimConfiguration) Default() {
if c.Webserver.BindAddress == nil {
c.Webserver.BindAddress = ptr.To[string]("127.0.0.1:8888")
c.Webserver.BindAddress = ptr.To[string](":8888")
}

if c.Webserver.ReadTimeout == nil {
Expand Down
3 changes: 1 addition & 2 deletions api/v1alpha1/configuration_workflowmanagerhelper_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
type WorkflowManagerHelperConfigurationSpec struct {
TaskController WorkflowManagerHelperTaskControllerConfiguration `json:"task"`
ReportsController WorkflowManagerHelperReportsControllerConfiguration `json:"reports"`
NATS NATSConfig `json:"nats"`
}

type WorkflowManagerHelperTaskControllerConfiguration struct {
Expand Down Expand Up @@ -70,7 +69,7 @@ func (c *WorkflowManagerHelperConfiguration) Default() {
}

if c.ReportsController.Webserver.BindAddress == nil {
c.ReportsController.Webserver.BindAddress = ptr.To[string]("127.0.0.1:8181")
c.ReportsController.Webserver.BindAddress = ptr.To[string](":8181")
}

if c.ReportsController.Webserver.ReadTimeout == nil {
Expand Down
1 change: 0 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ USER 65532:65532
COPY <<EOF /config/task-shim.yaml
apiVersion: engine.nagare.media/v1alpha1
kind: TaskShimConfiguration
webserver:
bindAddress: 127.0.0.1:8888
publicBaseURL: http://127.0.0.1:8888
task:
actions:
- name: execute function
Expand Down
3 changes: 0 additions & 3 deletions build/package/image/function-noop/Dockerfile.generic.generic
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ USER 65532:65532
COPY <<EOF /config/task-shim.yaml
apiVersion: engine.nagare.media/v1alpha1
kind: TaskShimConfiguration
webserver:
bindAddress: 127.0.0.1:8888
publicBaseURL: http://127.0.0.1:8888
task:
actions:
- name: execute function
Expand Down
3 changes: 0 additions & 3 deletions build/package/image/function-sleep/Dockerfile.generic.generic
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ USER 65532:65532
COPY <<EOF /config/task-shim.yaml
apiVersion: engine.nagare.media/v1alpha1
kind: TaskShimConfiguration
webserver:
bindAddress: 127.0.0.1:8888
publicBaseURL: http://127.0.0.1:8888
task:
actions:
- name: execute function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ COPY <<EOF /config/workflow-manager-helper.yaml
apiVersion: engine.nagare.media/v1alpha1
kind: WorkflowManagerHelperConfiguration
task:
reports:
webserver:
bindAddress: 127.0.0.1:8181
publicBaseURL: http://127.0.0.1:8181
# assume task is a sidecar
taskAPI: http://127.0.0.1:8888/v2/tasks
EOF

# event API
Expand Down
10 changes: 0 additions & 10 deletions config/samples/nagare-media/task-shim_mmsys-test-encode.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
apiVersion: engine.nagare.media/v1alpha1
kind: TaskShimConfiguration

webserver:
bindAddress: 127.0.0.1:8888
readTimeout: 1m
writeTimeout: ~ # = unlimited
idleTimeout: ~ # = unlimited
network: tcp
publicBaseURL: http://127.0.0.1:8888

task:
actions:
- name: execute function
action: task-shim.engine.nagare.media/exec
config:
command: ./bin/functions-dev-darwin-amd64
args: ["--zap-devel", "--zap-log-level=debug", "--zap-stacktrace-level=error", "mmsys-test-encode", "/tmp/nbmp.tdd"]

onCreate:
- name: write task description document
action: task-shim.engine.nagare.media/file
Expand Down
10 changes: 0 additions & 10 deletions config/samples/nagare-media/task-shim_sleep.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
apiVersion: engine.nagare.media/v1alpha1
kind: TaskShimConfiguration

webserver:
bindAddress: 127.0.0.1:8888
readTimeout: 1m
writeTimeout: ~ # = unlimited
idleTimeout: ~ # = unlimited
network: tcp
publicBaseURL: http://127.0.0.1:8888

task:
actions:
- name: execute function
action: task-shim.engine.nagare.media/exec
config:
command: ./bin/functions-dev-darwin-amd64
args: ["--zap-devel", "--zap-log-level=debug", "--zap-stacktrace-level=error", "sleep", "/tmp/nbmp.tdd"]

onCreate:
- name: write task description document
action: task-shim.engine.nagare.media/file
Expand Down
17 changes: 1 addition & 16 deletions config/samples/nagare-media/workflow-manager-helper-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
apiVersion: engine.nagare.media/v1alpha1
kind: WorkflowManagerHelperConfiguration

nats:
URL: nats://127.0.0.1:4222

reports:
webserver:
bindAddress: 127.0.0.1:8181
readTimeout: 1m
writeTimeout: 1m
idleTimeout: 1m
network: tcp
publicBaseURL: http://127.0.0.1:8181

task:
# assume task is a sidecar
taskAPI: http://127.0.0.1:8888/v2/tasks
requestTimeout: 10s
observePeriode: 2s
maxFailedProbes: 10
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ task:
outputs: []
config:
sleep.engine.nagare.media/duration: 10s

system:
nats:
url: nats://localhost:4222
2 changes: 1 addition & 1 deletion internal/functions/mmsys-test-encode/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func (f *function) execEventAPIServer(ctx context.Context, mediaEventsCh chan<-
l := log.FromContext(ctx)

srv := enginehttp.NewServer(&enginev1.WebserverConfiguration{
BindAddress: ptr.To[string]("127.0.0.1:8080"),
BindAddress: ptr.To[string](":8080"),
ReadTimeout: &metav1.Duration{Duration: 1 * time.Minute},
WriteTimeout: &metav1.Duration{Duration: 1 * time.Minute},
IdleTimeout: &metav1.Duration{Duration: 1 * time.Minute},
Expand Down
2 changes: 1 addition & 1 deletion internal/workflow-manager-helper/reports_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (c *reportsCtrl) Start(ctx context.Context) error {

// connect to NATS
var err error
c.nc, c.js, err = enginenats.CreateJetStreamConn(ctx, string(c.cfg.NATS.URL))
c.nc, c.js, err = enginenats.CreateJetStreamConn(ctx, string(c.data.System.NATS.URL))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/workflow-manager-helper/task_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func (c *taskCtrl) eventEmitterLoop(ctx context.Context) error {
}

// connect to NATS
nc, js, err := enginenats.CreateJetStreamConn(ctx, string(c.cfg.NATS.URL))
nc, js, err := enginenats.CreateJetStreamConn(ctx, string(c.data.System.NATS.URL))
if err != nil {
return err
}
Expand Down

0 comments on commit 13c94eb

Please sign in to comment.