mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
refactor(app): migrate app summary section [EE-6239] (#10910)
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
This commit is contained in:
parent
7a4314032a
commit
abf517de28
61 changed files with 1461 additions and 661 deletions
|
@ -22,7 +22,8 @@ import {
|
|||
KubernetesApplicationVolumeSecretPayload,
|
||||
} from 'Kubernetes/models/application/payloads';
|
||||
import KubernetesVolumeHelper from 'Kubernetes/helpers/volumeHelper';
|
||||
import { KubernetesApplicationDeploymentTypes, KubernetesApplicationTypes, HelmApplication } from 'Kubernetes/models/application/models';
|
||||
import { HelmApplication } from 'Kubernetes/models/application/models';
|
||||
import { KubernetesApplicationDeploymentTypes, KubernetesApplicationTypes } from 'Kubernetes/models/application/models/appConstants';
|
||||
import { KubernetesPodAffinity, KubernetesPodNodeAffinityNodeSelectorRequirementOperators } from 'Kubernetes/pod/models';
|
||||
import {
|
||||
KubernetesNodeSelectorRequirementPayload,
|
||||
|
@ -287,13 +288,6 @@ class KubernetesApplicationHelper {
|
|||
svc.ApplicationOwner = app.ApplicationOwner;
|
||||
svc.ApplicationName = app.ApplicationName;
|
||||
svc.Type = service.spec.type;
|
||||
if (service.spec.type === KubernetesServiceTypes.CLUSTER_IP) {
|
||||
svc.Type = 1;
|
||||
} else if (service.spec.type === KubernetesServiceTypes.NODE_PORT) {
|
||||
svc.Type = 2;
|
||||
} else if (service.spec.type === KubernetesServiceTypes.LOAD_BALANCER) {
|
||||
svc.Type = 3;
|
||||
}
|
||||
|
||||
let ports = [];
|
||||
service.spec.ports.forEach(function (port) {
|
||||
|
@ -373,15 +367,15 @@ class KubernetesApplicationHelper {
|
|||
static generateAutoScalerFormValueFromHorizontalPodAutoScaler(autoScaler, replicasCount) {
|
||||
const res = new KubernetesApplicationAutoScalerFormValue();
|
||||
if (autoScaler) {
|
||||
res.IsUsed = true;
|
||||
res.MinReplicas = autoScaler.MinReplicas;
|
||||
res.MaxReplicas = autoScaler.MaxReplicas;
|
||||
res.TargetCPUUtilization = autoScaler.TargetCPUUtilization;
|
||||
res.ApiVersion = autoScaler.ApiVersion;
|
||||
res.isUsed = true;
|
||||
res.minReplicas = autoScaler.MinReplicas;
|
||||
res.maxReplicas = autoScaler.MaxReplicas;
|
||||
res.targetCpuUtilizationPercentage = autoScaler.TargetCPUUtilization;
|
||||
res.apiVersion = autoScaler.ApiVersion;
|
||||
} else {
|
||||
res.ApiVersion = 'apps/v1';
|
||||
res.MinReplicas = replicasCount;
|
||||
res.MaxReplicas = replicasCount;
|
||||
res.apiVersion = 'apps/v1';
|
||||
res.minReplicas = replicasCount;
|
||||
res.maxReplicas = replicasCount;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -461,7 +455,7 @@ class KubernetesApplicationHelper {
|
|||
}
|
||||
|
||||
static generateAffinityFromPlacements(app, formValues) {
|
||||
if (formValues.DeploymentType === KubernetesApplicationDeploymentTypes.REPLICATED) {
|
||||
if (formValues.DeploymentType === KubernetesApplicationDeploymentTypes.Replicated) {
|
||||
const placements = formValues.Placements;
|
||||
const res = new KubernetesPodNodeAffinityPayload();
|
||||
let expressions = _.map(placements, (p) => {
|
||||
|
@ -545,7 +539,7 @@ class KubernetesApplicationHelper {
|
|||
const helmAppsList = helmAppsEntriesList.map(([helmInstance, applications]) => {
|
||||
const helmApp = new HelmApplication();
|
||||
helmApp.Name = helmInstance;
|
||||
helmApp.ApplicationType = KubernetesApplicationTypes.HELM;
|
||||
helmApp.ApplicationType = KubernetesApplicationTypes.Helm;
|
||||
helmApp.ApplicationOwner = applications[0].ApplicationOwner;
|
||||
helmApp.KubernetesApplications = applications;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import _ from 'lodash-es';
|
||||
import uuidv4 from 'uuid/v4';
|
||||
import { KubernetesApplicationTypes } from 'Kubernetes/models/application/models';
|
||||
import { KubernetesApplicationTypes } from 'Kubernetes/models/application/models/appConstants';
|
||||
|
||||
class KubernetesVolumeHelper {
|
||||
// TODO: review
|
||||
// the following condition
|
||||
// && (app.ApplicationType === KubernetesApplicationTypes.STATEFULSET ? _.includes(volume.PersistentVolumeClaim.Name, app.Name) : true);
|
||||
// && (app.ApplicationType === KubernetesApplicationTypes.StatefulSet ? _.includes(volume.PersistentVolumeClaim.Name, app.Name) : true);
|
||||
// is made to enforce finding the good SFS when multiple SFS in the same namespace
|
||||
// are referencing an internal PVC using the same internal name
|
||||
// (PVC are not exposed to other apps so they can have the same name in differents SFS)
|
||||
|
@ -16,7 +16,7 @@ class KubernetesVolumeHelper {
|
|||
return (
|
||||
volume.ResourcePool.Namespace.Name === app.ResourcePool &&
|
||||
matchingNames.length &&
|
||||
(app.ApplicationType === KubernetesApplicationTypes.STATEFULSET ? _.includes(volume.PersistentVolumeClaim.Name, app.Name) : true)
|
||||
(app.ApplicationType === KubernetesApplicationTypes.StatefulSet ? _.includes(volume.PersistentVolumeClaim.Name, app.Name) : true)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue