1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

feat(ingress): remove ingresses from add and edit application EE-4206 (#7677)

This commit is contained in:
Prabhat Khera 2022-09-23 16:11:35 +12:00 committed by GitHub
parent c384d834f5
commit fcb76f570e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 103 deletions

View file

@ -93,8 +93,8 @@ angular.module('portainer.docker').controller('KubernetesApplicationsDatatableCo
// Map all ingress rules in published ports to their respective URLs
const ingressUrls = item.PublishedPorts.flatMap((pp) => pp.IngressRules)
.filter(({ Host, IP }) => Host || IP)
.map(({ Host, IP, Port, Path }) => {
let scheme = Port === 443 ? 'https' : 'http';
.map(({ Host, IP, Path, TLS }) => {
let scheme = TLS && TLS.filter((tls) => tls.hosts && tls.hosts.includes(Host)).length > 0 ? 'https' : 'http';
return `${scheme}://${Host || IP}${Path}`;
});

View file

@ -11,12 +11,7 @@ export default class KubeServicesViewController {
addEntry(service) {
const p = new KubernetesService();
if (service === KubernetesApplicationPublishingTypes.INGRESS) {
p.Type = KubernetesApplicationPublishingTypes.CLUSTER_IP;
p.Ingress = true;
} else {
p.Type = service;
}
p.Type = service;
p.Selector = this.formValues.Selector;
@ -62,8 +57,6 @@ export default class KubeServicesViewController {
return KubernetesServiceTypes.NODE_PORT;
case KubernetesApplicationPublishingTypes.LOAD_BALANCER:
return KubernetesServiceTypes.LOAD_BALANCER;
case KubernetesApplicationPublishingTypes.INGRESS:
return KubernetesServiceTypes.INGRESS;
}
}
@ -79,8 +72,6 @@ export default class KubeServicesViewController {
return 'fa fa-list';
case KubernetesApplicationPublishingTypes.LOAD_BALANCER:
return 'fa fa-project-diagram';
case KubernetesApplicationPublishingTypes.INGRESS:
return 'fa fa-route';
}
}
$onInit() {
@ -98,10 +89,6 @@ export default class KubeServicesViewController {
typeName: KubernetesServiceTypes.LOAD_BALANCER,
typeValue: KubernetesApplicationPublishingTypes.LOAD_BALANCER,
},
{
typeName: KubernetesServiceTypes.INGRESS,
typeValue: KubernetesApplicationPublishingTypes.INGRESS,
},
],
selected: KubernetesApplicationPublishingTypes.CLUSTER_IP,
endpointId: this.EndpointProvider.endpointID(),

View file

@ -1,5 +1,12 @@
<div class="col-sm-12 form-section-title"> Publishing the application </div>
<div class="col-sm-12 !p-0">
<div class="small">
<p class="text-muted vertical-center">
<pr-icon icon="'alert-circle'" mode="'primary'" feather="true"></pr-icon>
<span>Publish your application by creating a ClusterIP service for it, which you may then expose via <a target="_blank" ui-sref="kubernetes.ingresses">an ingress</a>.</span>
</p>
</div>
</div>
<div class="form-group">
<div class="col-sm-12 form-inline">
<div class="col-sm-5" style="padding-left: 0px">
@ -10,7 +17,18 @@
data-cy="k8sAppCreate-publishingModeDropdown"
></select>
<button type="button" class="btn btn-md btn-default vertical-center !ml-0" ng-click="$ctrl.addEntry( $ctrl.state.selected )" data-cy="k8sAppCreate-createServiceButton">
<pr-icon icon="'plus'" size="'sm'" feather="true"></pr-icon> Create service
<span
class="interactive vertical-center"
tooltip-append-to-body="true"
tooltip-placement="top"
tooltip-class="portainer-tooltip"
uib-tooltip="Different service types expose the deployment in alternate ways.
ClusterIP exposes it within the cluster (for internal access only).
NodePort exposes it (on a high port) across all nodes.
LoadBalancer exposes it via an external load balancer."
>
<pr-icon icon="'plus'" size="'sm'" feather="true"></pr-icon> Create service
</span>
</button>
</div>
</div>
@ -71,30 +89,5 @@
<pr-icon icon="'trash-2'" size="'md'" feather="true"></pr-icon> Remove
</button>
</div>
<div ng-if="$ctrl.formValues.Services[$index].Ingress && $ctrl.formValues.OriginalIngresses.length !== 0">
<div class="text-muted">
<i class="fa fa-route" aria-hidden="true" style="margin-right: 2px"></i>
Ingress
</div>
<kube-services-item-view
original-ingresses="$ctrl.formValues.OriginalIngresses"
service-routes="$ctrl.formValues.Services[$index].IngressRoute"
ingress-type="$ctrl.formValues.Services[$index].Ingress"
service-type="$ctrl.formValues.Services[$index].Type"
service-ports="$ctrl.formValues.Services[$index].Ports"
service-name="$ctrl.formValues.Services[$index].Name"
multi-item-disable="true"
></kube-services-item-view>
<button
type="button"
class="btn btn-sm btn-dangerlight space-right vertical-center"
style="margin-left: 0; margin-top: 10px"
ng-click="$ctrl.deleteService( $index )"
data-cy="k8sConfigCreate-removeButton"
>
<pr-icon icon="'trash-2'" size="'md'" feather="true"></pr-icon> Remove
</button>
</div>
</div>
</div>