Skip to content
This repository has been archived by the owner on Oct 21, 2019. It is now read-only.

Allow service installations to be disabled #12

Merged
merged 35 commits into from
Oct 11, 2016

Conversation

duncanhall
Copy link
Contributor

This feature allows the future installation of services to be disabled, without affecting any current infrastructure.

selection_016

From the Servers > ASG > Services view, individual services can be toggled between enabled or disabled. This sets a Status value in the key/value store for that particular combination of environment, server role, service, version and slice.

To complete this feature, updates need to be made to https://github.com/trainline/consul-deployment-agent that check the Status value of a service when any new infrastructure is created, and ignore installs for disabled services. Until this is done, the above work is behind a feature flag (FEATURE_DISABLE_SERVICE) that disables the feature by default.

To test this feature locally you can run:

FEATURE_DISABLE_SERVICE=true npm start

`TODO:` We really ought to stop automatically requiring these files
Copy link
Contributor

@filso filso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good, interface looks very nice!

serverRole: role
};

$http.post(url, data)
Copy link
Contributor

@filso filso Oct 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not chain the promise? deferred doesn't seem necessary here

angular.module('EnvironmentManager.common').factory('targetStateService', function($rootScope, $q, $http) {

return {
changeDeploymentStatus: function(enable, service, role, environment) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary to change, but usually with setters / updaters / changers first you would specify target of action, and value (enable) would come last

@@ -21,8 +21,6 @@ angular.module('EnvironmentManager.environments').controller('DeployModalControl
};

function init() {
console.log('Initialising Deploy Controller for ' + parameters.Environment.EnvironmentName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -8,7 +8,7 @@ angular.module('EnvironmentManager.environments').component('asgInstances', {
asgState: '<',
},
controllerAs: 'vm',
controller: function (awsService, $q, $uibModal) {
controller: function ($uibModal) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

return {
Status: Enums.HEALTH_STATUS.Error,
Name: checks[0].Name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

let servicesList = yield serviceReporter.getServicesList(environmentName, runtimeServerRoleName);
function getServiceOverallHealth(healthChecks) {
return {
Status:_.some(healthChecks, { Status: HEALTH_BAD }) ? HEALTH_BAD : HEALTH_GOOD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 , just formatting. We'll have also third state, WARNING, in which case logic will be more complex


let serviceHealthChecks = getServiceChecksInfo(serviceObjects)
let serviceHealthChecks = getServiceChecksInfo(serviceObjects);
let Status = service.hasOwnProperty('Status') ? service.Status : 'Enabled';
Copy link
Contributor

@filso filso Oct 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if that's the best name for enabled / disabled service, status could also point at AWS instance status, might be confusing, especially if we add this to instance

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest something more explicit such as (in the spirit of Powershell DSC) Ensure: 'Absent'|'Present'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely open to changing this (particularly if the CDA team has other suggestions / requirements), but remember this is completely separate from AWS and instances, and doesn't ensure absence or presence of a service.

This flag is designed only to stop future installations of a service. Any services that are currently installed will be completely left alone, regardless of a change to the Status value (hence Ensure: 'Absent' would be misleading).

In our Consul key/value store currently, services at this level look like:

{
  Name: "ServiceName",
  Version: "ServiceVersion",
  Slice: "blue|green|none",
  DeploymentId: "guid"
}

This new property gets added to the object above. Perhaps InstallationStatus: Enabled | Disabled might be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action: Ignore

Copy link
Contributor

@filso filso Oct 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InstallationStatus sounds good! indicates it's about (further) installation
NewInstallations seems good, too, even more explicit (though soudns funny)

@duncanhall duncanhall merged commit e4de892 into develop Oct 11, 2016
@duncanhall duncanhall deleted the feature/disable-service-installation branch October 11, 2016 16:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants