fix(k8s): add tag ids to request payload for creating local k8s endpoint. EE-1454 (#5577)

* fix(k8s): add tag ids to request payload for creating local k8s endpoint.

* add https to k8s local environment url
pull/5310/head
fhanportainer 2021-09-06 13:46:14 +12:00 committed by GitHub
parent 4ffee27a4b
commit f16fdd3ea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -137,10 +137,10 @@ angular.module('portainer.app').factory('EndpointService', [
return deferred.promise;
};
service.createLocalKubernetesEndpoint = function (name = 'local') {
service.createLocalKubernetesEndpoint = function (name = 'local', tagIds = []) {
var deferred = $q.defer();
FileUploadService.createEndpoint(name, PortainerEndpointCreationTypes.LocalKubernetesEnvironment, '', '', 1, [], true, true, true)
FileUploadService.createEndpoint(name, PortainerEndpointCreationTypes.LocalKubernetesEnvironment, '', '', 1, tagIds, true, true, true)
.then(function success(response) {
deferred.resolve(response.data);
})

View File

@ -154,8 +154,9 @@ angular
$scope.addKubernetesEndpoint = function () {
var name = $scope.formValues.Name;
var tagIds = $scope.formValues.TagIds;
$scope.state.actionInProgress = true;
EndpointService.createLocalKubernetesEndpoint(name)
EndpointService.createLocalKubernetesEndpoint(name, tagIds)
.then(function success(result) {
Notifications.success('Endpoint created', name);
$state.go('portainer.endpoints.endpoint.kubernetesConfig', { id: result.Id });

View File

@ -168,10 +168,14 @@ function EndpointController(
payload.URL = 'tcp://' + endpoint.URL;
}
if (endpoint.Type === PortainerEndpointTypes.AgentOnKubernetesEnvironment || endpoint.Type === PortainerEndpointTypes.KubernetesLocalEnvironment) {
if (endpoint.Type === PortainerEndpointTypes.AgentOnKubernetesEnvironment) {
payload.URL = endpoint.URL;
}
if (endpoint.Type === PortainerEndpointTypes.KubernetesLocalEnvironment) {
payload.URL = 'https://' + endpoint.URL;
}
$scope.state.actionInProgress = true;
EndpointService.updateEndpoint(endpoint.Id, payload).then(
function success() {