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

fix(app): handle no options and volume mounts [EE-5078] (#9075)

* fix(app): handle no options and vol mounts EE-5078

* rm comment

---------

Co-authored-by: testa113 <testa113>
This commit is contained in:
Ali 2023-06-14 16:22:44 +12:00 committed by GitHub
parent 90759182db
commit a4dfeda4ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 8 deletions

View file

@ -30,6 +30,7 @@ import KubernetesPersistentVolumeClaimConverter from 'Kubernetes/converters/pers
import PortainerError from 'Portainer/error';
import { KubernetesIngressHelper } from 'Kubernetes/ingress/helper';
import KubernetesCommonHelper from 'Kubernetes/helpers/commonHelper';
import { KubernetesConfigurationKinds } from 'Kubernetes/models/configuration/models';
function _apiPortsToPublishedPorts(pList, pRefs) {
const ports = _.map(pList, (item) => {
@ -213,6 +214,7 @@ class KubernetesApplicationConverter {
configurationVolume.fileMountPath = matchingVolumeMount.mountPath;
configurationVolume.rootMountPath = matchingVolumeMount.mountPath;
configurationVolume.configurationName = configurationName;
configurationVolume.configurationType = volume.configMap ? KubernetesConfigurationKinds.CONFIGMAP : KubernetesConfigurationKinds.SECRET;
acc.push(configurationVolume);
} else {
@ -222,6 +224,7 @@ class KubernetesApplicationConverter {
configurationVolume.rootMountPath = matchingVolumeMount.mountPath;
configurationVolume.configurationKey = item.key;
configurationVolume.configurationName = configurationName;
configurationVolume.configurationType = volume.configMap ? KubernetesConfigurationKinds.CONFIGMAP : KubernetesConfigurationKinds.SECRET;
acc.push(configurationVolume);
});
@ -294,12 +297,17 @@ class KubernetesApplicationConverter {
res.DataAccessPolicy = app.DataAccessPolicy;
res.EnvironmentVariables = KubernetesApplicationHelper.generateEnvVariablesFromEnv(app.Env);
res.PersistedFolders = KubernetesApplicationHelper.generatePersistedFoldersFormValuesFromPersistedFolders(app.PersistedFolders, persistentVolumeClaims); // generate from PVC and app.PersistedFolders
res.Secrets = KubernetesApplicationHelper.generateConfigurationFormValuesFromEnvAndVolumes(app.Env, app.ConfigurationVolumes, configurations, 'valueFrom.secretKeyRef.name');
res.Secrets = KubernetesApplicationHelper.generateConfigurationFormValuesFromEnvAndVolumes(
app.Env,
app.ConfigurationVolumes,
configurations,
KubernetesConfigurationKinds.SECRET
);
res.ConfigMaps = KubernetesApplicationHelper.generateConfigurationFormValuesFromEnvAndVolumes(
app.Env,
app.ConfigurationVolumes,
configurations,
'valueFrom.configMapKeyRef.name'
KubernetesConfigurationKinds.CONFIGMAP
);
res.AutoScaler = KubernetesApplicationHelper.generateAutoScalerFormValueFromHorizontalPodAutoScaler(app.AutoScaler, res.ReplicaCount);
res.PublishedPorts = KubernetesApplicationHelper.generatePublishedPortsFormValuesFromPublishedPorts(app.ServiceType, app.PublishedPorts, ingresses);