mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-25 04:11:46 +00:00
Add v1beta3 api call to web ui
Update mocks to v1beta3
This commit is contained in:
0
www/master/shared/assets/.gitkeep
Normal file
0
www/master/shared/assets/.gitkeep
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"k8sApiServer": "/api/v1beta2",
|
||||
"k8sApiv1beta3Server": "/api/v1beta3",
|
||||
"k8sDataServer": "/cluster",
|
||||
"k8sDataPollMinIntervalSec": 10,
|
||||
"k8sDataPollMaxIntervalSec": 120,
|
||||
|
@@ -3,6 +3,7 @@ angular.module("kubernetesApp.config", [])
|
||||
.constant("ENV", {
|
||||
"/": {
|
||||
"k8sApiServer": "/api/v1beta2",
|
||||
"k8sApiv1beta3Server": "/api/v1beta3",
|
||||
"k8sDataServer": "/cluster",
|
||||
"k8sDataPollMinIntervalSec": 10,
|
||||
"k8sDataPollMaxIntervalSec": 120,
|
||||
|
@@ -5,7 +5,7 @@
|
||||
.service('cAdvisorService', function($http, $q, ENV) {
|
||||
var _baseUrl = function(minionIp) {
|
||||
var minionPort = ENV['/']['cAdvisorPort'] || "8081";
|
||||
var proxy = ENV['/']['cAdvisorProxy'] || "/api/v1beta2/proxy/nodes/";
|
||||
var proxy = ENV['/']['cAdvisorProxy'] || "/api/v1beta3/proxy/nodes/";
|
||||
|
||||
return proxy + minionIp + ':' + minionPort + '/api/v1.0/';
|
||||
};
|
||||
|
@@ -40,3 +40,51 @@ app.provider('k8sApi',
|
||||
k8sApiProvider.setUrlBase(proxy + ENV['/']['k8sApiServer']);
|
||||
}
|
||||
});
|
||||
|
||||
app.provider('k8sv1Beta3Api',
|
||||
function() {
|
||||
|
||||
var urlBase = '';
|
||||
var _namespace = 'default';
|
||||
|
||||
this.setUrlBase = function(value) { urlBase = value; };
|
||||
|
||||
this.setNamespace = function(value) { _namespace = value; };
|
||||
this.getNamespace = function() { return _namespace; };
|
||||
|
||||
var _get = function($http, baseUrl, query) {
|
||||
var _fullUrl = baseUrl;
|
||||
|
||||
if (query !== undefined) {
|
||||
_fullUrl += '/' + query;
|
||||
}
|
||||
|
||||
return $http.get(_fullUrl);
|
||||
};
|
||||
|
||||
this.$get = function($http, $q) {
|
||||
var api = {};
|
||||
|
||||
api.getUrlBase = function() { return urlBase + '/namespaces/' + _namespace; };
|
||||
|
||||
api.getPods = function(query) { return _get($http, api.getUrlBase() + '/pods', query); };
|
||||
|
||||
api.getMinions = function(query) { return _get($http, urlBase + '/nodes', query); };
|
||||
|
||||
api.getServices = function(query) { return _get($http, api.getUrlBase() + '/services', query); };
|
||||
|
||||
api.getReplicationControllers = function(query) {
|
||||
return _get($http, api.getUrlBase() + '/replicationcontrollers', query)
|
||||
};
|
||||
|
||||
api.getEvents = function(query) { return _get($http, api.getUrlBase() + '/events', query); };
|
||||
|
||||
return api;
|
||||
};
|
||||
})
|
||||
.config(function(k8sv1Beta3ApiProvider, ENV) {
|
||||
if (ENV && ENV['/'] && ENV['/']['k8sApiv1beta3Server']) {
|
||||
var proxy = ENV['/']['cAdvisorProxy'] || '';
|
||||
k8sv1Beta3ApiProvider.setUrlBase(proxy + ENV['/']['k8sApiv1beta3Server']);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user