private async Task Deploy(IRabbitDeploymentManagerConfiguration config, bool abortOnFailure = false)
        {
            // Check if statefulset is already deployed
            await _logHandler.WriteCmd($"{nameof(RabbitDeploymentManager)}.{nameof(Deploy)}", verboseLogging);
            await _logHandler.WriteLine("Validating statefulset is running...", verboseLogging);
            var rabbitStatefulSetIsRunning = _kubectlHelper.ValidateStatefulsetIsRunning(RABBIT_MQ_STATEFULSET);
            
            if (rabbitStatefulSetIsRunning)
            {
                await _logHandler.WriteLine($"Rabbit Statefulset is running -->", verboseLogging);
                await ValidateRabbitMQDeployment(config);
            }
            else
            {
                if (abortOnFailure)
                {
                    await _logHandler.WriteLine("Failed to install rabbitMQ infrastructure", verboseLogging);
                    await Cleanup();
                    await _logHandler.WriteLine($"CleanUp Complete --> config.FailureCallback()", verboseLogging);
                    await config.FailureCallback(config.TaskId, _logHandler);
                    return;
                }

                await InstallHelmAndRabbitMQ(config);
                // Once helm has installed and rabbitMQ has been provisioned to the cluster by helm retry the init call
                // else abort the process...
                await Deploy(config, true);
            }
        }
示例#2
0
        public async Task DeployModule(IModuleManagerConfig config)
        {
            _logHandler.AttachTaskIdAndUpdateHandler(config.TaskId, config.UpdateCallback);

            await _logHandler.WriteCmd($"{nameof(ModuleManager)}.{nameof(DeployModule)}", verboseLogging);

            var response = await _kubectlHelper.InstallModule(KubectlHelper.CreateModuleDeployment(
                                                                  config.ImageName,
                                                                  config.ModuleName,
                                                                  config.ModuleReplicas), config.LoadBalancerConfig);

            if (response.IsSuccessful)
            {
                await config.SuccessCallback(config.TaskId, _logHandler);
            }
            else
            {
                await _logHandler.WriteLine(response.Message);

                await config.FailureCallback(config.TaskId, _logHandler);
            }
        }