Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -577,3 +577,5 @@ GitExtensions.settings.backup
*.AssemblyHooks.vb
/src/WorkflowManager/mc.exe
*.lutconfig
/src/TaskManager/TaskManager/Properties/launchSettings.json
/src/WorkflowManager/WorkflowManager/Properties/launchSettings.json
7 changes: 6 additions & 1 deletion deploy/helm/Gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ replicaCount: 1
image:
repository: registry.gitlab.com/answerdigital/londonai/aide/workflow-manager-images/infomatics-gateway
pullPolicy: IfNotPresent
tag: 2022-08-01
tag: 2022-08-30-01

imagePullSecrets:
- name: gitlab-image-pull

enviromentVariables:
InformaticsGateway__messaging__publisherSettings__endpoint: "rabbitmq-monai"
Expand All @@ -29,6 +32,8 @@ enviromentVariables:
InformaticsGateway__storage__settings__accessKey: "rootminio"
InformaticsGateway__storage__settings__accessToken: "rootminio"
InformaticsGateway__dicom__scp__rejectUnknownSources: false
Kestrel__EndPoints__Http__Url: "http://::5000"
InformaticsGateway__storage__watermarkPercent: 95


service:
Expand Down
65 changes: 65 additions & 0 deletions deploy/helm/MTM.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright 2022 MONAI Consortium
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

replicaCount: 1

image:
repository: registry.gitlab.com/answerdigital/londonai/aide/workflow-manager-images/task-manager
pullPolicy: IfNotPresent
tag: 2022-09-05-01

imagePullSecrets:
- name: gitlab-image-pull

enviromentVariables:
WorkflowManager__storage__settings__endpoint: "minio.monai:9000"
WorkflowManager__storage__settings__accessKey: "rootminio"
WorkflowManager__storage__settings__accessToken: "rootminio"
WorkflowManager__storage__settings__executableLocation: "mc"
WorkflowManager__messaging__publisherSettings__endpoint: "rabbitmq.monai"
WorkflowManager__messaging__subscriberSettings__endpoint: "rabbitmq.monai"
WorkloadManagerDatabase__ConnectionString: "mongodb://root:rootpassword@mongo-monai.monai:27017"

enviromentVariablesFromSecrets:
secrets:
- name: WorkflowManager__messaging__subscriberSettings__username
secretName: rabbit-secret-master
secretKey: username
- name: WorkflowManager__messaging__subscriberSettings__password
secretName: rabbit-secret-master
secretKey: password
- name: WorkflowManager__messaging__publisherSettings__username
secretName: rabbit-secret-master
secretKey: username
- name: WorkflowManager__messaging__publisherSettings__password
secretName: rabbit-secret-master
secretKey: password

service:
type: ClusterIP
port: 5000

serviceAccount:
create: true
name: mtm
namespace: monai
clusterrole:
name: clusterrole-taskmanager-argo-secret-master
rules:
apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]



5 changes: 3 additions & 2 deletions deploy/helm/MWM.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ enviromentVariables:
WorkflowManager__storage__settings__accessKey: "rootminio"
WorkflowManager__storage__settings__accessToken: "rootminio"
WorkflowManager__storage__settings__executableLocation: "mc"
WorkflowManager__messaging__publisherSettings__endpoint: "rabbitmq.monai"
WorkflowManager__messaging__subscriberSettings__endpoint: "rabbitmq.monai"
WorkflowManager__messaging__publisherSettings__endpoint: "rabbitmq-monai.monai"
WorkflowManager__messaging__subscriberSettings__endpoint: "rabbitmq-monai.monai"
WorkloadManagerDatabase__ConnectionString: "mongodb://root:rootpassword@mongo-monai.monai:27017"
Kestrel__EndPoints__Http__Url: "http://::5000"

enviromentVariablesFromSecrets:
secrets:
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ spec:
value: {{ $value | quote }}
{{- end }}

{{- range .Values.enviromentVariablesFromSecrets.secrets }}
{{- range (.Values.enviromentVariablesFromSecrets).secrets }}
- name: {{ .name }}
valueFrom:
secretKeyRef:
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/templates/volume.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if .Values.volumeMounts -}}
{{- if .Values.volumeMounts }}
apiVersion: v1
kind: PersistentVolume
metadata:
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/templates/volumeclaim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if .Values.volumeMounts -}}
{{- if .Values.volumeMounts }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down
13 changes: 13 additions & 0 deletions src/TaskManager/Plug-ins/Argo/ArgoPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,19 @@ private async Task CopyWorkflowTemplateToWorkflow(WorkflowTemplate workflowTempl

await CopyTemplateSteps(template.Steps, workflowTemplate, name, workflow, cancellationToken).ConfigureAwait(false);
await CopyTemplateDags(template.Dag, workflowTemplate, name, workflow, cancellationToken).ConfigureAwait(false);
CopyImagePullSecrets(workflowTemplate, workflow);
}

private void CopyImagePullSecrets(WorkflowTemplate workflowTemplate, Workflow workflow)
{
if (workflowTemplate.Spec.ImagePullSecrets?.Any() is true)
{
workflow.Spec.ImagePullSecrets = new List<LocalObjectReference>();
foreach (var secret in workflowTemplate.Spec.ImagePullSecrets)
{
workflow.Spec.ImagePullSecrets.Add(secret);
}
}
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/TaskManager/TaskManager/appsettings.Local.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"WorkloadManagerDatabase": {
"ConnectionString": "mongodb://root:rootpassword@localhost:27017",
"ConnectionString": "mongodb://root:rootpassword@localhost:30017",
"DatabaseName": "WorkloadManager",
"WorkflowCollectionName": "Workflows",
"WorkflowInstanceCollectionName": "WorkflowInstances",
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowManager/WorkflowManager/appsettings.Local.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"WorkloadManagerDatabase": {
"ConnectionString": "mongodb://root:rootpassword@localhost:27017",
"ConnectionString": "mongodb://root:rootpassword@localhost:30017",
"DatabaseName": "WorkloadManager",
"WorkflowCollectionName": "Workflows",
"WorkflowInstanceCollectionName": "WorkflowInstances",
Expand Down
41 changes: 41 additions & 0 deletions tests/UnitTests/TaskManager.Argo.Tests/ArgoPluginTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Abstractions;
using System.Linq;
using System.Net.Http;
using System.Threading;
Expand Down Expand Up @@ -586,6 +587,46 @@ public async Task ArgoPlugin_GetStatus_ReturnsExecutionStatusOnFailure()
_argoClient.Verify(p => p.WorkflowService_GetWorkflowAsync(It.Is<string>(p => p.Equals("namespace", StringComparison.OrdinalIgnoreCase)), It.Is<string>(p => p.Equals("identity", StringComparison.OrdinalIgnoreCase)), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()), Times.Once());
}

[Fact(DisplayName = "ImagePullSecrets - get copied accross")]
public async Task ArgoPlugin_Copies_ImagePullSecrets()
{
var argoTemplate = LoadArgoTemplate("SimpleTemplate.yml");

Assert.NotNull(argoTemplate);
var secret = new LocalObjectReference() { Name = "ImagePullSecret" };
argoTemplate.Spec.ImagePullSecrets = new List<LocalObjectReference>() { secret };

var message = GenerateTaskDispatchEventWithValidArguments();
message.TaskPluginArguments["resources"] = "{\"memory_reservation\": \"string\",\"cpu_reservation\": \"string\",\"gpu_limit\": 1,\"memory_limit\": \"string\",\"cpu_limit\": \"string\"}";
message.TaskPluginArguments["priorityClass"] = "Helo";
Workflow? submittedArgoTemplate = null;

_argoClient.Setup(p => p.WorkflowTemplateService_GetWorkflowTemplateAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
.ReturnsAsync(argoTemplate);
_argoClient.Setup(p => p.WorkflowService_CreateWorkflowAsync(It.IsAny<string>(), It.IsAny<WorkflowCreateRequest>(), It.IsAny<CancellationToken>()))
.Callback((string ns, WorkflowCreateRequest body, CancellationToken cancellationToken) =>
{
submittedArgoTemplate = body.Workflow;
})
.ReturnsAsync((string ns, WorkflowCreateRequest body, CancellationToken cancellationToken) =>
{
return new Workflow { Metadata = new ObjectMeta { Name = "workflow" } };
});

SetupKubbernetesSecrets()
.ReturnsAsync((V1Secret body, string ns, string dr, string fm, string fv, bool? pretty, IReadOnlyDictionary<string, IReadOnlyList<string>> headers, CancellationToken ct) =>
{
return new HttpOperationResponse<V1Secret> { Body = body, Response = new HttpResponseMessage { } };
});
SetupKubernetesDeleteSecret();

var runner = new ArgoPlugin(_serviceScopeFactory.Object, _logger.Object, message);
var result = await runner.ExecuteTask(CancellationToken.None).ConfigureAwait(false);

Assert.Equal(TaskExecutionStatus.Accepted, result.Status);
Assert.Equal(secret, submittedArgoTemplate?.Spec.ImagePullSecrets.First());
}

private static TaskDispatchEvent GenerateTaskDispatchEventWithValidArguments()
{
var message = GenerateTaskDispatchEvent();
Expand Down