diff --git a/examples/event-trigger-python/README.md b/examples/event-trigger-python/README.md index 15374cf..b5dbcde 100644 --- a/examples/event-trigger-python/README.md +++ b/examples/event-trigger-python/README.md @@ -8,6 +8,6 @@ The topic in which the function will be listening is defined in the `events` sec $ npm install $ serverless deploy $ kubeless topic publish --topic hello_topic --data 'hello world!' # push a message into the queue -$ serverless logs -f hello +$ serverless logs -f events hello world! ``` diff --git a/lib/deploy.js b/lib/deploy.js index 5fcf7a5..337c34d 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -70,7 +70,7 @@ function getFunctionDescription( }); } if (memory) { - // If no suffix is given we assume the unit will be `Mi` + // If no suffix is given we assume the unit will be `Mi` const memoryWithSuffix = memory.toString().match(/\d+$/) ? `${memory}Mi` : memory; @@ -125,14 +125,6 @@ function getIngressDescription(funcName, funcPath, funcHost) { }; } -function getThirdPartyResources(connectionOptions) { - return new Api.ThirdPartyResources(connectionOptions); -} - -function getExtensions(connectionOptions) { - return new Api.Extensions(connectionOptions); -} - function waitForDeployment(funcName, requestMoment, namespace, options) { const opts = _.defaults({}, options, { verbose: false, @@ -293,7 +285,7 @@ function addIngressRuleIfNecessary( log: console.log, }); const config = helpers.loadKubeConfig(); - const extensions = getExtensions(helpers.getConnectionOptions( + const extensions = new Api.Extensions(helpers.getConnectionOptions( config, { namespace }) ); const fpath = eventPath || '/'; @@ -350,7 +342,7 @@ function deploy(functions, runtime, options) { namespace: description.namespace || opts.namespace, } ); - const thirdPartyResources = getThirdPartyResources(connectionOptions); + const thirdPartyResources = new Api.ThirdPartyResources(connectionOptions); thirdPartyResources.addResource('functions'); const events = !_.isEmpty(description.events) ? description.events : diff --git a/remove/kubelessRemove.js b/remove/kubelessRemove.js index a100456..89d1739 100644 --- a/remove/kubelessRemove.js +++ b/remove/kubelessRemove.js @@ -45,7 +45,6 @@ class KubelessRemove { } removeFunction() { - this.serverless.cli.log(`Removing Service ${this.serverless.service.service}...`); const parsedFunctions = _.map( this.serverless.service.functions, (f, id) => _.assign({ id }, f) diff --git a/test/kubelessDeploy.test.js b/test/kubelessDeploy.test.js index 8933901..546077f 100644 --- a/test/kubelessDeploy.test.js +++ b/test/kubelessDeploy.test.js @@ -110,15 +110,7 @@ describe('KubelessDeploy', () => { let depsFile = null; const functionName = 'myFunction'; const functionText = 'function code'; - const serverlessWithFunction = _.defaultsDeep({}, serverless, { - config: {}, - service: { - functions: {}, - }, - }); - serverlessWithFunction.service.functions[functionName] = { - handler: 'function.hello', - }; + let serverlessWithFunction = null; let kubelessDeploy = null; @@ -130,6 +122,15 @@ describe('KubelessDeploy', () => { }, 100); clock = sinon.useFakeTimers(); config = mocks.kubeConfig(cwd); + serverlessWithFunction = _.defaultsDeep({}, serverless, { + config: {}, + service: { + functions: {}, + }, + }); + serverlessWithFunction.service.functions[functionName] = { + handler: 'function.hello', + }; serverlessWithFunction.config.servicePath = cwd; handlerFile = path.join(cwd, 'function.py'); fs.writeFileSync(handlerFile, functionText); diff --git a/test/kubelessDeployFunction.test.js b/test/kubelessDeployFunction.test.js index a899ffc..435cafc 100644 --- a/test/kubelessDeployFunction.test.js +++ b/test/kubelessDeployFunction.test.js @@ -63,20 +63,7 @@ describe('KubelessDeployFunction', () => { let config = null; let handlerFile = null; let depsFile = null; - const serverlessWithFunction = _.defaultsDeep({}, serverless, { - config: { - servicePath: cwd, - }, - service: { - functions: {}, - }, - }); - serverlessWithFunction.service.functions[functionName] = { - handler: 'function.hello', - }; - serverlessWithFunction.service.functions.otherFunction = { - handler: 'function.hello', - }; + let serverlessWithFunction = null; let kubelessDeployFunction = null; @@ -91,6 +78,20 @@ describe('KubelessDeployFunction', () => { clock.tick(2001); }, 100); clock = sinon.useFakeTimers(); + serverlessWithFunction = _.defaultsDeep({}, serverless, { + config: { + servicePath: cwd, + }, + service: { + functions: {}, + }, + }); + serverlessWithFunction.service.functions[functionName] = { + handler: 'function.hello', + }; + serverlessWithFunction.service.functions.otherFunction = { + handler: 'function.hello', + }; kubelessDeployFunction = instantiateKubelessDeploy( handlerFile, depsFile,