From 98e0700c0e64218819d63493315c1ab2a8da48e3 Mon Sep 17 00:00:00 2001
From: Ryan Campbell <89273172+bigtallcampbell@users.noreply.github.com>
Date: Tue, 9 Jul 2024 15:57:30 -0500
Subject: [PATCH 1/2] update proto path (#6)
---
src_pluginBase/pluginBase.csproj | 4 ++--
test/integrationTests/integrationTests.csproj | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src_pluginBase/pluginBase.csproj b/src_pluginBase/pluginBase.csproj
index 717a444..e3d10ac 100644
--- a/src_pluginBase/pluginBase.csproj
+++ b/src_pluginBase/pluginBase.csproj
@@ -19,7 +19,7 @@
-
-
+
+
diff --git a/test/integrationTests/integrationTests.csproj b/test/integrationTests/integrationTests.csproj
index 22d908c..e5c71f5 100644
--- a/test/integrationTests/integrationTests.csproj
+++ b/test/integrationTests/integrationTests.csproj
@@ -24,6 +24,6 @@
-
+
From 9fbcf33a1f081630f7b0a9fa8949631a85ebe22c Mon Sep 17 00:00:00 2001
From: Ryan Campbell <89273172+bigtallcampbell@users.noreply.github.com>
Date: Fri, 19 Jul 2024 17:12:35 -0500
Subject: [PATCH 2/2] Update to handle SMB enable/disable and move templating
to helm (#7)
* updating paths
* adding spacefx chart utils
* adding postStart
* adding helm template util
* adding resourceLimits to pods
* adding appSettings and appSettingsMount
* Adding appsettings
* updating for volume templates
* adding persistentvolumes and persistentvolumeclaims
* updating for persistentvolumeclaim
* updating for integration test
* updating to include service account
* updating to reuse persistentvolumeclaim when available
* updating devcontainer to prod feature
---
.devcontainer/devcontainer.json | 21 +-
.devcontainer/postStart.sh | 1 +
.vscode/tasks.json | 3 +-
src/MessageHandlers/MessageHandler.cs | 34 ++
src/Models/AppConfig.cs | 26 +-
src/Models/KubernetesObjects.cs | 73 +++
src/Program.cs | 48 +-
src/Services/DeployRequestProcessor.cs | 4 +-
src/Services/ScheduleProcessor.cs | 6 +
src/Utils/K8sClient.cs | 465 +++---------------
src/Utils/TemplateUtil.cs | 453 +++++++++++++++++
src/appsettings.Development.json | 4 +-
src/appsettings.IntegrationTest.json | 2 +-
src/platform-deployment.csproj | 2 +-
test/debugClient/Services/MessageSender.cs | 9 +-
test/debugClient/debugClient.csproj | 2 +-
test/debugClient/outbox/schedule/busybox.json | 11 +
.../schedule}/busybox.yaml | 2 +-
test/debugClient/sampleSchedules/busybox.json | 21 -
.../integrationTestPlugin.csproj | 2 +-
test/integrationTests/Tests/DeploymentTest.cs | 8 +-
test/sampleSchedules/ServiceAppBuild.docker | 4 +-
test/sampleSchedules/busybox.json | 18 +-
test/sampleSchedules/busybox.yaml | 2 +-
24 files changed, 729 insertions(+), 492 deletions(-)
create mode 100755 .devcontainer/postStart.sh
create mode 100644 src/MessageHandlers/MessageHandler.cs
create mode 100644 src/Models/KubernetesObjects.cs
create mode 100644 src/Utils/TemplateUtil.cs
create mode 100644 test/debugClient/outbox/schedule/busybox.json
rename test/debugClient/{sampleSchedules => outbox/schedule}/busybox.yaml (91%)
delete mode 100644 test/debugClient/sampleSchedules/busybox.json
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 188e4eb..49429c0 100755
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -6,8 +6,8 @@
"runArgs": [
"--name=platform-deployment"
],
- "workspaceFolder": "/workspaces/platform-deployment",
- "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/platform-deployment,type=bind,consistency=cached",
+ "workspaceFolder": "/workspace/platform-deployment",
+ "workspaceMount": "source=${localWorkspaceFolder},target=/workspace/platform-deployment,type=bind,consistency=cached",
"hostRequirements": {
"cpus": 8,
"memory": "8gb"
@@ -17,7 +17,8 @@
"app_name": "platform-deployment",
"app_type": "sdk-service",
"addl_debug_shim_suffixes": "client",
- "debug_shim_post_yaml_file": "/workspaces/platform-deployment/.vscode/debugShim-svcAcct-clusterAdmin.yaml"
+ "debug_shim_post_yaml_file": "/workspace/platform-deployment/.vscode/debugShim-svcAcct-clusterAdmin.yaml",
+ "smb_enabled_in_cluster": "true"
}
},
"customizations": {
@@ -112,10 +113,22 @@
"contents": "read",
"packages": "read"
}
+ },
+ "microsoft/azure-orbital-space-sdk-data-generators": {
+ "permissions": {
+ "contents": "read",
+ "packages": "read"
+ }
}
}
}
},
+ "remoteEnv": {
+ "KUBECONFIG": "/workspace/platform-deployment/.git/spacefx-dev/k3s.devcontainer.yaml"
+ },
+ "containerEnv": {
+ "KUBECONFIG": "/workspace/platform-deployment/.git/spacefx-dev/k3s.devcontainer.yaml"
+ },
"remoteUser": "root",
- "postStartCommand": "regctl image export ghcr.io/dapr/samples/pubsub-csharp-subscriber:1.9.0 --name pubsub-csharp-subscriber > /workspaces/platform-deployment/test/sampleSchedules/pubsub-csharp-subscriber.tar"
+ "postStartCommand": "/workspace/platform-deployment/.devcontainer/postStart.sh"
}
\ No newline at end of file
diff --git a/.devcontainer/postStart.sh b/.devcontainer/postStart.sh
new file mode 100755
index 0000000..374c4cf
--- /dev/null
+++ b/.devcontainer/postStart.sh
@@ -0,0 +1 @@
+regctl image export ghcr.io/dapr/samples/pubsub-csharp-subscriber:1.9.0 --name pubsub-csharp-subscriber > /workspace/platform-deployment/test/sampleSchedules/pubsub-csharp-subscriber.tar
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 9b38904..c6a3d56 100755
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -19,7 +19,8 @@
"args": [
"/spacefx-dev/debugShim-deploy.sh",
"--debug_shim",
- "${DEBUG_SHIM_HOST}"
+ "${DEBUG_SHIM_HOST}",
+ "--disable_plugin_configs"
],
"presentation": {
"echo": true,
diff --git a/src/MessageHandlers/MessageHandler.cs b/src/MessageHandlers/MessageHandler.cs
new file mode 100644
index 0000000..c694289
--- /dev/null
+++ b/src/MessageHandlers/MessageHandler.cs
@@ -0,0 +1,34 @@
+namespace Microsoft.Azure.SpaceFx.PlatformServices.Deployment;
+
+public partial class MessageHandler : Microsoft.Azure.SpaceFx.Core.IMessageHandler where T : notnull {
+ private readonly ILogger> _logger;
+ public static EventHandler? MessageReceivedEvent;
+ private readonly Microsoft.Azure.SpaceFx.Core.Services.PluginLoader _pluginLoader;
+ private readonly IServiceProvider _serviceProvider;
+ private readonly Core.Client _client;
+ private readonly Models.APP_CONFIG _appConfig;
+ private readonly PluginDelegates _pluginDelegates;
+
+ public MessageHandler(ILogger> logger, PluginDelegates pluginDelegates, Microsoft.Azure.SpaceFx.Core.Services.PluginLoader pluginLoader, IServiceProvider serviceProvider, Core.Client client) {
+ _logger = logger;
+ _pluginDelegates = pluginDelegates;
+ _pluginLoader = pluginLoader;
+ _serviceProvider = serviceProvider;
+ _client = client;
+
+ _appConfig = new Models.APP_CONFIG();
+ }
+
+ public void MessageReceived(T message, MessageFormats.Common.DirectToApp fullMessage) => Task.Run(() => {
+ using (var scope = _serviceProvider.CreateScope()) {
+
+ if (message == null || EqualityComparer.Default.Equals(message, default)) {
+ _logger.LogInformation("Received empty message '{messageType}' from '{appId}'. Discarding message.", typeof(T).Name, fullMessage.SourceAppId);
+ return;
+ }
+
+ // This function is just a catch all for any messages that come in. They are not processed and no plugins are triggered for security reasons.
+ // We're catching all messages here to reduce the log warnings for OOTB messages that are flowing
+ }
+ });
+}
\ No newline at end of file
diff --git a/src/Models/AppConfig.cs b/src/Models/AppConfig.cs
index a56ed36..1823dc4 100644
--- a/src/Models/AppConfig.cs
+++ b/src/Models/AppConfig.cs
@@ -1,7 +1,5 @@
-using YamlDotNet.Serialization;
-
namespace Microsoft.Azure.SpaceFx.PlatformServices.Deployment;
-public static class Models {
+public static partial class Models {
public class APP_CONFIG : Core.APP_CONFIG {
[Flags]
[JsonConverter(typeof(JsonStringEnumConverter))]
@@ -48,7 +46,6 @@ public PLUG_IN() {
public string CONTAINER_REGISTRY { get; set; }
public string CONTAINER_REGISTRY_INTERNAL { get; set; }
public string SCHEDULE_IMPORT_DIRECTORY { get; set; }
- public string DAPR_ANNOTATIONS { get; set; }
public string DEFAULT_LIMIT_MEMORY { get; set; }
public string DEFAULT_LIMIT_CPU { get; set; }
public string DEFAULT_REQUEST_MEMORY { get; set; }
@@ -56,14 +53,7 @@ public PLUG_IN() {
public string FILESERVER_APP_CRED_NAME { get; set; }
public string FILESERVER_CRED_NAME { get; set; }
public string FILESERVER_CRED_NAMESPACE { get; set; }
- public string FILESERVER_PERSISTENT_VOLUMES { get; set; }
- public string FILESERVER_PERSISTENT_VOLUMECLAIMS { get; set; }
- public string FILESERVER_CLIENT_VOLUME_MOUNTS { get; set; }
- public string FILESERVER_CLIENT_VOLUMES { get; set; }
- public string PAYLOAD_APP_ANNOTATIONS { get; set; }
- public string PAYLOAD_APP_CONFIG { get; set; }
- public string PAYLOAD_APP_LABELS { get; set; }
- public string PAYLOAD_APP_ENVIRONMENTVARIABLES { get; set; }
+ public bool FILESERVER_SMB_ENABLED { get; set; }
public TimeSpan DEFAULT_MAX_DURATION { get; set; }
public APP_CONFIG() : base() {
@@ -90,19 +80,9 @@ public APP_CONFIG() : base() {
FILESERVER_APP_CRED_NAME = Core.GetConfigSetting("fileserverappcredname").Result;
FILESERVER_CRED_NAME = Core.GetConfigSetting("fileservercredname").Result;
FILESERVER_CRED_NAMESPACE = Core.GetConfigSetting("fileservercrednamespace").Result;
+ FILESERVER_SMB_ENABLED = bool.Parse(Core.GetConfigSetting("fileserversmb").Result);
- FILESERVER_PERSISTENT_VOLUMES = Core.GetConfigSetting("fileserverclientpv").Result;
- FILESERVER_PERSISTENT_VOLUMECLAIMS = Core.GetConfigSetting("fileserverclientpvc").Result;
-
- FILESERVER_CLIENT_VOLUMES = Core.GetConfigSetting("fileServerclientvolumes").Result;
- FILESERVER_CLIENT_VOLUME_MOUNTS = Core.GetConfigSetting("fileServerclientvolumemounts").Result;
-
- DAPR_ANNOTATIONS = Core.GetConfigSetting("daprannotations").Result;
- PAYLOAD_APP_ANNOTATIONS = Core.GetConfigSetting("payloadappannotations").Result;
- PAYLOAD_APP_CONFIG = Core.GetConfigSetting("payloadappconfig").Result;
- PAYLOAD_APP_LABELS = Core.GetConfigSetting("payloadapplabels").Result;
- PAYLOAD_APP_ENVIRONMENTVARIABLES = Core.GetConfigSetting("payloadappenvironmentvariables").Result;
if (Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") == "Development" || Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") == "IntegrationTest") {
ENABLE_YAML_DEBUG = true;
diff --git a/src/Models/KubernetesObjects.cs b/src/Models/KubernetesObjects.cs
new file mode 100644
index 0000000..1f789c9
--- /dev/null
+++ b/src/Models/KubernetesObjects.cs
@@ -0,0 +1,73 @@
+
+using YamlDotNet.Core;
+using YamlDotNet.Core.Events;
+using YamlDotNet.Serialization;
+
+namespace Microsoft.Azure.SpaceFx.PlatformServices.Deployment;
+public static partial class Models {
+ public class KubernetesObjects {
+ public class ResourceDefinition {
+ public ResourceSection Resources { get; set; }
+
+ public ResourceDefinition() {
+ Resources = new ResourceSection();
+ }
+ }
+
+ public class ResourceSection {
+ public ResourceDetails Limits { get; set; }
+ public ResourceDetails Requests { get; set; }
+
+ public ResourceSection() {
+ Limits = new ResourceDetails();
+ Requests = new ResourceDetails();
+ }
+ }
+
+ public class ResourceDetails {
+ public string Cpu { get; set; }
+ public string Memory { get; set; }
+
+ public ResourceDetails() {
+ Cpu = "";
+ Memory = "";
+ }
+ }
+
+ public class VolumeMountRoot {
+ public List VolumeMounts { get; set; }
+ public VolumeMountRoot() {
+ VolumeMounts = new List();
+ }
+ }
+
+ public class VolumeRoot {
+ public List Volumes { get; set; }
+ public VolumeRoot() {
+ Volumes = new List();
+ }
+
+ public class ConfigMapVolumeSource {
+ public string Name { get; set; }
+ public ConfigMapVolumeSource() {
+ Name = "";
+ }
+ }
+
+ public class SecretVolumeSource {
+ public string SecretName { get; set; }
+ public SecretVolumeSource() {
+ SecretName = "";
+ }
+ }
+
+ public class PersistentVolumeClaimVolumeSource {
+ public string ClaimName { get; set; }
+ public PersistentVolumeClaimVolumeSource() {
+ ClaimName = "";
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/Program.cs b/src/Program.cs
index 9eac623..bfa01ac 100644
--- a/src/Program.cs
+++ b/src/Program.cs
@@ -1,35 +1,12 @@
namespace Microsoft.Azure.SpaceFx.PlatformServices.Deployment;
public class Program {
- private static void Test() {
- MessageFormats.PlatformServices.Deployment.DeployRequest _request = new MessageFormats.PlatformServices.Deployment.DeployRequest();
- _request.StartTime = Google.Protobuf.WellKnownTypes.Timestamp.FromDateTime(DateTime.UtcNow);
- _request.MaxDuration = Google.Protobuf.WellKnownTypes.Duration.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 0));
- _request.AppContextFile = new MessageFormats.PlatformServices.Deployment.DeployRequest.Types.AppContextFile() {
- FileName = "test1.jpg",
- Required = false
- };
-
- _request.GpuRequirement = MessageFormats.PlatformServices.Deployment.DeployRequest.Types.GpuOptions.Nvidia;
- _request.DeployAction = MessageFormats.PlatformServices.Deployment.DeployRequest.Types.DeployActions.Create;
-
-
-
-
- Google.Protobuf.JsonFormatter formatter = new Google.Protobuf.JsonFormatter(Google.Protobuf.JsonFormatter.Settings.Default);
- string jsonString = formatter.Format(_request);
-
- Console.WriteLine(jsonString);
- Console.WriteLine("Woohoo!");
-
- }
public static void Main(string[] args) {
- //Test();
var builder = WebApplication.CreateBuilder(args);
- builder.Configuration.AddJsonFile("/workspaces/platform-deployment-config/appsettings.json", optional: true, reloadOnChange: true)
- .AddJsonFile("/workspaces/platform-deployment/src/appsettings.json", optional: true, reloadOnChange: true)
- .AddJsonFile("/workspaces/platform-deployment/src/appsettings.{env:DOTNET_ENVIRONMENT}.json", optional: true, reloadOnChange: true).Build();
+ builder.Configuration.AddJsonFile("/workspace/platform-deployment-config/appsettings.json", optional: true, reloadOnChange: true)
+ .AddJsonFile("/workspace/platform-deployment/src/appsettings.json", optional: true, reloadOnChange: true)
+ .AddJsonFile("/workspace/platform-deployment/src/appsettings.{env:DOTNET_ENVIRONMENT}.json", optional: true, reloadOnChange: true).Build();
builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(50051, o => o.Protocols = HttpProtocols.Http2))
.ConfigureServices((services) => {
@@ -42,8 +19,13 @@ public static void Main(string[] args) {
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
+ services.AddSingleton();
services.AddHostedService(p => p.GetRequiredService());
+ services.AddSingleton, MessageHandler>();
+ services.AddSingleton, MessageHandler>();
+
+
}).ConfigureLogging((logging) => {
logging.AddProvider(new Microsoft.Extensions.Logging.SpaceFX.Logger.HostSvcLoggerProvider());
logging.AddConsole();
@@ -58,6 +40,20 @@ public static void Main(string[] args) {
await context.Response.WriteAsync("Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");
});
});
+
+ // Add a middleware to catch exceptions and stop the host gracefully
+ app.Use(async (context, next) => {
+ try {
+ await next.Invoke();
+ } catch (Exception ex) {
+ Console.Error.WriteLine($"Exception caught in middleware: {ex.Message}");
+
+ // Stop the host gracefully so it triggers the pod to error
+ var lifetime = context.RequestServices.GetService();
+ lifetime?.StopApplication();
+ }
+ });
+
app.Run();
}
}
diff --git a/src/Services/DeployRequestProcessor.cs b/src/Services/DeployRequestProcessor.cs
index eb05e13..4b6002b 100644
--- a/src/Services/DeployRequestProcessor.cs
+++ b/src/Services/DeployRequestProcessor.cs
@@ -16,6 +16,7 @@ public class DeployRequestProcessor : BackgroundService {
private readonly Utils.TimeUtils _timeUtils;
private string _scheduleImportDirectory;
private string _regctlApp;
+
private readonly ConcurrentDictionary _deployRequestCache;
public DeployRequestProcessor(ILogger logger, IServiceProvider serviceProvider, IOptions appConfig, Core.Services.PluginLoader pluginLoader, Core.Client client, PluginDelegates pluginDelegates, Utils.K8sClient k8sClient, Utils.DownlinkUtil downlinkUtil, Utils.TimeUtils timeUtil) {
_logger = logger;
@@ -27,12 +28,14 @@ public DeployRequestProcessor(ILogger logger, IServicePr
_k8sClient = k8sClient;
_downlinkUtil = downlinkUtil;
_timeUtils = timeUtil;
+
_deployRequestCache = new ConcurrentDictionary();
_scheduleImportDirectory = Path.Combine(_client.GetXFerDirectories().Result.inbox_directory, _appConfig.SCHEDULE_IMPORT_DIRECTORY);
_regctlApp = Path.Combine(_client.GetXFerDirectories().Result.root_directory, "tmp", "regctl", "regctl");
+
if (File.Exists(_regctlApp)) {
_logger.LogInformation("regctl found at '{regctlApp}'", _regctlApp);
} else {
@@ -42,7 +45,6 @@ public DeployRequestProcessor(ILogger logger, IServicePr
if (_appConfig.PURGE_SCHEDULE_ON_BOOTUP) {
_client.ClearCache();
- if (Directory.Exists(Path.Combine(_client.GetXFerDirectories().Result.outbox_directory, "deploymentResults"))) Directory.Delete(Path.Combine(_client.GetXFerDirectories().Result.outbox_directory, "deploymentResults"), true);
}
PopulateCacheFromDisk();
diff --git a/src/Services/ScheduleProcessor.cs b/src/Services/ScheduleProcessor.cs
index 7fdbf4a..fb6e32c 100644
--- a/src/Services/ScheduleProcessor.cs
+++ b/src/Services/ScheduleProcessor.cs
@@ -70,6 +70,9 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) {
File.Move(file, file + ".processed");
downlinkFileName = file + ".processed";
+ } catch (FileNotFoundException fileEx) {
+ _logger.LogWarning("Detected a missing file '{file}'. Likely hasn't finished uploaded. Will retry. ", fileEx.FileName);
+ return deployResponses; // This'll be empty
} catch (Utils.NotAScheduleFileException notAScheduleFileEx) {
_logger.LogInformation("Detected a json file that isn't a schedule file. {exceptionMessage}", notAScheduleFileEx.Message);
return deployResponses; // This'll be empty
@@ -238,6 +241,9 @@ private void WaitForFileToFinishCopying(string filePath) {
returnDeployItems.Add(_response);
}
+ } catch (FileNotFoundException fileEx) {
+ _logger.LogError("File '{file}' found. Likely hasnt finished uploading. Will retry.", fileEx.FileName);
+ throw;
} catch (DataException dataEx) {
_logger.LogError("Item #'{itemX}' in '{file}' is invalid. Rejecting entire schedule file. Error: '{error}'. Please re-upload for reprocessing", itemCount, scheduleFilePath, dataEx.Message);
throw;
diff --git a/src/Utils/K8sClient.cs b/src/Utils/K8sClient.cs
index 2d28ea1..75d76f0 100644
--- a/src/Utils/K8sClient.cs
+++ b/src/Utils/K8sClient.cs
@@ -11,23 +11,27 @@ public class K8sClient {
private readonly IServiceProvider _serviceProvider;
private readonly Models.APP_CONFIG _appConfig;
private readonly string _deploymentOutputDir;
- public K8sClient(ILogger logger, IServiceProvider serviceProvider, Core.Client client, IOptions appConfig) {
+ private Utils.TemplateUtil _templateUtil;
+ public K8sClient(ILogger logger, IServiceProvider serviceProvider, Core.Client client, IOptions appConfig, Utils.TemplateUtil templateUtil) {
_logger = logger;
_serviceProvider = serviceProvider;
_client = client;
_appConfig = appConfig.Value;
- KubernetesClientConfiguration config = KubernetesClientConfiguration.BuildDefaultConfig();
- _k8sClient = new Kubernetes(config);
-
+ _templateUtil = templateUtil;
_deploymentOutputDir = Path.Combine(_client.GetXFerDirectories().Result.outbox_directory, "deployments");
- if (_appConfig.PURGE_SCHEDULE_ON_BOOTUP) {
- if (Directory.Exists(Path.Combine(_client.GetXFerDirectories().Result.outbox_directory, "deploymentResults"))) Directory.Delete(Path.Combine(_client.GetXFerDirectories().Result.outbox_directory, "deploymentResults"));
- if (Directory.Exists(_deploymentOutputDir)) Directory.Delete(_deploymentOutputDir, true);
+ if (_appConfig.PURGE_SCHEDULE_ON_BOOTUP && Directory.Exists(_deploymentOutputDir)) {
+ Directory.Delete(_deploymentOutputDir, true);
}
+
Directory.CreateDirectory(_deploymentOutputDir);
+ KubernetesClientConfiguration config = KubernetesClientConfiguration.BuildDefaultConfig();
+ _k8sClient = new Kubernetes(config);
+
+
+
_logger.LogInformation("Services.{serviceName} Initialized.", nameof(K8sClient));
}
@@ -49,7 +53,6 @@ public MessageFormats.PlatformServices.Deployment.DeployResponse DeployItem(Mess
private MessageFormats.PlatformServices.Deployment.DeployResponse DeployToKubernetes(MessageFormats.PlatformServices.Deployment.DeployResponse deploymentItem) {
string tokensizedYamlObject = "";
IKubernetesObject? processed_kubernetesObject;
- int itemX = 0;
_logger.LogInformation("Deployment Started. (AppName: '{AppName}' / DeployAction: '{DeployAction}' / trackingId: '{trackingId}' / correlationId: '{correlationId}')", deploymentItem.DeployRequest.AppName, deploymentItem.DeployRequest.DeployAction, deploymentItem.DeployRequest.RequestHeader.TrackingId, deploymentItem.DeployRequest.RequestHeader.CorrelationId);
// _logger.LogInformation("Passing {requestType} and {responseType} to plugins (trackingId: '{trackingId}' / correlationId: '{correlationId}')", deploymentItem.GetType().Name, returnResponse.GetType().Name, deployRequest.RequestHeader.TrackingId, deployRequest.RequestHeader.CorrelationId);
@@ -86,13 +89,6 @@ private MessageFormats.PlatformServices.Deployment.DeployResponse DeployToKubern
File.WriteAllText(Path.Combine(_deploymentOutputDir, deploymentItem.DeployRequest.RequestHeader.TrackingId + "_orig"), deploymentItem.DeployRequest.YamlFileContents);
}
- // Go and make sure the file server credentials are created
- if ((deploymentItem.DeployRequest.DeployAction == MessageFormats.PlatformServices.Deployment.DeployRequest.Types.DeployActions.Apply) ||
- (deploymentItem.DeployRequest.DeployAction == MessageFormats.PlatformServices.Deployment.DeployRequest.Types.DeployActions.Create)) {
- AddFileServerCredentials(deploymentItem.DeployRequest);
- AddFileServerVolumesAndClaims(deploymentItem.DeployRequest);
- AddConfigurationAsSecrets(deploymentItem.DeployRequest);
- }
if (deploymentItem.DeployRequest.DeployAction == MessageFormats.PlatformServices.Deployment.DeployRequest.Types.DeployActions.RestartDeployment) {
_logger.LogInformation("Restarting deployment '{AppName}' in Namespace '{NameSpace}' (AppName: '{AppName}' / DeployAction: '{DeployAction}' / trackingId: '{trackingId}' / correlationId: '{correlationId}')", deploymentItem.DeployRequest.AppName, deploymentItem.DeployRequest.NameSpace, deploymentItem.DeployRequest.AppName, deploymentItem.DeployRequest.DeployAction, deploymentItem.DeployRequest.RequestHeader.TrackingId, deploymentItem.DeployRequest.RequestHeader.CorrelationId);
@@ -118,67 +114,68 @@ private MessageFormats.PlatformServices.Deployment.DeployResponse DeployToKubern
}
- // Loop through the yaml objects from the string
- foreach (var input_kubernetesObject in (List