feat: add node init config to k8s plugin
This commit is contained in:
@@ -7,5 +7,5 @@ RUN go mod download
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN go build -v -o /usr/local/bin/agent ./...
|
RUN go build -v -o /usr/local/bin/agent ./...
|
||||||
|
|
||||||
CMD ["app"]
|
CMD ["agent"]
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package nextflow.k8s
|
package nextflow.k8s
|
||||||
|
|
||||||
|
import nextflow.config.scopes.Config
|
||||||
import nextflow.k8s.client.K8sRetryConfig
|
import nextflow.k8s.client.K8sRetryConfig
|
||||||
|
|
||||||
import javax.annotation.Nullable
|
import javax.annotation.Nullable
|
||||||
@@ -211,6 +212,10 @@ class K8sConfig implements ConfigScope {
|
|||||||
""")
|
""")
|
||||||
final String workDir
|
final String workDir
|
||||||
|
|
||||||
|
@ConfigOption
|
||||||
|
@Description("Node initialization config")
|
||||||
|
final K8sNodeInitConfig nodeInit
|
||||||
|
|
||||||
/* required by extension point -- do not remove */
|
/* required by extension point -- do not remove */
|
||||||
K8sConfig() {
|
K8sConfig() {
|
||||||
this(Collections.emptyMap())
|
this(Collections.emptyMap())
|
||||||
@@ -260,6 +265,8 @@ class K8sConfig implements ConfigScope {
|
|||||||
pod.securityContext = new PodSecurityContext(runAsUser)
|
pod.securityContext = new PodSecurityContext(runAsUser)
|
||||||
else if( securityContext )
|
else if( securityContext )
|
||||||
pod.securityContext = new PodSecurityContext(securityContext)
|
pod.securityContext = new PodSecurityContext(securityContext)
|
||||||
|
|
||||||
|
nodeInit = new K8sNodeInitConfig(opts.nodeInit as Map ?: Collections.emptyMap())
|
||||||
}
|
}
|
||||||
|
|
||||||
private PodOptions createPodOptions( value ) {
|
private PodOptions createPodOptions( value ) {
|
||||||
|
|||||||
@@ -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<String> 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<String>
|
||||||
|
wait = opts.wait as String
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -484,4 +484,14 @@ class K8sConfigTest extends Specification {
|
|||||||
cfg.clientRefreshInterval == Duration.of('1h')
|
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'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user