Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
fix unable to run function in other namespaces (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
arditdine authored Jan 11, 2021
1 parent be5235c commit 14f490e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/invoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function invoke(func, data, funcsDesc, options) {
const namespace = desc.namespace ||
opts.namespace ||
helpers.getDefaultNamespace(config);
const connectionOptions = helpers.getConnectionOptions(helpers.loadKubeConfig());
const connectionOptions = helpers.getConnectionOptions(helpers.loadKubeConfig(), { namespace });
const core = new Api.Core(connectionOptions);
const requestData = getData(data, {
path: opts.path,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-kubeless",
"version": "0.11.0",
"version": "0.11.1",
"description": "This plugin enables support for Kubeless within the [Serverless Framework](https://github.com/serverless).",
"main": "index.js",
"directories": {
Expand Down
10 changes: 5 additions & 5 deletions test/kubelessInvoke.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ const serverless = require('./lib/serverless')({ service: { functions: { 'my-fun

require('chai').use(chaiAsPromised);

function nocksvc(url, funcs) {
function nocksvc(url, funcs, namespace = 'default') {
nock(url)
.get('/api/v1/namespaces/default/services')
.get(`/api/v1/namespaces/${namespace}/services`)
.reply(200, {
items: _.map(_.flatten([funcs]), f => ({
metadata:
{
name: f,
namespace: 'default',
selfLink: `/api/v1/namespaces/default/services/${f}`,
selfLink: `/api/v1/namespaces/${namespace}/services/${f}`,
uid: '010a169d-618c-11e7-9939-080027abf356',
resourceVersion: '248',
creationTimestamp: '2017-07-05T14:12:39Z',
Expand Down Expand Up @@ -234,7 +234,7 @@ describe('KubelessInvoke', () => {
statusMessage: 'OK',
});
});
nocksvc(kubeApiURL, func);
nocksvc(kubeApiURL, func, serverlessWithNS.service.provider.namespace);
return kubelessInvoke.invokeFunction().then((res) => {
expect(res).to.be.eql({
statusCode: 200,
Expand All @@ -257,7 +257,7 @@ describe('KubelessInvoke', () => {
statusMessage: 'OK',
});
});
nocksvc(kubeApiURL, func);
nocksvc(kubeApiURL, func, serverlessWithNS.service.functions[func].namespace);
return kubelessInvoke.invokeFunction().then((res) => {
expect(res).to.be.eql({
statusCode: 200,
Expand Down

0 comments on commit 14f490e

Please sign in to comment.