1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 14:59:41 +02:00

fix issue on editing app with persisted folder (#6646)

Co-authored-by: Richard Wei <dgui.wei@gmail.com>
This commit is contained in:
Richard Wei 2022-04-06 05:42:01 +12:00 committed by GitHub
parent 2059a9e064
commit 7e28b3ca3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 69 deletions

View file

@ -281,6 +281,8 @@ class KubernetesApplicationHelper {
let services = [];
if (app.Services) {
app.Services.forEach(function (service) {
//skip generate formValues if service = headless service ( clusterIp === "None" )
if (service.spec.clusterIP !== 'None') {
const svc = new KubernetesService();
svc.Namespace = service.metadata.namespace;
svc.Name = service.metadata.name;
@ -322,6 +324,7 @@ class KubernetesApplicationHelper {
svc.Ports = ports;
svc.Selector = app.Raw.spec.selector.matchLabels;
services.push(svc);
}
});
return services;

View file

@ -429,10 +429,10 @@ class KubernetesApplicationService {
if (apiService === this.KubernetesStatefulSetService) {
const headlessServicePayload = angular.copy(payload);
headlessServicePayload.Name = application instanceof KubernetesStatefulSet ? application.ServiceName : application.HeadlessServiceName;
await this.KubernetesServiceService.delete(headlessServicePayload);
}
if (application.ServiceType) {
// delete headless service && non-headless service
await this.KubernetesServiceService.delete(application.Services);
if (application.Ingresses.length) {

View file

@ -257,7 +257,7 @@
This application is not exposing any port.
</div>
<div ng-if="ctrl.application.PublishedPorts.length > 0">
<div ng-if="ctrl.application.Services.length !== 0">
<!-- Services notice -->
<div>
<div class="small text-muted">

View file

@ -237,6 +237,8 @@ function getVolumeClaimUpdateResourceSummary(oldPVC, newPVC) {
// getServiceUpdateResourceSummary replicates KubernetesServiceService.patch
function getServiceUpdateResourceSummary(oldServices, newServices) {
let summary = [];
// skip update summary when service is headless service
if (!oldServices.Headless) {
newServices.forEach((newService) => {
const oldServiceMatched = _.find(oldServices, { Name: newService.Name });
if (oldServiceMatched) {
@ -267,7 +269,7 @@ function getServiceUpdateResourceSummary(oldServices, newServices) {
summary.push(serviceDelete);
}
});
}
if (summary.length !== 0) {
return summary;
}