Skip to content

Commit

Permalink
feat(provider/kubernetes): Enable annotations, labels and secrets for…
Browse files Browse the repository at this point in the history
… security groups (aka ingress resources) (#2000)
  • Loading branch information
Maarten Dirkse committed Oct 19, 2017
1 parent fb225f1 commit 1d1268c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/scripts/modules/kubernetes/help/kubernetes.help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const helpContents: {[key: string]: string} = {
'kubernetes.ingress.rules.host': 'The fully qualified domain name of a network host. Any traffic routed to this host matches this rule. May not be an IP address, or contain port information.',
'kubernetes.ingress.rules.path': 'POSIX regex (IEE Std 1003.1) matched against the path of an incoming request.',
'kubernetes.ingress.rules.port': 'The port on the specifed load balancer to route traffic to.',
'kubernetes.ingress.rules.secret': '(Optional) The Kubernetes secret that contains the TLS certificate with which to secure connections to the security group. Note that Spinnaker will not create this secret, it will be assumed to exist.',
};

export const KUBERNETES_HELP = 'spinnaker.kubernetes.help.contents';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<form class="container-fluid form-horizontal" name="advancedSettings">
<div class="col-md-12">
<map-editor model="securityGroup.annotations" label="Annotations" add-button-label="Add Annotations" labels-left="true"></map-editor>
</div>
<div class="col-md-12">
<map-editor model="securityGroup.labels" label="Labels" add-button-label="Add Labels" labels-left="true"></map-editor>
</div>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<v2-wizard-page key="rules" label="Rules">
<ng-include src="pages.rules"></ng-include>
</v2-wizard-page>
<v2-wizard-page key="Advanced Settings" label="Advanced Settings">
<ng-include src="pages.advancedSettings"></ng-include>
</v2-wizard-page>
</v2-modal-wizard>
<div class="modal-footer">
<button ng-disabled="taskMonitor.submitting" class="btn btn-default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<v2-wizard-page key="rules" label="Rules">
<ng-include src="pages.rules"></ng-include>
</v2-wizard-page>
<v2-wizard-page key="Advanced Settings" label="Advanced Settings">
<ng-include src="pages.advancedSettings"></ng-include>
</v2-wizard-page>
</v2-modal-wizard>
<div class="modal-footer">
<button ng-disabled="taskMonitor.submitting" class="btn btn-default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
</button>
</div>
</div>
<div class="form-group">
<div class="col-md-3 sm-label-right">
Secret
<help-field key="kubernetes.ingress.rules.secret"></help-field>
</div>
<div class="col-md-6">
<input type="text" class="form-control input-sm" name="details" ng-model="rule.secret"/>
</div>
</div>
<br/>
<div ng-repeat="path in rule.value.http.paths">
<hr ng-if="$index > 0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = angular.module('spinnaker.securityGroup.kubernetes.create.contr
basicSettings: require('./basicSettings.html'),
backend: require('./backend.html'),
rules: require('./rules.html'),
advancedSettings: require('./advancedSettings.html'),
};

$scope.state = {
Expand Down Expand Up @@ -181,6 +182,16 @@ module.exports = angular.module('spinnaker.securityGroup.kubernetes.create.contr
cloudProvider: 'kubernetes',
region: $scope.securityGroup.namespace,
};

// Write TLS property so clouddriver understands it and our certs get configured
$scope.securityGroup.tls = [];
for (var idx in $scope.securityGroup.rules) {
let rule = $scope.securityGroup.rules[idx];
if (typeof rule.secret !== 'undefined' && rule.secret !== '') {
$scope.securityGroup.tls.push({ hosts: [rule.host], secretName: rule.secret });
}
}

return securityGroupWriter.upsertSecurityGroup($scope.securityGroup, application, descriptor, params);
}
);
Expand Down

0 comments on commit 1d1268c

Please sign in to comment.