@@ -78,6 +78,10 @@ define(['models/wkt-project', 'js-yaml'],
78
78
createNginxRoutesAsYaml ( item ) {
79
79
const namespace = item [ 'targetServiceNameSpace' ] || 'default' ;
80
80
const version = window . api . process . getVersion ( ) ;
81
+ let path = item [ 'path' ] ;
82
+ if ( this . isSSLPassThrough ( item ) ) {
83
+ path = '/' ;
84
+ }
81
85
82
86
const result = {
83
87
apiVersion : 'networking.k8s.io/v1' ,
@@ -101,7 +105,7 @@ define(['models/wkt-project', 'js-yaml'],
101
105
}
102
106
}
103
107
} ,
104
- path : item [ ' path' ] ,
108
+ path : path ,
105
109
pathType : 'Prefix'
106
110
}
107
111
]
@@ -110,21 +114,23 @@ define(['models/wkt-project', 'js-yaml'],
110
114
]
111
115
}
112
116
} ;
113
- this . addTlsSpec ( result , item ) ;
117
+ // No need to set TLS if passthrough
118
+ if ( ! this . isSSLPassThrough ( item ) ) {
119
+ this . addTlsSpec ( result , item ) ;
120
+ }
121
+
114
122
this . addVirtualHost ( result , item ) ;
115
123
116
124
if ( this . isSSLTerminateAtIngress ( item ) ) {
117
- if ( item [ 'isConsoleService' ] ) {
118
- if ( ! ( 'annotations' in item ) ) {
119
- item [ 'annotations' ] = { } ;
120
- }
121
- // must have nl at the end
122
- item . annotations [ 'nginx.ingress.kubernetes.io/configuration-snippet' ] = 'more_clear_input_headers' +
125
+ if ( ! ( 'annotations' in item ) ) {
126
+ item [ 'annotations' ] = { } ;
127
+ }
128
+ // must have nl at the end
129
+ item . annotations [ 'nginx.ingress.kubernetes.io/configuration-snippet' ] = 'more_clear_input_headers' +
123
130
' "WL-Proxy-Client-IP" "WL-Proxy-SSL";\n'
124
131
+ 'more_set_input_headers "X-Forwarded-Proto: https";\n'
125
132
+ 'more_set_input_headers "WL-Proxy-SSL: true";\n' ;
126
- item . annotations [ 'nginx.ingress.kubernetes.io/ingress.allow-http' ] = 'false' ;
127
- }
133
+ item . annotations [ 'nginx.ingress.kubernetes.io/ingress.allow-http' ] = 'false' ;
128
134
}
129
135
130
136
this . addAnnotations ( result , item ) ;
@@ -139,15 +145,15 @@ define(['models/wkt-project', 'js-yaml'],
139
145
}
140
146
}
141
147
142
- isTraefikSSLPassThrough ( item ) {
148
+ isSSLPassThrough ( item ) {
143
149
if ( item && item [ 'tlsOption' ] === 'ssl_passthrough' ) {
144
150
return true ;
145
151
} else {
146
152
return false ;
147
153
}
148
154
}
149
155
150
- isTraefikPlain ( item ) {
156
+ isPlainHTTP ( item ) {
151
157
if ( item && item [ 'tlsOption' ] === 'plain' ) {
152
158
return true ;
153
159
} else {
@@ -251,7 +257,7 @@ define(['models/wkt-project', 'js-yaml'],
251
257
result . spec . tls = { secretName : item [ 'tlsSecretName' ] } ;
252
258
}
253
259
// SSL passthrough
254
- if ( this . project . ingress . specifyIngressTLSSecret . value && this . isTraefikSSLPassThrough ( item ) ) {
260
+ if ( this . project . ingress . specifyIngressTLSSecret . value && this . isSSLPassThrough ( item ) ) {
255
261
const obj = { passthrough : true } ;
256
262
result . spec . tls = [ obj ] ;
257
263
@@ -278,14 +284,14 @@ define(['models/wkt-project', 'js-yaml'],
278
284
279
285
addTlsSpec ( result , item ) {
280
286
// If the Ingress TLS secret is not enabled, do not add the ingress TLS secret name even if it exists.
281
- if ( this . project . ingress . specifyIngressTLSSecret . value && ! this . isTraefikPlain ( item ) ) {
287
+ if ( this . project . ingress . specifyIngressTLSSecret . value && ! this . isPlainHTTP ( item ) ) {
282
288
if ( ! item [ 'tlsSecretName' ] ) {
283
289
item [ 'tlsSecretName' ] = this . project . ingress . ingressTLSSecretName . value ;
284
290
}
285
291
286
292
const obj = { secretName : item [ 'tlsSecretName' ] } ;
287
293
if ( item [ 'virtualHost' ] ) {
288
- obj [ 'hosts' ] = item [ 'virtualHost' ] ;
294
+ obj [ 'hosts' ] = [ item [ 'virtualHost' ] ] ;
289
295
}
290
296
result . spec . tls = [ obj ] ;
291
297
}
0 commit comments