Comparing version 0.3.5 to 0.3.6
@@ -58,3 +58,15 @@ "use strict"; | ||
getIngress({ name = this.name, vhost = this.name, targetPort } = {}) { | ||
const exposedPort = targetPort ? targetPort : (this.port ? this.port : (this.ports[0].name ? this.ports[0].name : this.ports[0].servicePort)); | ||
let exposedPort; | ||
if (targetPort) { | ||
exposedPort = targetPort; | ||
} | ||
else if (this.port) { | ||
exposedPort = this.port; | ||
} | ||
else if (this.ports[0]) { | ||
exposedPort = this.ports[0].name ? this.ports[0].name : this.ports[0].servicePort; | ||
} | ||
else { | ||
throw new Error(`getIngress: ContainerizedService "${this.name}" does not specifiy a port to expose`); | ||
} | ||
const rule = { | ||
@@ -61,0 +73,0 @@ host: vhost, |
@@ -135,3 +135,12 @@ "use strict"; | ||
const serviceName = this.metadata.name; | ||
const servicePort = targetPort ? targetPort : (this.spec.ports[0].name ? this.spec.ports[0].name : this.spec.ports[0].port); | ||
let servicePort; | ||
if (targetPort) { | ||
servicePort = targetPort; | ||
} | ||
else if (this.spec.ports && this.spec.ports[0]) { | ||
servicePort = this.spec.ports[0].name ? this.spec.ports[0].name : this.spec.ports[0].port; | ||
} | ||
else { | ||
throw new Error(`getIngress: Service "${this.metadata.name}" does not specifiy a port to expose`); | ||
} | ||
const rule = { | ||
@@ -138,0 +147,0 @@ host: ingVhost, |
@@ -5,3 +5,3 @@ { | ||
"types": "dist/index.d.ts", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "Solution Service Architecture", | ||
@@ -8,0 +8,0 @@ "homepage": "https://github.com/IBM/solsa", |
@@ -283,8 +283,5 @@ <!-- | ||
const helloWorld = new solsa.ContainerizedService({ name: 'hello-world', image: 'docker.io/ibmcom/kn-helloworld', port: 8080 }) | ||
const ingress = helloWorld.getIngress() | ||
module.exports = new solsa.Bundle({ helloWorld, ingress }) | ||
module.exports = new solsa.ContainerizedService({ name: 'hello-world', image: 'docker.io/ibmcom/kn-helloworld', port: 8080, ingress:true }) | ||
``` | ||
It consists of a single containerized service and an ingress for this service. | ||
It consists of a single containerized service which when deployed will be exposed via an ingress. | ||
@@ -298,3 +295,3 @@ This solution can be deployed to the current Kubernetes context using the | ||
configuration file used. If no configuration file is used, the ingress | ||
definition is ignored and the CLI outputs a warning message. | ||
request is ignored and the CLI outputs a warning message. | ||
@@ -301,0 +298,0 @@ Assuming the configuration file provided in the previous section, the YAML |
1547012
30893
339