Skip to content

Commit 7f8ad86

Browse files
committed
updating doc and fixes nginx passthrough
1 parent 1f6c84a commit 7f8ad86

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

documentation/staging/content/navigate/kubernetes/k8s-ingress-controller.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ cluster attempts to pull the image and start the container.
5050
To create this secret, enable `Create Docker Hub Secret` and fill in the pull secret data in the `Docker Hub Username`, `Docker Hub Password`,
5151
and `Docker Hub Email Address` fields.
5252
- For NGINX ingress controller, if you desire to have SSL pass through ingress route, enable `
53-
Allow SSL pass through to target service`.
53+
Allow SSL pass through to target service`.
5454

5555
#### TLS Secret for Ingress Routes
5656
Use this pane to configure the Transport Layer Security (TLS) secret containing the certificate and private key data that will be used by the
@@ -91,12 +91,13 @@ When editing a route:
9191
- Specify transport option for the ingress route.
9292
* Select `Plain HTTP` for unencrypted traffic from client through ingress controller to the target service
9393
* Select `SSL terminate at ingress controller` for SSL
94-
terminate
94+
terminating
9595
at ingress controller and then unencrypted traffic from ingress controller to target service. Check `Is
9696
target service WebLogic Console?
9797
` if the target service is `WebLogic Console` service.
9898
* Select `SSL pass through` for SSL traffic pass through ingress
99-
controller and terminate at target service. Make sure the `Target Port` is SSL port.
99+
controller and terminate at target service. If you select this option, all SSL traffic from the `Virtual Host`
100+
will be routed to the target service. Make sure the `Target Port` supports SSL.
100101
- Use the `Ingress Route Annotations` table to
101102
add annotations to the ingress route, as needed. Do not remove any pre-populated annotations.
102103

webui/src/js/utils/ingress-resource-generator.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ define(['models/wkt-project', 'js-yaml'],
7878
createNginxRoutesAsYaml(item) {
7979
const namespace = item['targetServiceNameSpace'] || 'default';
8080
const version = window.api.process.getVersion();
81+
let path = item['path'];
82+
if (this.isSSLPassThrough(item)) {
83+
path = '/';
84+
}
8185

8286
const result = {
8387
apiVersion: 'networking.k8s.io/v1',
@@ -101,7 +105,7 @@ define(['models/wkt-project', 'js-yaml'],
101105
}
102106
}
103107
},
104-
path: item['path'],
108+
path: path,
105109
pathType: 'Prefix'
106110
}
107111
]
@@ -110,21 +114,23 @@ define(['models/wkt-project', 'js-yaml'],
110114
]
111115
}
112116
};
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+
114122
this.addVirtualHost(result, item);
115123

116124
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' +
123130
' "WL-Proxy-Client-IP" "WL-Proxy-SSL";\n'
124131
+ 'more_set_input_headers "X-Forwarded-Proto: https";\n'
125132
+ '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';
128134
}
129135

130136
this.addAnnotations(result, item);
@@ -139,15 +145,15 @@ define(['models/wkt-project', 'js-yaml'],
139145
}
140146
}
141147

142-
isTraefikSSLPassThrough(item) {
148+
isSSLPassThrough(item) {
143149
if (item && item['tlsOption'] === 'ssl_passthrough') {
144150
return true;
145151
} else {
146152
return false;
147153
}
148154
}
149155

150-
isTraefikPlain(item) {
156+
isPlainHTTP(item) {
151157
if (item && item['tlsOption'] === 'plain') {
152158
return true;
153159
} else {
@@ -251,7 +257,7 @@ define(['models/wkt-project', 'js-yaml'],
251257
result.spec.tls = { secretName: item['tlsSecretName'] };
252258
}
253259
// SSL passthrough
254-
if (this.project.ingress.specifyIngressTLSSecret.value && this.isTraefikSSLPassThrough(item)) {
260+
if (this.project.ingress.specifyIngressTLSSecret.value && this.isSSLPassThrough(item)) {
255261
const obj = { passthrough: true };
256262
result.spec.tls = [ obj ];
257263

@@ -278,14 +284,14 @@ define(['models/wkt-project', 'js-yaml'],
278284

279285
addTlsSpec(result, item) {
280286
// 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)) {
282288
if (!item['tlsSecretName']) {
283289
item['tlsSecretName'] = this.project.ingress.ingressTLSSecretName.value;
284290
}
285291

286292
const obj = { secretName: item['tlsSecretName'] };
287293
if (item['virtualHost']) {
288-
obj['hosts'] = item['virtualHost'];
294+
obj['hosts'] = [ item['virtualHost'] ];
289295
}
290296
result.spec.tls = [ obj ];
291297
}

0 commit comments

Comments
 (0)