@@ -135,9 +135,12 @@ define(['models/wkt-project', 'utils/vz-helper', 'js-yaml', 'utils/i18n', 'utils
135
135
for ( const ingressTraitRule of component . ingressTraitRules ) {
136
136
const rule = { } ;
137
137
138
- if ( Array . isArray ( ingressTraitRule . hosts ) && ingressTraitRule . hosts . length > 0 ) {
138
+ if ( typeof ingressTraitRule . hosts === 'string' && ingressTraitRule . hosts . length > 0 ) {
139
+ rule . hosts = ingressTraitRule . hosts . split ( ',' ) . map ( host => host . trim ( ) ) ;
140
+ } else if ( Array . isArray ( ingressTraitRule . hosts ) && ingressTraitRule . hosts . length > 0 ) {
139
141
rule . hosts = ingressTraitRule . hosts ;
140
142
}
143
+
141
144
if ( Array . isArray ( ingressTraitRule . paths ) && ingressTraitRule . paths . length > 0 ) {
142
145
rule . paths = ingressTraitRule . paths . map ( path => {
143
146
const newPath = Object . assign ( { } , path ) ;
@@ -222,38 +225,31 @@ define(['models/wkt-project', 'utils/vz-helper', 'js-yaml', 'utils/i18n', 'utils
222
225
}
223
226
224
227
_getIngressTraitRuleDestination ( ingressTraitRule ) {
225
- let destination = ingressTraitRule . destination ? { } : undefined ;
228
+ const destination = { } ;
226
229
227
- if ( ! destination ) {
228
- return destination ;
230
+ if ( ingressTraitRule . destinationHost ) {
231
+ destination . host = ingressTraitRule . destinationHost ;
232
+ }
233
+ if ( ingressTraitRule . destinationPort ) {
234
+ destination . port = ingressTraitRule . destinationPort ;
229
235
}
230
236
231
- if ( ingressTraitRule . destination . host ) {
232
- destination . host = ingressTraitRule . destination . host ;
237
+ const httpCookie = { } ;
238
+ if ( ingressTraitRule . destinationHttpCookieName ) {
239
+ httpCookie . name = ingressTraitRule . destinationHttpCookieName ;
233
240
}
234
- if ( ingressTraitRule . destination . port ) {
235
- destination . port = ingressTraitRule . destination . port ;
241
+ if ( ingressTraitRule . destinationHttpCookiePath ) {
242
+ httpCookie . path = ingressTraitRule . destinationHttpCookiePath ;
236
243
}
237
- if ( ingressTraitRule . destination . httpCookie ) {
238
- let httpCookie = { } ;
239
-
240
- if ( ingressTraitRule . destination . httpCookie . name ) {
241
- httpCookie . name = ingressTraitRule . destination . httpCookie . name ;
242
- }
243
- if ( ingressTraitRule . destination . httpCookie . path ) {
244
- httpCookie . path = ingressTraitRule . destination . httpCookie . path ;
245
- }
246
- if ( ingressTraitRule . destination . httpCookie . ttl ) {
247
- httpCookie . ttl = ingressTraitRule . destination . httpCookie . ttl ;
248
- }
249
-
250
- if ( Object . keys ( httpCookie ) . length > 0 ) {
251
- destination . httpCookie = httpCookie ;
252
- }
244
+ if ( ingressTraitRule . destinationHttpCookieTTL ) {
245
+ httpCookie . ttl = ingressTraitRule . destinationHttpCookieTTL ;
246
+ }
247
+ if ( Object . keys ( httpCookie ) . length > 0 ) {
248
+ destination . httpCookie = httpCookie ;
253
249
}
254
250
255
251
if ( Object . keys ( destination ) . length === 0 ) {
256
- destination = undefined ;
252
+ return undefined ;
257
253
}
258
254
return destination ;
259
255
}
0 commit comments