fix(annotations): parse annotation keys in angular forms [r8s-170] (#233)
parent
94d2e32b49
commit
e1388eff84
|
@ -19,7 +19,8 @@ class KubernetesConfigurationConverter {
|
||||||
res.IsRegistrySecret = secret.IsRegistrySecret;
|
res.IsRegistrySecret = secret.IsRegistrySecret;
|
||||||
res.SecretType = secret.SecretType;
|
res.SecretType = secret.SecretType;
|
||||||
if (secret.Annotations) {
|
if (secret.Annotations) {
|
||||||
res.ServiceAccountName = secret.Annotations['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.Labels = secret.Labels;
|
res.Labels = secret.Labels;
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -109,7 +109,10 @@ class KubernetesSecretConverter {
|
||||||
res.Type = formValues.customType;
|
res.Type = formValues.customType;
|
||||||
}
|
}
|
||||||
if (formValues.Type === KubernetesSecretTypeOptions.SERVICEACCOUNTTOKEN.value) {
|
if (formValues.Type === KubernetesSecretTypeOptions.SERVICEACCOUNTTOKEN.value) {
|
||||||
res.Annotations = [{ name: 'kubernetes.io/service-account.name', value: formValues.ServiceAccountName }];
|
const serviceAccountAnnotation = formValues.Annotations.find((a) => a.key === 'kubernetes.io/service-account.name');
|
||||||
|
if (!serviceAccountAnnotation) {
|
||||||
|
res.Annotations.push({ key: 'kubernetes.io/service-account.name', value: formValues.ServiceAccountName });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ export class KubernetesIngressConverter {
|
||||||
const res = new KubernetesIngress();
|
const res = new KubernetesIngress();
|
||||||
res.Name = formValues.IngressClass.Name;
|
res.Name = formValues.IngressClass.Name;
|
||||||
res.Namespace = formValues.Namespace;
|
res.Namespace = formValues.Namespace;
|
||||||
const pairs = _.map(formValues.Annotations, (a) => [a.Key, a.Value]);
|
const pairs = _.map(formValues.Annotations, (a) => [a.key, a.value]);
|
||||||
res.Annotations = _.fromPairs(pairs);
|
res.Annotations = _.fromPairs(pairs);
|
||||||
res.Annotations[PortainerIngressClassTypes] = formValues.IngressClass.Name;
|
res.Annotations[PortainerIngressClassTypes] = formValues.IngressClass.Name;
|
||||||
res.IngressClassName = formValues.IngressClass.Name;
|
res.IngressClassName = formValues.IngressClass.Name;
|
||||||
|
@ -149,8 +149,8 @@ export class KubernetesIngressConverter {
|
||||||
const annotations = _.map(_.toPairs(ingress.Annotations), ([key, value]) => {
|
const annotations = _.map(_.toPairs(ingress.Annotations), ([key, value]) => {
|
||||||
if (key !== PortainerIngressClassTypes) {
|
if (key !== PortainerIngressClassTypes) {
|
||||||
const annotation = new KubernetesResourcePoolIngressClassAnnotationFormValue();
|
const annotation = new KubernetesResourcePoolIngressClassAnnotationFormValue();
|
||||||
annotation.Key = key;
|
annotation.key = key;
|
||||||
annotation.Value = value;
|
annotation.value = value;
|
||||||
return annotation;
|
return annotation;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue