mirror of
https://github.com/portainer/portainer.git
synced 2025-08-04 21:35:23 +02:00
Can't create kubernetes resources with a username longer than 63 characters (#4672)
* fix(kubernetes): truncate username when we create resource * fix(k8s): remove forbidden characters in owner label
This commit is contained in:
parent
cbd7fdc62e
commit
4cd468ce21
6 changed files with 13 additions and 6 deletions
|
@ -1,3 +1,4 @@
|
|||
import _ from 'lodash-es';
|
||||
import { KubernetesNamespace } from 'Kubernetes/models/namespace/models';
|
||||
import { KubernetesNamespaceCreatePayload } from 'Kubernetes/models/namespace/payloads';
|
||||
import { KubernetesPortainerResourcePoolNameLabel, KubernetesPortainerResourcePoolOwnerLabel } from 'Kubernetes/models/resource-pool/models';
|
||||
|
@ -20,7 +21,8 @@ class KubernetesNamespaceConverter {
|
|||
res.metadata.name = namespace.Name;
|
||||
res.metadata.labels[KubernetesPortainerResourcePoolNameLabel] = namespace.ResourcePoolName;
|
||||
if (namespace.ResourcePoolOwner) {
|
||||
res.metadata.labels[KubernetesPortainerResourcePoolOwnerLabel] = namespace.ResourcePoolOwner;
|
||||
const resourcePoolOwner = _.truncate(namespace.ResourcePoolOwner, { length: 63, omission: '' });
|
||||
res.metadata.labels[KubernetesPortainerResourcePoolOwnerLabel] = resourcePoolOwner;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue