mirror of
https://github.com/portainer/portainer.git
synced 2025-07-21 06:19:41 +02:00
* fix(k8s/application): transform username to be dns compliant (#4595) * fix(k8s/application): transform username to be dns compliant for configurations and resource pools(#4595) * fix(k8s/application): update regex to replace all special characters (#4595) Co-authored-by: Simon Meng <simon.meng@portainer.io>
16 lines
384 B
JavaScript
16 lines
384 B
JavaScript
import _ from 'lodash-es';
|
|
|
|
class KubernetesCommonHelper {
|
|
static assignOrDeleteIfEmpty(obj, path, value) {
|
|
if (!value || (value instanceof Array && !value.length)) {
|
|
_.unset(obj, path);
|
|
} else {
|
|
_.set(obj, path, value);
|
|
}
|
|
}
|
|
|
|
static ownerToLabel(owner) {
|
|
return _.replace(owner, /[^-A-Za-z0-9_.]/g, '.');
|
|
}
|
|
}
|
|
export default KubernetesCommonHelper;
|