mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 07:19:41 +02:00
fix(apps): use replicas from application spec [r8s-142] (#335)
This commit is contained in:
parent
a259c28678
commit
7f089fab86
3 changed files with 14 additions and 6 deletions
|
@ -19,8 +19,15 @@ class KubernetesConfigurationConverter {
|
||||||
res.IsRegistrySecret = secret.IsRegistrySecret;
|
res.IsRegistrySecret = secret.IsRegistrySecret;
|
||||||
res.SecretType = secret.SecretType;
|
res.SecretType = secret.SecretType;
|
||||||
if (secret.Annotations) {
|
if (secret.Annotations) {
|
||||||
|
const serviceAccountKey = 'kubernetes.io/service-account.name';
|
||||||
|
if (typeof secret.Annotations === 'object') {
|
||||||
|
res.ServiceAccountName = secret.Annotations[serviceAccountKey];
|
||||||
|
} else if (Array.isArray(secret.Annotations)) {
|
||||||
const serviceAccountAnnotation = secret.Annotations.find((a) => a.key === 'kubernetes.io/service-account.name');
|
const serviceAccountAnnotation = secret.Annotations.find((a) => a.key === 'kubernetes.io/service-account.name');
|
||||||
res.ServiceAccountName = serviceAccountAnnotation ? serviceAccountAnnotation.value : undefined;
|
res.ServiceAccountName = serviceAccountAnnotation ? serviceAccountAnnotation.value : undefined;
|
||||||
|
} else {
|
||||||
|
res.ServiceAccountName = undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res.Labels = secret.Labels;
|
res.Labels = secret.Labels;
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -69,11 +69,10 @@ export function getTotalPods(
|
||||||
): number {
|
): number {
|
||||||
switch (application.kind) {
|
switch (application.kind) {
|
||||||
case 'Deployment':
|
case 'Deployment':
|
||||||
return application.status?.replicas ?? 0;
|
case 'StatefulSet':
|
||||||
|
return application.spec?.replicas ?? 0;
|
||||||
case 'DaemonSet':
|
case 'DaemonSet':
|
||||||
return application.status?.desiredNumberScheduled ?? 0;
|
return application.status?.desiredNumberScheduled ?? 0;
|
||||||
case 'StatefulSet':
|
|
||||||
return application.status?.replicas ?? 0;
|
|
||||||
default:
|
default:
|
||||||
throw new Error('Unknown application type');
|
throw new Error('Unknown application type');
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,9 @@ export function VolumesDatatable() {
|
||||||
settingsManager={tableState}
|
settingsManager={tableState}
|
||||||
title="Volumes"
|
title="Volumes"
|
||||||
titleIcon={Database}
|
titleIcon={Database}
|
||||||
getRowId={(row) => row.PersistentVolumeClaim.Name}
|
getRowId={(row) =>
|
||||||
|
`${row.PersistentVolumeClaim.Name}-${row.ResourcePool.Namespace.Name}`
|
||||||
|
}
|
||||||
disableSelect={!hasWriteAuth}
|
disableSelect={!hasWriteAuth}
|
||||||
isRowSelectable={({ original: volume }) =>
|
isRowSelectable={({ original: volume }) =>
|
||||||
!isSystemNamespace(volume.ResourcePool.Namespace.Name, namespaces) &&
|
!isSystemNamespace(volume.ResourcePool.Namespace.Name, namespaces) &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue