Skip to content

Commit

Permalink
feat(provider/kubernetes): Support NFS volumes (#5421)
Browse files Browse the repository at this point in the history
Add support for NFS volume sources.
  • Loading branch information
Xennis authored and lwander committed Jun 5, 2018
1 parent 4ff6040 commit b78976e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/scripts/modules/kubernetes/src/help/kubernetes.help.ts
Expand Up @@ -156,6 +156,8 @@ const helpContents: { [key: string]: string } = {
'Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.',
'kubernetes.pod.volume.awsElasticBlockStore.partition':
'The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).',
'kubernetes.pod.volume.nfs.server': 'NFS (Network File System) server to be mount',
'kubernetes.pod.volume.nfs.path': 'The path in the NFS to mount',
'kubernetes.ingress.backend.port': 'The port for the specified load balancer.',
'kubernetes.ingress.backend.service':
'The load balancer (service) traffic not matching the below rules will be routed to.',
Expand Down
Expand Up @@ -5,7 +5,15 @@ const angular = require('angular');
module.exports = angular
.module('spinnaker.serverGroup.configure.kubernetes.volumes', [])
.controller('kubernetesServerGroupVolumesController', function($scope) {
this.volumeTypes = ['CONFIGMAP', 'EMPTYDIR', 'HOSTPATH', 'PERSISTENTVOLUMECLAIM', 'SECRET', 'AWSELASTICBLOCKSTORE'];
this.volumeTypes = [
'CONFIGMAP',
'EMPTYDIR',
'HOSTPATH',
'PERSISTENTVOLUMECLAIM',
'SECRET',
'AWSELASTICBLOCKSTORE',
'NFS',
];
this.mediumTypes = ['DEFAULT', 'MEMORY'];
this.pathPattern = '^/.*$';
this.relativePathPattern = '^[^/].*';
Expand Down Expand Up @@ -57,6 +65,14 @@ module.exports = angular
};
};

this.defaultNfs = function() {
return {
server: '',
path: '/',
readOnly: false,
};
};

this.addItem = function(sourceIndex) {
$scope.command.volumeSources[sourceIndex].configMap.items.push(this.defaultItem());
};
Expand All @@ -75,6 +91,7 @@ module.exports = angular
secret: this.defaultSecret(),
configMap: this.defaultConfigMap(),
awsElasticBlockStore: this.defaultAwsElasticBlockStore(),
nfs: this.defaultNfs(),
};
};

Expand Down Expand Up @@ -113,6 +130,10 @@ module.exports = angular
source.awsElasticBlockStore = this.defaultAwsElasticBlockStore();
}

if (!source.nfs) {
source.nfs = this.defaultNfs();
}

return source;
});
};
Expand Down
Expand Up @@ -143,6 +143,32 @@
<input type="number" class="form-control input-sm" name="partition" ng-model="source.awsElasticBlockStore.partition"/>
</div>
</div>
<div class="form-group" ng-if="source.type === 'NFS'">
<div class="col-md-3 sm-label-right">
Server
<help-field key="kubernetes.pod.volume.nfs.server"></help-field>
</div>
<div class="col-md-4">
<input type="text" class="form-control input-sm" name="server" ng-model="source.nfs.server"/>
</div>
</div>
<div class="form-group" ng-if="source.type === 'NFS'">
<div class="col-md-3 sm-label-right">
Path
<help-field key="kubernetes.pod.volume.nfs.path"></help-field>
</div>
<div class="col-md-4">
<input type="text" class="form-control input-sm" ng-pattern="volumesController.pathPattern" name="path" ng-model="source.nfs.path"/>
</div>
</div>
<div class="form-group" ng-if="source.type === 'NFS'">
<div class="col-md-3 sm-label-right">
Read Only
</div>
<div class="col-md-2">
<input type="checkbox" name="readOnly" ng-model="source.nfs.readOnly"/>
</div>
</div>
<hr ng-if="command.volumeSources.length > 1">
</div>
<div>
Expand Down

0 comments on commit b78976e

Please sign in to comment.