mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 00:09:40 +02:00
feat(k8s/application): Support multi-container pods applications (#4208)
* feat(application): Support multi-container pods applications * feat(application): Support multi-container pods applications * fix(application): use only one pod in app details and fix logs and console links * fix(application): show all containers in containers datatable * fix(application): fix order by pod name * feat(k8s/application): minor UI update * feat(k8s/application): minor UI update * feat(k8s/application): minor UI update * feat(k8s/application): minor UI update * feat(k8s/application): minor UI update * fix(application): fix persisted folders in application details Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
parent
fe4a80c7bd
commit
00389a7da9
24 changed files with 358 additions and 141 deletions
|
@ -28,6 +28,43 @@ class KubernetesApplicationHelper {
|
|||
return _.filter(pods, { Labels: app.spec.selector.matchLabels });
|
||||
}
|
||||
|
||||
static associateContainerPersistedFoldersAndConfigurations(app, containers) {
|
||||
_.forEach(containers, (container) => {
|
||||
container.PersistedFolders = _.without(
|
||||
_.map(app.PersistedFolders, (pf) => {
|
||||
if (pf.MountPath && _.includes(_.map(container.VolumeMounts, 'mountPath'), pf.MountPath)) {
|
||||
return pf;
|
||||
}
|
||||
}),
|
||||
undefined
|
||||
);
|
||||
|
||||
container.ConfigurationVolumes = _.without(
|
||||
_.map(app.ConfigurationVolumes, (cv) => {
|
||||
if (cv.rootMountPath && _.includes(_.map(container.VolumeMounts, 'mountPath'), cv.rootMountPath)) {
|
||||
return cv;
|
||||
}
|
||||
}),
|
||||
undefined
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
static associateContainersAndApplication(app) {
|
||||
if (!app.Pods) {
|
||||
return [];
|
||||
}
|
||||
const containers = app.Pods[0].Containers;
|
||||
KubernetesApplicationHelper.associateContainerPersistedFoldersAndConfigurations(app, containers);
|
||||
return containers;
|
||||
}
|
||||
|
||||
static associateAllContainersAndApplication(app) {
|
||||
const containers = _.flatMap(_.map(app.Pods, 'Containers'));
|
||||
KubernetesApplicationHelper.associateContainerPersistedFoldersAndConfigurations(app, containers);
|
||||
return containers;
|
||||
}
|
||||
|
||||
static portMappingsFromApplications(applications) {
|
||||
const res = _.reduce(
|
||||
applications,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue