mirror of https://github.com/portainer/portainer
Fix/release commits cherrypick (#5546)
* fix EE-1078 Too strict form validation for docker environment variables (#5278) Co-authored-by: Simon Meng <simon.meng@portainer.io> * fix(ingress): EE-1049 Ingress config is lost when deleting an application deployed with ingress (#5264) Co-authored-by: Simon Meng <simon.meng@portainer.io> * feat(app/k8s): update ingress scheme from v1beta1 to v1 (#5466) Co-authored-by: cong meng <mcpacino@gmail.com> Co-authored-by: Simon Meng <simon.meng@portainer.io> Co-authored-by: LP B <xAt0mZ@users.noreply.github.com>pull/5457/head
parent
b4f4ef701a
commit
7e211ef384
|
@ -19,10 +19,10 @@ export class KubernetesIngressConverter {
|
||||||
: _.map(rule.http.paths, (path) => {
|
: _.map(rule.http.paths, (path) => {
|
||||||
const ingRule = new KubernetesIngressRule();
|
const ingRule = new KubernetesIngressRule();
|
||||||
ingRule.IngressName = data.metadata.name;
|
ingRule.IngressName = data.metadata.name;
|
||||||
ingRule.ServiceName = path.backend.serviceName;
|
ingRule.ServiceName = path.backend.service.name;
|
||||||
ingRule.Host = rule.host || '';
|
ingRule.Host = rule.host || '';
|
||||||
ingRule.IP = data.status.loadBalancer.ingress ? data.status.loadBalancer.ingress[0].ip : undefined;
|
ingRule.IP = data.status.loadBalancer.ingress ? data.status.loadBalancer.ingress[0].ip : undefined;
|
||||||
ingRule.Port = path.backend.servicePort;
|
ingRule.Port = path.backend.service.port.number;
|
||||||
ingRule.Path = path.path;
|
ingRule.Path = path.path;
|
||||||
return ingRule;
|
return ingRule;
|
||||||
});
|
});
|
||||||
|
@ -151,8 +151,8 @@ export class KubernetesIngressConverter {
|
||||||
rule.http.paths = _.map(paths, (p) => {
|
rule.http.paths = _.map(paths, (p) => {
|
||||||
const path = new KubernetesIngressRulePathCreatePayload();
|
const path = new KubernetesIngressRulePathCreatePayload();
|
||||||
path.path = p.Path;
|
path.path = p.Path;
|
||||||
path.backend.serviceName = p.ServiceName;
|
path.backend.service.name = p.ServiceName;
|
||||||
path.backend.servicePort = p.Port;
|
path.backend.service.port.number = p.Port;
|
||||||
return path;
|
return path;
|
||||||
});
|
});
|
||||||
hostsWithRules.push(host);
|
hostsWithRules.push(host);
|
||||||
|
@ -173,7 +173,7 @@ export class KubernetesIngressConverter {
|
||||||
res.spec.rules = [];
|
res.spec.rules = [];
|
||||||
_.forEach(data.Hosts, (host) => {
|
_.forEach(data.Hosts, (host) => {
|
||||||
if (!host.NeedsDeletion) {
|
if (!host.NeedsDeletion) {
|
||||||
res.spec.rules.push({ host: host.Host });
|
res.spec.rules.push({ host: host.Host || host });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -20,10 +20,15 @@ export function KubernetesIngressRuleCreatePayload() {
|
||||||
|
|
||||||
export function KubernetesIngressRulePathCreatePayload() {
|
export function KubernetesIngressRulePathCreatePayload() {
|
||||||
return {
|
return {
|
||||||
backend: {
|
|
||||||
serviceName: '',
|
|
||||||
servicePort: 0,
|
|
||||||
},
|
|
||||||
path: '',
|
path: '',
|
||||||
|
pathType: 'ImplementationSpecific',
|
||||||
|
backend: {
|
||||||
|
service: {
|
||||||
|
name: '',
|
||||||
|
port: {
|
||||||
|
number: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ angular.module('portainer.kubernetes').factory('KubernetesIngresses', factory);
|
||||||
function factory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
function factory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||||
'use strict';
|
'use strict';
|
||||||
return function (namespace) {
|
return function (namespace) {
|
||||||
const url = `${API_ENDPOINT_ENDPOINTS}/:endpointId/kubernetes/apis/networking.k8s.io/v1beta1${namespace ? '/namespaces/:namespace' : ''}/ingresses/:id/:action`;
|
const url = `${API_ENDPOINT_ENDPOINTS}/:endpointId/kubernetes/apis/networking.k8s.io/v1${namespace ? '/namespaces/:namespace' : ''}/ingresses/:id/:action`;
|
||||||
return $resource(
|
return $resource(
|
||||||
url,
|
url,
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,4 @@
|
||||||
import { KEY_REGEX, VALUE_REGEX } from '@/portainer/helpers/env-vars';
|
|
||||||
|
|
||||||
class EnvironmentVariablesSimpleModeItemController {
|
class EnvironmentVariablesSimpleModeItemController {
|
||||||
/* @ngInject */
|
|
||||||
constructor() {
|
|
||||||
this.KEY_REGEX = KEY_REGEX;
|
|
||||||
this.VALUE_REGEX = VALUE_REGEX;
|
|
||||||
}
|
|
||||||
|
|
||||||
onChangeName(name) {
|
onChangeName(name) {
|
||||||
const fieldIsInvalid = typeof name === 'undefined';
|
const fieldIsInvalid = typeof name === 'undefined';
|
||||||
if (fieldIsInvalid) {
|
if (fieldIsInvalid) {
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
placeholder="e.g. FOO"
|
placeholder="e.g. FOO"
|
||||||
ng-model="$ctrl.variable.name"
|
ng-model="$ctrl.variable.name"
|
||||||
ng-disabled="$ctrl.variable.added"
|
ng-disabled="$ctrl.variable.added"
|
||||||
ng-pattern="$ctrl.KEY_REGEX"
|
|
||||||
ng-change="$ctrl.onChangeName($ctrl.variable.name)"
|
ng-change="$ctrl.onChangeName($ctrl.variable.name)"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
@ -36,7 +35,6 @@
|
||||||
ng-model="$ctrl.variable.value"
|
ng-model="$ctrl.variable.value"
|
||||||
placeholder="e.g. bar"
|
placeholder="e.g. bar"
|
||||||
ng-trim="false"
|
ng-trim="false"
|
||||||
ng-pattern="$ctrl.VALUE_REGEX"
|
|
||||||
name="value"
|
name="value"
|
||||||
ng-change="$ctrl.onChangeValue($ctrl.variable.value)"
|
ng-change="$ctrl.onChangeValue($ctrl.variable.value)"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import _ from 'lodash-es';
|
import _ from 'lodash-es';
|
||||||
|
|
||||||
export const KEY_REGEX = /[a-zA-Z]([-_a-zA-Z0-9]*[a-zA-Z0-9])?/.source;
|
export const KEY_REGEX = /(.+)/.source;
|
||||||
|
|
||||||
export const VALUE_REGEX = /(.*)?/.source;
|
export const VALUE_REGEX = /(.*)?/.source;
|
||||||
|
|
||||||
const KEY_VALUE_REGEX = new RegExp(`^(${KEY_REGEX})\\s*=(${VALUE_REGEX})$`);
|
const KEY_VALUE_REGEX = new RegExp(`^(${KEY_REGEX})\\s*=(${VALUE_REGEX})$`);
|
||||||
|
@ -16,7 +15,7 @@ export function parseDotEnvFile(src) {
|
||||||
return parseArrayOfStrings(
|
return parseArrayOfStrings(
|
||||||
_.compact(src.split(NEWLINES_REGEX))
|
_.compact(src.split(NEWLINES_REGEX))
|
||||||
.map((v) => v.trim())
|
.map((v) => v.trim())
|
||||||
.filter((v) => !v.startsWith('#'))
|
.filter((v) => !v.startsWith('#') && v !== '')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +39,7 @@ export function parseArrayOfStrings(array) {
|
||||||
|
|
||||||
const parsedKeyValArr = variableString.trim().match(KEY_VALUE_REGEX);
|
const parsedKeyValArr = variableString.trim().match(KEY_VALUE_REGEX);
|
||||||
if (parsedKeyValArr != null && parsedKeyValArr.length > 4) {
|
if (parsedKeyValArr != null && parsedKeyValArr.length > 4) {
|
||||||
return { name: parsedKeyValArr[1], value: parsedKeyValArr[3] || '' };
|
return { name: parsedKeyValArr[1].trim(), value: parsedKeyValArr[3].trim() || '' };
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue