Skip to content

Commit

Permalink
feat(core): show hint if wait for up instances task is not completing (
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeach committed Apr 17, 2017
1 parent 9ae3860 commit 62901fb
Show file tree
Hide file tree
Showing 20 changed files with 100 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ <h3 select-on-dbl-click>
Disabled {{ctrl.disabledDate | timestamp}}
</div>
<div class="content" ng-if="!ctrl.state.loading">
<server-group-running-tasks-details server-group="ctrl.serverGroup"></server-group-running-tasks-details>
<server-group-running-tasks-details server-group="ctrl.serverGroup" application="ctrl.application"></server-group-running-tasks-details>
<collapsible-section heading="Server Group Information" expanded="true">
<dl class="dl-horizontal dl-flex">
<dt>Created</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class AppengineServerGroupDetailsController {
private $scope: IPrivateScope,
private $uibModal: IModalService,
serverGroup: IServerGroupFromStateParams,
private app: Application,
public app: Application,
private serverGroupReader: ServerGroupReader,
private serverGroupWriter: ServerGroupWriter,
private serverGroupWarningMessageService: ServerGroupWarningMessageService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h3 select-on-dbl-click>
class="disabled">
<a href>Destroy</a>
</li>
<li uib-tooltip="It is not possible to clone an App Engine server group's full
<li uib-tooltip="It is not possible to clone an App Engine server group's full
launch configuration. However, clicking this button will allow
you to deploy into this server group's cluster.">
<a href ng-click="ctrl.cloneServerGroup()">Clone</a>
Expand All @@ -83,7 +83,7 @@ <h3 select-on-dbl-click>

<div class="content" ng-if="!ctrl.state.loading">
<div class="band band-info" ng-if="ctrl.serverGroup.isDisabled || ctrl.serverGroup.disabled">Disabled</div>
<server-group-running-tasks-details server-group="ctrl.serverGroup"></server-group-running-tasks-details>
<server-group-running-tasks-details server-group="ctrl.serverGroup" application="ctrl.app"></server-group-running-tasks-details>
<collapsible-section heading="Server Group Information" expanded="true">
<dl class="dl-horizontal dl-flex">
<dt>Created</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ module.exports = angular.module('spinnaker.azure.serverGroup.details.controller'
loading: true
};

this.application = app;

function extractServerGroupSummary() {
var summary = _.find(app.serverGroups.data, function (toCheck) {
return toCheck.name === serverGroup.name && toCheck.account === serverGroup.accountId && toCheck.region === serverGroup.region;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h3 select-on-dbl-click>
<div class="content" ng-if="!state.loading">
<h4 class="text-center" ng-if="serverGroup.isDisabled">[SERVER GROUP IS DISABLED]</h4>

<server-group-running-tasks-details server-group="serverGroup"></server-group-running-tasks-details>
<server-group-running-tasks-details server-group="serverGroup" application="ctrl.application"></server-group-running-tasks-details>

<collapsible-section heading="Server Group Information" expanded="true">
<dl class="dl-horizontal dl-flex">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = angular.module('spinnaker.serverGroup.details.cf.controller', [
cfServerGroupCommandBuilder, serverGroupReader, $uibModal, confirmationModalService, serverGroupWriter,
serverGroupWarningMessageService) {

let application = app;
let application = this.application = app;

$scope.state = {
loading: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h3 select-on-dbl-click>
</div>
<div class="content" ng-if="!state.loading">
<h4 class="text-center" ng-if="serverGroup.isDisabled">[SERVER GROUP IS DISABLED]</h4>
<server-group-running-tasks-details server-group="serverGroup"></server-group-running-tasks-details>
<server-group-running-tasks-details server-group="serverGroup" application="ctrl.application"></server-group-running-tasks-details>
<collapsible-section heading="Server Group Information" expanded="true">
<dl class="dl-horizontal dl-flex">
<dt>Created</dt>
Expand Down
1 change: 1 addition & 0 deletions app/scripts/modules/core/domain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ export * from './instance';
export * from './IStrategy'
export * from './IEntityTags';
export * from './ICluster';
export * from './IOrchestratedItem';
4 changes: 3 additions & 1 deletion app/scripts/modules/core/domain/taskStep.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface TaskStep {
import {ITimedItem} from './IOrchestratedItem';

export interface TaskStep extends ITimedItem {
name: string;
status: string;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import {module} from 'angular';
import {ServerGroup} from 'core/domain/serverGroup';
import {Application} from 'core/application/application.model';

class ServerGroupRunningTasksCtrl implements ng.IComponentController {
public serverGroup: ServerGroup;
public application: Application;
}

class ServerGroupRunningTasksComponent implements ng.IComponentOptions {
public bindings: any = {
serverGroup: '<',
application: '<',
};
public controller: any = ServerGroupRunningTasksCtrl;
public template = `
Expand All @@ -23,6 +26,9 @@ class ServerGroupRunningTasksComponent implements ng.IComponentOptions {
<div class="row" ng-repeat="step in task.steps | displayableTasks">
<div class="col-md-7 col-md-offset-0">
<span class="small"><status-glyph item="step"></status-glyph></span> {{step.name | robotToHuman }}
<platform-health-override-message ng-if="step.name === 'waitForUpInstances'"
step="step" task="task"
application="$ctrl.application"></platform-health-override-message>
</div>
<div class="col-md-4 text-right">
{{step.runningTimeInMs | duration }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import {module, IComponentOptions, IComponentController} from 'angular';
import {get} from 'lodash';
import * as moment from 'moment';

import {Application} from 'core/application/application.model';
import {TaskStep, InstanceCounts, IStage, ITimedItem} from 'core/domain/index';
import {ITask} from './task.read.service';

class PlatformHealthOverrideMessageController implements IComponentController {
public showMessage: boolean;
public messageTemplate = require('./platformHealthOverrideMessage.html');
private application: Application;
private step: TaskStep;
private task: ITask;

public $onInit(): void {
const lastCapacity: InstanceCounts = this.task.getValueFor('lastCapacityCheck');
if (lastCapacity) {
const lastCapacityTotal = lastCapacity.up + lastCapacity.down +
lastCapacity.outOfService + lastCapacity.unknown + lastCapacity.succeeded + lastCapacity.failed;

// Confirm that a). we're stuck on a clone or create task (not, e.g., an enable task)
// and b). the step we're stuck on is within that clone or create task.
const isRelevantTask: boolean = this.task.execution.stages
.some((stage: IStage) => {
return (stage.type === 'cloneServerGroup' || stage.type === 'createServerGroup') &&
stage.tasks.some((task: ITimedItem) => task.startTime === this.step.startTime);
});

this.showMessage = (isRelevantTask &&
this.step.name === 'waitForUpInstances' &&
this.step.runningTimeInMs > moment.duration(5, 'minutes').asMilliseconds() &&
lastCapacity.unknown > 0 &&
lastCapacity.unknown === lastCapacityTotal &&
!get(this.application, 'attributes.platformHealthOnly'));
}
}
}

class PlatformHealthOverrideMessage implements IComponentOptions {
public bindings: any = {
application: '<',
step: '<',
task: '<'
};
public controller = PlatformHealthOverrideMessageController;
public template = `<i ng-if="$ctrl.showMessage"
uib-tooltip-template="::$ctrl.messageTemplate"
class="fa fa-exclamation-circle" style="font-size: smaller;"></i>`;
}

export const PLATFORM_HEALTH_OVERRIDE_MESSAGE = 'spinnaker.core.platformHealthOverrideMessage.component';
module(PLATFORM_HEALTH_OVERRIDE_MESSAGE, []).component('platformHealthOverrideMessage', new PlatformHealthOverrideMessage());
13 changes: 13 additions & 0 deletions app/scripts/modules/core/task/platformHealthOverrideMessage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<p>
Task not completing?
</p>
<p>
By default, Spinnaker does not consider cloud provider health (i.e. whether your instances have launched and are running)
as a reliable indicator of instance health.
</p>
<p>
If your instances do not provide a health indicator known to Spinnaker
(e.g. a discovery service or load balancers), you should configure your application to
consider only cloud provider health when executing tasks. This option is available under Application Attributes
in the <b>Config tab</b>.
</p>
4 changes: 3 additions & 1 deletion app/scripts/modules/core/task/task.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
let angular = require('angular');

import {TASK_STATES} from './task.states';
import {PLATFORM_HEALTH_OVERRIDE_MESSAGE} from './platformHealthOverrideMessage.component';

require('./tasks.less');

Expand All @@ -14,5 +15,6 @@ module.exports = angular
require('./task.write.service.js'),
require('./tasks.controller.js'),
require('./task.dataSource'),
TASK_STATES
TASK_STATES,
PLATFORM_HEALTH_OVERRIDE_MESSAGE,
]);
7 changes: 6 additions & 1 deletion app/scripts/modules/core/task/task.read.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ import {TaskStep} from '../domain/taskStep';
import {IOrchestratedItem} from '../domain/IOrchestratedItem';
import {ORCHESTRATED_ITEM_TRANSFORMER, OrchestratedItemTransformer} from 'core/orchestratedItem/orchestratedItem.transformer';

interface ITaskVariable {
key: string;
value: any;
}

export interface ITask extends IOrchestratedItem {
id: string;
steps?: TaskStep[];
variables: any[];
variables: ITaskVariable[];
endTime: number;
startTime: number;
execution: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h3 select-on-dbl-click>
</div>
<div class="content" ng-if="!ctrl.state.loading">
<h4 class="text-center" ng-if="ctrl.serverGroup.isDisabled">[SERVER GROUP IS DISABLED]</h4>
<server-group-running-tasks-details server-group="ctrl.serverGroup"></server-group-running-tasks-details>
<server-group-running-tasks-details server-group="ctrl.serverGroup" application="ctrl.application"></server-group-running-tasks-details>
<collapsible-section heading="Server Group Information" expanded="true">
<dl class="dl-horizontal dl-flex">
<dt>Created</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = angular.module('spinnaker.serverGroup.details.kubernetes.contro
serverGroupWarningMessageService,
kubernetesServerGroupCommandBuilder, kubernetesServerGroupParamsMixin,
confirmationModalService, kubernetesProxyUiService) {
let application = app;
let application = this.application = app;

$scope.state = {
loading: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h3 select-on-dbl-click>
</div>
<div class="content" ng-if="!state.loading">
<h4 class="text-center" ng-if="serverGroup.isDisabled">[SERVER GROUP IS DISABLED]</h4>
<server-group-running-tasks-details server-group="serverGroup"></server-group-running-tasks-details>
<server-group-running-tasks-details server-group="serverGroup" application="ctrl.application"></server-group-running-tasks-details>
<collapsible-section heading="Server Group Information" expanded="true">
<dl class="dl-horizontal dl-flex">
<dt>Created</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h3 select-on-dbl-click>
Disabled {{ctrl.disabledDate | timestamp}}
</div>
<div class="content" ng-if="!ctrl.state.loading">
<server-group-running-tasks-details server-group="ctrl.serverGroup"></server-group-running-tasks-details>
<server-group-running-tasks-details server-group="ctrl.serverGroup" application="ctrl.application"></server-group-running-tasks-details>
<collapsible-section heading="Server Group Information" expanded="true">
<dl class="dl-horizontal dl-flex">
<dt>Created</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h3 select-on-dbl-click>
Disabled {{ctrl.disabledDate | timestamp}}
</div>
<div class="content" ng-if="!ctrl.state.loading">
<server-group-running-tasks-details server-group="ctrl.serverGroup"></server-group-running-tasks-details>
<server-group-running-tasks-details server-group="ctrl.serverGroup" application="ctrl.application"></server-group-running-tasks-details>
<collapsible-section heading="Server Group Information" expanded="true">
<dl class="dl-horizontal dl-flex">
<dt>Created</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h3 select-on-dbl-click>
</div>
<div class="content" ng-if="!state.loading">
<h4 class="text-center" ng-if="serverGroup.isDisabled">[TITUS JOB IS DISABLED]</h4>
<server-group-running-tasks-details server-group="serverGroup"></server-group-running-tasks-details>
<server-group-running-tasks-details server-group="serverGroup" application="ctrl.application"></server-group-running-tasks-details>
<collapsible-section heading="Titus Job Information" expanded="true">
<dl class="dl-horizontal dl-flex">
<dt>Job Id</dt>
Expand Down

0 comments on commit 62901fb

Please sign in to comment.