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

Commit bf060c1

Browse files
authored
Merge pull request #56 from andresmgot/metadataSchema
Place labels and descriptions inside the metadata definition
2 parents 9463471 + 906eabe commit bf060c1

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

deploy/kubelessDeploy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ function getFunctionDescription(
5454
},
5555
};
5656
if (desc) {
57-
funcs.annotations = {
57+
funcs.metadata.annotations = {
5858
'kubeless.serverless.com/description': desc,
5959
};
6060
}
6161
if (labels) {
62-
funcs.labels = labels;
62+
funcs.metadata.labels = labels;
6363
}
6464
if (env || memory) {
6565
const container = {

info/kubelessInfo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ class KubelessInfo {
168168
topic: fDesc.spec.topic,
169169
type: fDesc.spec.type,
170170
deps: fDesc.spec.deps,
171-
annotations: fDesc.annotations,
172-
labels: fDesc.labels,
171+
annotations: fDesc.metadata.annotations,
172+
labels: fDesc.metadata.labels,
173173
selfLink: fDesc.metadata.selfLink,
174174
uid: fDesc.metadata.uid,
175175
timestamp: fDesc.metadata.creationTimestamp,

test/kubelessDeploy.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ describe('KubelessDeploy', () => {
673673
expect(thirdPartyResources.ns.functions.post.calledOnce).to.be.eql(true);
674674
expect(
675675
thirdPartyResources.ns.functions.post
676-
.firstCall.args[0].body.annotations['kubeless.serverless.com/description']
676+
.firstCall.args[0].body.metadata.annotations['kubeless.serverless.com/description']
677677
).to.be.eql(desc);
678678
return result;
679679
});
@@ -692,7 +692,7 @@ describe('KubelessDeploy', () => {
692692
).to.be.fulfilled;
693693
expect(thirdPartyResources.ns.functions.post.calledOnce).to.be.eql(true);
694694
expect(
695-
thirdPartyResources.ns.functions.post.firstCall.args[0].body.labels
695+
thirdPartyResources.ns.functions.post.firstCall.args[0].body.metadata.labels
696696
).to.be.eql(labels);
697697
return result;
698698
});

test/kubelessInfo.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ describe('KubelessInfo', () => {
304304
it('should return the description in case it exists', (done) => {
305305
mockGetCalls(
306306
[{ name: func, namespace: 'default' }],
307-
{ annotations: { 'kubeless.serverless.com/description': 'Test Description' } }
307+
{ metadata: { annotations: { 'kubeless.serverless.com/description': 'Test Description' } } }
308308
);
309309
const kubelessInfo = new KubelessInfo(serverless, { function: func });
310310
kubelessInfo.infoFunction({ color: false }).then((message) => {
@@ -315,7 +315,7 @@ describe('KubelessInfo', () => {
315315
it('should return the labels in case they exist', (done) => {
316316
mockGetCalls(
317317
[{ name: func, namespace: 'default' }],
318-
{ labels: { label1: 'text1', label2: 'text2' } }
318+
{ metadata: { labels: { label1: 'text1', label2: 'text2' } } }
319319
);
320320
const kubelessInfo = new KubelessInfo(serverless, { function: func });
321321
kubelessInfo.infoFunction({ color: false }).then((message) => {

0 commit comments

Comments
 (0)