diff --git a/README.md b/README.md index a46afdd..0a3a980 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ driver: certManagerIssuer: lets-encrypt k8sDelay: 1000 k8sRetries: 10 + logPassthrough: true ``` - `registry` is the Docker Registry to load Stack Containers from @@ -32,6 +33,7 @@ AWS EKS specific annotation for ALB Ingress. - `certManagerIssuer` name of the ClusterIssuer to use to create HTTPS certs for instances (default not set) - `k8sRetries` how many times to retry actions against the K8s API - `k8sDelay` how long to wait (in ms) between retries to the K8s API +- `logPassthrough` Have Node-RED logs printed in JSON format to container stdout (default false) Expects to pick up K8s credentials from the environment diff --git a/kubernetes.js b/kubernetes.js index d23e9f9..427a3a5 100644 --- a/kubernetes.js +++ b/kubernetes.js @@ -282,6 +282,10 @@ const createDeployment = async (project, options) => { localPod.spec.containers[0].env.push({ name: 'FORGE_NR_SECRET', value: credentialSecret }) } + if (this._logPassthrough) { + localPod.spec.containers[0].env.push({ name: 'FORGE_LOG_PASSTHROUGH', value: 'true' }) + } + if (this._app.config.driver.options.projectSelector) { localPod.spec.nodeSelector = this._app.config.driver.options.projectSelector } @@ -602,10 +606,11 @@ module.exports = { this._projects = {} this._options = options - this._namespace = this._app.config.driver.options.projectNamespace || 'flowforge' - this._k8sDelay = this._app.config.driver.options.k8sDelay || 1000 - this._k8sRetries = this._app.config.driver.options.k8sRetries || 10 - this._certManagerIssuer = this._app.config.driver.options.certManagerIssuer + this._namespace = this._app.config.driver.options?.projectNamespace || 'flowforge' + this._k8sDelay = this._app.config.driver.options?.k8sDelay || 1000 + this._k8sRetries = this._app.config.driver.options?.k8sRetries || 10 + this._certManagerIssuer = this._app.config.driver.options?.certManagerIssuer + this._logPassthrough = this._app.config.driver.options?.logPassthrough || false const kc = new k8s.KubeConfig()