Skip to content

Commit dc1b574

Browse files
committed
update and add version label to ingress object
1 parent 0c18c1f commit dc1b574

File tree

6 files changed

+34
-11
lines changed

6 files changed

+34
-11
lines changed

electron/app/js/ipcRendererPreload.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ contextBridge.exposeInMainWorld(
229229
isMac: () => osUtils.isMac(),
230230
isLinux: () => osUtils.isLinux(),
231231
getApplicationName: () => wktApp.getApplicationName(),
232+
getVersion: () => wktApp.getApplicationVersion(),
232233
getArgv: (name) => osUtils.getArgv(name)
233234
},
234235
'i18n': {

electron/app/locales/en/webui.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@
609609
"ingress-design-voyager-provider-label": "Kubernetes Cluster Provider for Voyager",
610610
"ingress-design-voyager-provider-help": "The Kubernetes cluster provider type to use for Voyager.",
611611
"ingress-design-nginx-allow-passthrough-label": "Allow SSL pass through to backend service",
612-
"ingress-design-nginx-allow-passthrough-help": "Enable this allows creating ssl ingress pass through to the backend service.",
612+
"ingress-design-nginx-allow-passthrough-help": "Enable this allows creating SSL pass through ingress transport to the target service.",
613613
"ingress-design-specify-docker-registry-secret-label": "Use Docker Hub Secret",
614614
"ingress-design-specify-docker-registry-secret-help": "Whether to use a Docker Hub credential secret to pull the ingress controller image. This is helpful if you encounter a Docker Hub pull limit exceeded error.",
615615
"ingress-design-ingress-docker-reg-secret-name": "Docker Registry Secret Name",
@@ -632,11 +632,12 @@
632632
"ingress-design-ingress-route-targetport-label": "Target Port",
633633
"ingress-design-ingress-route-path-label": "Path Expression",
634634
"ingress-design-ingress-route-tls-label": "Transport Options",
635+
"ingress-design-ingress-route-tls-help": "Select the transport option for this ingress route",
635636
"ingress-design-ingress-route-tlsoption-plain": "Plain HTTP",
636-
"ingress-design-ingress-route-tlsoption-ssl-passthrough": "HTTPS pass through to the target service",
637-
"ingress-design-ingress-route-tlsoption-ssl-terminate-ingress": "HTTPS terminate at ingress and plain HTTP traffic from ingress to target service",
637+
"ingress-design-ingress-route-tlsoption-ssl-passthrough": "SSL pass through ingress directly to the target service",
638+
"ingress-design-ingress-route-tlsoption-ssl-terminate-ingress": "SSL terminate at ingress and then plain HTTP traffic from ingress to target service",
638639
"ingress-design-ingress-route-is-console-svc-label": "Is target service WebLogic Console?",
639-
"ingress-design-ingress-route-is-console-svc-help": "For SSL terminating at ingress and accessing WebLogic Console, turn on this option",
640+
"ingress-design-ingress-route-is-console-svc-help": "For SSL terminating at ingress and accessing WebLogic Console Service, turn on this option",
640641
"ingress-design-ingress-route-name-label": "Name",
641642
"ingress-design-ingress-route-dialog-title": "Edit Ingress Route",
642643
"ingress-design-ingress-route-annotation-label": "Annotation",

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ define(['models/wkt-project', 'js-yaml'],
4141

4242
createVoyagerRoutesAsYaml(item) {
4343
const namespace = item['targetServiceNameSpace'] || 'default';
44-
44+
const version = window.api.process.getVersion();
4545
const result = {
4646
apiVersion: 'voyager.appscode.com/v1beta1',
4747
kind: 'Ingress',
4848
metadata: {
4949
name: item['name'],
5050
namespace: namespace,
51+
labels: { createdByWtkUIVersion: version}
5152
},
5253
spec: {
5354
rules: [
@@ -76,13 +77,15 @@ define(['models/wkt-project', 'js-yaml'],
7677

7778
createNginxRoutesAsYaml(item) {
7879
const namespace = item['targetServiceNameSpace'] || 'default';
80+
const version = window.api.process.getVersion();
7981

8082
const result = {
8183
apiVersion: 'networking.k8s.io/v1',
8284
kind: 'Ingress',
8385
metadata: {
8486
name: item['name'],
8587
namespace: namespace,
88+
labels: { createdByWtkUIVersion: version}
8689
},
8790
spec: {
8891
rules: [
@@ -109,17 +112,22 @@ define(['models/wkt-project', 'js-yaml'],
109112
};
110113
this.addTlsSpec(result, item);
111114
this.addVirtualHost(result, item);
112-
this.addAnnotations(result, item);
113115

114116
if (this.isSSLTerminateAtIngress(item)) {
115117
if (item['isConsoleService']) {
116-
const snippet = 'more_clear_input_headers "WL-Proxy-Client-IP" "WL-Proxy-SSL";\n'
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' +
123+
' "WL-Proxy-Client-IP" "WL-Proxy-SSL";\n'
117124
+ 'more_set_input_headers "X-Forwarded-Proto: https";\n'
118-
+ 'more_set_input_headers "WL-Proxy-SSL: true";\n'; // must have nl at the end
119-
result.metadata.annotations['nginx.ingress.kubernetes.io/configuration-snippet'] = snippet;
120-
result.metadata.annotations['nginx.ingress.kubernetes.io/ingress.allow-http'] = 'false';
125+
+ 'more_set_input_headers "WL-Proxy-SSL: true";\n';
126+
item.annotations['nginx.ingress.kubernetes.io/ingress.allow-http'] = 'false';
121127
}
122128
}
129+
130+
this.addAnnotations(result, item);
123131
return jsYaml.dump(result);
124132
}
125133

@@ -150,13 +158,15 @@ define(['models/wkt-project', 'js-yaml'],
150158
createTraefikMiddlewaresAsYaml(item) {
151159

152160
const namespace = item['targetServiceNameSpace'] || 'default';
161+
const version = window.api.process.getVersion();
153162

154163
const result = {
155164
apiVersion: 'traefik.containo.us/v1alpha1',
156165
kind: 'Middleware',
157166
metadata: {
158167
name: item['name'] + '-middleware',
159168
namespace: namespace,
169+
labels: { createdByWtkUIVersion: version}
160170
}
161171
};
162172

webui/src/js/views/route-edit-dialog.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
<oj-radioset id="tlsOptionId"
4949
label-hint="[[labelMapper('route-tls-label')]]"
50+
help.instruction="[[labelMapper('route-tls-help')]]"
5051
label-edge="inside"
5152
on-value-changed = "[[transportValueChanged]]"
5253
value="{{tlsOption.observable}}">

webui/src/test/ingress-definition-test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ const expect = chai.expect;
1212
const wkt_assertions = require('./wkt-assertions');
1313
chai.use(wkt_assertions);
1414

15-
const { after, before, describe, it } = require('mocha');
15+
const { after, before, beforeEach, describe, it } = require('mocha');
1616
const requirejs = require('requirejs');
1717
const testHelper = require('./test-helper');
1818
const jsyaml = require('js-yaml');
19+
const {WindowStub} = require('./window-stub');
1920

2021
describe('ingress-definition', function () {
2122
let ingressResource;
@@ -30,15 +31,21 @@ describe('ingress-definition', function () {
3031

3132
before(function (done) {
3233
testHelper.install();
34+
WindowStub.install();
3335
requirejs(['utils/ingress-resource-generator'],
3436
function (IngressResourceGenerator) {
3537
ingressResource = new IngressResourceGenerator();
3638
done();
3739
});
3840
});
3941

42+
beforeEach(function () {
43+
WindowStub.initialize();
44+
});
45+
4046
after(function() {
4147
testHelper.remove();
48+
WindowStub.remove();
4249
});
4350

4451
describe('generate', function() {

webui/src/test/window-stub.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ class WindowStub {
5656
}
5757
},
5858
process: {
59+
getVersion: () => {
60+
return '1.1.0';
61+
},
5962
isWindows: () => {
6063
return _isWindows;
6164
},

0 commit comments

Comments
 (0)