Files
portainer/app/kubernetes/models/application/formValues.js
T
xAt0mZ 7e768a54d5 feat(k8s/resource-pool): storage quotas (#26)
* feat(k8s/resource-pool): add storage quota create/edit

* feat(kubernetes): persistent volume claim size validation on app create/edit

* feat(k8s/volume): quota validation on volume expansion

* fix(k8s/application): remove resource limitation message when then is no resource limitation but volume quota

* style(k8s/application): remove HTML layout debug string

* feat(k8s/resource-pool): remove warning message on storage quota reduction

* fix(k8s/application): available size on storage quota is now properly computed on init

* fix(k8s/application): 'flagged for removal' bindings are not considered free space anymore

* feat(k8s/application): allow users to use existing available volumes when quotas are exhausted

* feat(k8s/resource-pool): storage quota usage bar in edit view

* fix(k8s/resource-pool): create RP enable quota by default

* refactor(k8s): move all volume related units to base 10 instead of base 2 (remive i suffix)

* fix(k8s/application): visual issues caused by latency in computation

* feat(k8s/resource-pool): allow standard users to see storage quota usage

* feat(k8s/volume): show max available size on volume expand

* style(k8s/application): exhausted storage quota message

* fix(k8s/application): remove persisted folders entries when selecting RP with all exhausted storage quotas and no available volumes

* style(k8s/application): file format after rebase

* fix(k8s/application): evaluate quota onInit for app edit

* chore(grunt): add prod watch grunt rule and config

* fix(k8s/application): display 'no storages' message on all restricted quotas

* refactor(k8s/volumes): unify volume parsing

* refactor(app): proper prod watch + enforce parseInt radix
2020-11-04 14:07:21 +13:00

160 lines
4.6 KiB
JavaScript

import { KubernetesApplicationDataAccessPolicies, KubernetesApplicationDeploymentTypes, KubernetesApplicationPublishingTypes, KubernetesApplicationPlacementTypes } from './models';
/**
* KubernetesApplicationFormValues Model
*/
const _KubernetesApplicationFormValues = Object.freeze({
ApplicationType: undefined, // will only exist for formValues generated from Application (app edit situation)
ResourcePool: {},
Name: '',
StackName: '',
ApplicationOwner: '',
Image: '',
Note: '',
MemoryLimit: 0,
CpuLimit: 0,
DeploymentType: KubernetesApplicationDeploymentTypes.REPLICATED,
ReplicaCount: 1,
AutoScaler: {},
Containers: [],
EnvironmentVariables: [], // KubernetesApplicationEnvironmentVariableFormValue list
DataAccessPolicy: KubernetesApplicationDataAccessPolicies.SHARED,
PersistedFolders: [], // KubernetesApplicationPersistedFolderFormValue list
Configurations: [], // KubernetesApplicationConfigurationFormValue list
PublishingType: KubernetesApplicationPublishingTypes.INTERNAL,
PublishedPorts: [], // KubernetesApplicationPublishedPortFormValue list
PlacementType: KubernetesApplicationPlacementTypes.PREFERRED,
Placements: [], // KubernetesApplicationPlacementFormValue list
OriginalIngresses: undefined,
});
export class KubernetesApplicationFormValues {
constructor() {
Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplicationFormValues)));
}
}
export const KubernetesApplicationConfigurationFormValueOverridenKeyTypes = Object.freeze({
ENVIRONMENT: 1,
FILESYSTEM: 2,
});
/**
* KubernetesApplicationConfigurationFormValueOverridenKey Model
*/
const _KubernetesApplicationConfigurationFormValueOverridenKey = Object.freeze({
Key: '',
Path: '',
Type: KubernetesApplicationConfigurationFormValueOverridenKeyTypes.ENVIRONMENT,
});
export class KubernetesApplicationConfigurationFormValueOverridenKey {
constructor() {
Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplicationConfigurationFormValueOverridenKey)));
}
}
/**
* KubernetesApplicationConfigurationFormValue Model
*/
const _KubernetesApplicationConfigurationFormValue = Object.freeze({
SelectedConfiguration: undefined,
Overriden: false,
OverridenKeys: [], // KubernetesApplicationConfigurationFormValueOverridenKey list
});
export class KubernetesApplicationConfigurationFormValue {
constructor() {
Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplicationConfigurationFormValue)));
}
}
/**
* KubernetesApplicationEnvironmentVariableFormValue Model
*/
const _KubernetesApplicationEnvironmentVariableFormValue = Object.freeze({
Name: '',
Value: '',
IsSecret: false,
NeedsDeletion: false,
IsNew: true,
});
export class KubernetesApplicationEnvironmentVariableFormValue {
constructor() {
Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplicationEnvironmentVariableFormValue)));
}
}
/**
* KubernetesApplicationPersistedFolderFormValue Model
*/
const _KubernetesApplicationPersistedFolderFormValue = Object.freeze({
PersistentVolumeClaimName: '', // will be empty for new volumes (create/edit app) and filled for existing ones (edit)
NeedsDeletion: false,
ContainerPath: '',
Size: '',
SizeUnit: 'GB',
StorageClass: {},
ExistingVolume: null,
UseNewVolume: true,
});
export class KubernetesApplicationPersistedFolderFormValue {
constructor(storageClass) {
Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplicationPersistedFolderFormValue)));
this.StorageClass = storageClass;
}
}
/**
* KubernetesApplicationPublishedPortFormValue Model
*/
export function KubernetesApplicationPublishedPortFormValue() {
return {
NeedsDeletion: false,
IsNew: true,
ContainerPort: '',
NodePort: '',
LoadBalancerPort: '',
LoadBalancerNodePort: undefined, // only filled to save existing loadbalancer nodePort and drop it when moving app exposure from LB to Internal/NodePort
Protocol: 'TCP',
IngressName: undefined,
IngressRoute: undefined,
IngressHost: undefined,
};
}
export function KubernetesApplicationPlacementFormValue() {
return {
Label: {},
Value: '',
NeedsDeletion: false,
IsNew: true,
};
}
/**
* KubernetesApplicationAutoScalerFormValue Model
*/
const _KubernetesApplicationAutoScalerFormValue = Object.freeze({
MinReplicas: 0,
MaxReplicas: 0,
TargetCPUUtilization: 50,
ApiVersion: '',
IsUsed: false,
});
export class KubernetesApplicationAutoScalerFormValue {
constructor() {
Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplicationAutoScalerFormValue)));
}
}
export function KubernetesFormValidationReferences() {
return {
refs: {},
hasRefs: false,
};
}