forked from spinnaker/deck
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request spinnaker#2076 from lwander/kubernetes-probes
provider/kubernetes: Probe dialogs & info being surfaced
- Loading branch information
Showing
8 changed files
with
309 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
app/scripts/modules/kubernetes/container/probe.directive.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<form ng-controller="kubernetesContainerProbeController as probeController" class="container-fluid form-horizontal" name="containers" novalidate> | ||
<div class="form-group"> | ||
<button class="add-new col-md-12" ng-click="probeController.addProbe()" ng-hide="probeController.probe"><span class="glyphicon glyphicon-plus-sign"></span> Enable {{probeController.heading}} Probe</button> | ||
</div> | ||
|
||
<div ng-hide="!probeController.probe"> | ||
<div class="form-group"> | ||
<div class="col-md-3 sm-label-right"> | ||
{{probeController.heading}} Probe | ||
<help-field key="kubernetes.containers.probes.type"></help-field> | ||
</div> | ||
<div class="col-md-4"> | ||
<select class="form-control input-sm" ng-model="probeController.probe.handler.type"> | ||
<option ng-repeat="type in probeController.handlers" value="{{type}}" | ||
ng-selected="probeController.probe.type === type">{{type}}</option> | ||
</select> | ||
</div> | ||
<div class="col-md-1"> | ||
<a class="btn sm-label" ng-click="probeController.deleteProbe()"> | ||
<span class="glyphicon glyphicon-trash"></span> Delete Probe</a> | ||
</div> | ||
</div> | ||
<hr> | ||
<div class="form-group"> | ||
<div class="col-md-3 sm-label-right"> | ||
Initial Delay | ||
<help-field key="kubernetes.containers.probes.initialDelay"></help-field> | ||
</div> | ||
<div class="col-md-2"> | ||
<input type="number" class="form-control input-sm" name="details" ng-model="probeController.probe.initialDelaySeconds" | ||
min="0"/> | ||
</div> | ||
<div class="col-md-4 sm-label-right"> | ||
Success Threshold | ||
<help-field key="kubernetes.containers.probes.successThreshold"></help-field> | ||
</div> | ||
<div class="col-md-2"> | ||
<input type="number" class="form-control input-sm" name="details" ng-model="probeController.probe.successThreshold" ng-disabled="probeController.probetype === 'livenessProbe'" | ||
min="1"/> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<div class="col-md-3 sm-label-right"> | ||
Period | ||
<help-field key="kubernetes.containers.probes.period"></help-field> | ||
</div> | ||
<div class="col-md-2"> | ||
<input type="number" class="form-control input-sm" name="details" ng-model="probeController.probe.periodSeconds" | ||
min="1"/> | ||
</div> | ||
<div class="col-md-4 sm-label-right"> | ||
Failure Threshold | ||
<help-field key="kubernetes.containers.probes.failureThreshold"></help-field> | ||
</div> | ||
<div class="col-md-2"> | ||
<input type="number" class="form-control input-sm" name="details" ng-model="probeController.probe.failureThreshold" | ||
min="1"/> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<div class="col-md-3 sm-label-right"> | ||
Timeout | ||
<help-field key="kubernetes.containers.probes.timeout"></help-field> | ||
</div> | ||
<div class="col-md-2"> | ||
<input type="number" class="form-control input-sm" name="details" ng-model="probeController.probe.timeoutSeconds" | ||
min="1"/> | ||
</div> | ||
</div> | ||
<div ng-hide="probeController.probe.handler.type !== 'EXEC'"> | ||
<div class="form-group"> | ||
<div class="col-md-12"> | ||
<table class="table table-condensed packed tags"> | ||
<b>Commands</b> | ||
<tr ng-repeat="command in probeController.probe.handler.execAction.commands track by $index"> | ||
<td><input class="form-control input-sm" type="text" | ||
ng-model="probeController.probe.handler.execAction.commands[$index]"></td> | ||
<td><a class="btn btn-link sm-label" | ||
ng-click="probeController.removeCommand($index)"><span | ||
class="glyphicon glyphicon-trash"></span></a></td> | ||
</tr> | ||
<tfoot> | ||
<tr> | ||
<td colspan="1"> | ||
<button class="add-new col-md-12" ng-click="probeController.addCommand()"><span | ||
class="glyphicon glyphicon-plus-sign"></span> Add Command | ||
</button> | ||
</td> | ||
</tr> | ||
</tfoot> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
<div ng-hide="probeController.probe.handler.type !== 'TCP'"> | ||
<div class="form-group"> | ||
<div class="col-md-3 sm-label-right"> | ||
Port | ||
</div> | ||
<div class="col-md-2"> | ||
<input type="number" class="form-control input-sm" name="details" ng-model="probeController.probe.handler.tcpSocketAction.port" | ||
min="1" max="probeController.maxPort"/> | ||
</div> | ||
</div> | ||
</div> | ||
<div ng-hide="probeController.probe.handler.type !== 'HTTP'"> | ||
<div class="form-group"> | ||
<div class="col-md-3 sm-label-right"> | ||
Port | ||
</div> | ||
<div class="col-md-2"> | ||
<input type="number" class="form-control input-sm" name="details" ng-model="probeController.probe.handler.httpGetAction.port" | ||
min="1" max="probeController.maxPort"/> | ||
</div> | ||
<div class="col-md-2 sm-label-right"> | ||
Path | ||
</div> | ||
<div class="col-md-4"> | ||
<input type="text" class="form-control input-sm" name="details" ng-model="probeController.probe.handler.httpGetAction.path"/> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<div class="col-md-3 sm-label-right"> | ||
URI Scheme | ||
</div> | ||
<div class="col-md-2"> | ||
<select class="form-control input-sm" ng-model="probeController.probe.handler.httpGetAction.uriScheme"> | ||
<option ng-repeat="scheme in probeController.uriSchemes" value="{{scheme}}" | ||
ng-selected="probeController.probe.handler.httpGetAction.uriScheme === scheme">{{scheme}}</option> | ||
</select> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> |
94 changes: 94 additions & 0 deletions
94
app/scripts/modules/kubernetes/container/probe.directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
'use strict'; | ||
|
||
let angular = require('angular'); | ||
|
||
module.exports = angular.module('spinnaker.kubernetes.container.probe.directive', []) | ||
.directive('kubernetesContainerProbe', function () { | ||
return { | ||
restrict: 'E', | ||
templateUrl: require('./probe.directive.html'), | ||
scope: { | ||
container: '=', | ||
command: '=', | ||
probetype: '=', | ||
heading: '=', | ||
} | ||
}; | ||
}) | ||
.controller('kubernetesContainerProbeController', function($scope) { | ||
this.uriSchemes = ['HTTP', 'HTTPS']; | ||
this.maxPort = 65535; | ||
this.handlers = ['EXEC', 'HTTP', 'TCP']; | ||
|
||
this.heading = $scope.heading; | ||
this.probe = $scope.container[$scope.probetype]; | ||
this.probetype = $scope.probetype; | ||
|
||
function defaultExecAction() { | ||
return { commands: [], }; | ||
} | ||
|
||
function defaultHttpGetAction() { | ||
return { | ||
path: '/', | ||
port: 80, | ||
uriScheme: 'HTTP', | ||
}; | ||
} | ||
|
||
function defaultTcpSocketAction() { | ||
return { port: 80, }; | ||
} | ||
|
||
this.defaultProbe = function() { | ||
return { | ||
initialDelaySeconds: 0, | ||
timeoutSeconds: 1, | ||
periodSeconds: 10, | ||
successThreshold: 1, | ||
failureThreshold: 3, | ||
handler: { | ||
type: this.handlers[1], | ||
execAction: defaultExecAction(), | ||
httpGetAction: defaultHttpGetAction(), | ||
tcpSocketAction: defaultTcpSocketAction(), | ||
}, | ||
}; | ||
}; | ||
|
||
this.addProbe = function() { | ||
$scope.container[$scope.probetype] = this.defaultProbe(); | ||
this.probe = $scope.container[$scope.probetype]; | ||
}; | ||
|
||
this.deleteProbe = function() { | ||
delete $scope.container[$scope.probetype]; | ||
this.probe = null; | ||
}; | ||
|
||
this.removeCommand = function(index) { | ||
this.probe.handler.execAction.commands.splice(index, 1); | ||
}; | ||
|
||
this.addCommand = function() { | ||
this.probe.handler.execAction.commands.push(''); | ||
}; | ||
|
||
this.prepareProbe = function() { | ||
if (this.probe) { | ||
if (!this.probe.handler.execAction) { | ||
this.probe.handler.execAction = defaultExecAction(); | ||
} | ||
|
||
if (!this.probe.handler.httpGetAction) { | ||
this.probe.handler.httpGetAction = defaultHttpGetAction(); | ||
} | ||
|
||
if (!this.probe.handler.tcpSocketAction) { | ||
this.probe.handler.tcpSocketAction = defaultTcpSocketAction(); | ||
} | ||
} | ||
}; | ||
|
||
this.prepareProbe(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.