diff --git a/agent/Dockerfile b/agent/Dockerfile index fa276c4..b1482d5 100644 --- a/agent/Dockerfile +++ b/agent/Dockerfile @@ -7,5 +7,5 @@ RUN go mod download COPY . . RUN go build -v -o /usr/local/bin/agent ./... -CMD ["app"] +CMD ["agent"] diff --git a/nextflow/plugins/nf-k8s/src/main/nextflow/k8s/K8sConfig.groovy b/nextflow/plugins/nf-k8s/src/main/nextflow/k8s/K8sConfig.groovy index 0761b37..9cfa544 100644 --- a/nextflow/plugins/nf-k8s/src/main/nextflow/k8s/K8sConfig.groovy +++ b/nextflow/plugins/nf-k8s/src/main/nextflow/k8s/K8sConfig.groovy @@ -16,6 +16,7 @@ package nextflow.k8s +import nextflow.config.scopes.Config import nextflow.k8s.client.K8sRetryConfig import javax.annotation.Nullable @@ -211,6 +212,10 @@ class K8sConfig implements ConfigScope { """) final String workDir + @ConfigOption + @Description("Node initialization config") + final K8sNodeInitConfig nodeInit + /* required by extension point -- do not remove */ K8sConfig() { this(Collections.emptyMap()) @@ -260,6 +265,8 @@ class K8sConfig implements ConfigScope { pod.securityContext = new PodSecurityContext(runAsUser) else if( securityContext ) pod.securityContext = new PodSecurityContext(securityContext) + + nodeInit = new K8sNodeInitConfig(opts.nodeInit as Map ?: Collections.emptyMap()) } private PodOptions createPodOptions( value ) { diff --git a/nextflow/plugins/nf-k8s/src/main/nextflow/k8s/K8sNodeInitConfig.groovy b/nextflow/plugins/nf-k8s/src/main/nextflow/k8s/K8sNodeInitConfig.groovy new file mode 100644 index 0000000..69a9840 --- /dev/null +++ b/nextflow/plugins/nf-k8s/src/main/nextflow/k8s/K8sNodeInitConfig.groovy @@ -0,0 +1,42 @@ +package nextflow.k8s + +import groovy.util.logging.Slf4j +import nextflow.config.scopes.Config +import nextflow.config.spec.ConfigScope +import nextflow.config.spec.ScopeName +import nextflow.config.spec.ConfigOption +import groovy.transform.CompileStatic +import nextflow.script.dsl.Description + +@CompileStatic +@Slf4j +@ScopeName("nodeInit") +@Description("The nodeInit scope contains options for the pre-workflow execution initialization of nodes") +class K8sNodeInitConfig implements ConfigScope { + @ConfigOption + @Description("enables the pre-workflow execution deployment of pods") + final boolean enabled; + + @ConfigOption + @Description("the used image") + final String image; + + @ConfigOption + @Description("the start-command") + final List command; + + @ConfigOption + @Description("the pod state to wait on") + final String wait; + + K8sNodeInitConfig() { + this(Collections.emptyMap()) + } + + K8sNodeInitConfig(Map opts) { + enabled = opts.enabled as boolean + image = opts.image as String + command = opts.command as List + wait = opts.wait as String + } +} diff --git a/nextflow/plugins/nf-k8s/src/test/nextflow/k8s/K8sConfigTest.groovy b/nextflow/plugins/nf-k8s/src/test/nextflow/k8s/K8sConfigTest.groovy index f1eb2e2..48b2edd 100644 --- a/nextflow/plugins/nf-k8s/src/test/nextflow/k8s/K8sConfigTest.groovy +++ b/nextflow/plugins/nf-k8s/src/test/nextflow/k8s/K8sConfigTest.groovy @@ -484,4 +484,14 @@ class K8sConfigTest extends Specification { cfg.clientRefreshInterval == Duration.of('1h') } + def 'should have nodeInit image' () { + when: + def cfg = new K8sConfig( + nodeInit: [ + image: 'some-image:0' + ] + ) + then: + cfg.nodeInit.image == 'some-image:0' + } }