Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

[Tested] Use CLI SDK for making openfaas calls #610

Merged
merged 3 commits into from
Apr 2, 2020

Conversation

viveksyngh
Copy link
Contributor

@viveksyngh viveksyngh commented Mar 6, 2020

Signed-off-by: Vivek Singh vivekkmr45@yahoo.in

Description

How Has This Been Tested?

buildshiprun and garbage collect part of #609

How are existing users impacted? What migration steps/scripts do we need?

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • read the CONTRIBUTION guide
  • signed-off my commits with git commit -s
  • added unit tests

@viveksyngh viveksyngh changed the title Use CLI SDK for making openfaas calls [WIP] Use CLI SDK for making openfaas calls Mar 6, 2020
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
@viveksyngh
Copy link
Contributor Author

I tested it on my local cluster using k3s and k3d for local development.

https://github.com/viveksyngh/openfaas-functions/runs/498663912

buildshiprun function logs

kubectl logs -f pods/buildshiprun-5b64ff95f5-v95xv -n openfaas-fn
2020/03/10 18:07:11 Version: 0.18.1	SHA: b46be5a4d9d9d55da9c4b1e50d86346e0afccf2d
2020/03/10 18:07:11 Timeouts: read: 5m0s, write: 5m0s hard: 0s.
2020/03/10 18:07:11 Listening on port: 8080
2020/03/10 18:07:11 Writing lock-file to: /tmp/.lock
2020/03/10 18:07:11 Metrics listening on port: 8081
2020/03/10 18:16:23 Forking fprocess.
2020/03/10 18:16:23 Query
2020/03/10 18:16:23 Path  /
2020/03/10 18:16:23 0 env-vars for fn3
2020/03/10 18:16:23 0 env-vars for viveksyngh-fn3
2020/03/10 18:16:47 Image build status: 200
2020/03/10 18:16:47 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn3:latest-master-af32a29'
2020/03/10 18:16:47 pipeline-log: status: 200
2020/03/10 18:16:47 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn3:latest-master-af32a29 as viveksyngh-fn3
Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn3:latest-master-af32a29 as viveksyngh-fn3

Deployed. 202 Accepted.
URL: http://gateway.openfaas:8080/function/viveksyngh-fn3

2020/03/10 18:16:47 Deploy status - 202
2020/03/10 18:16:47 viveksyngh-fn3 deployed successfully
buildStatus docker.io/viveksyngh/viveksyngh-openfaas-functions-fn3:latest-master-af32a29 200 OK
2020/03/10 18:16:48 Duration: 25.261300 seconds
2020/03/10 18:16:50 Forking fprocess.
2020/03/10 18:16:50 Query
2020/03/10 18:16:50 Path  /
2020/03/10 18:16:50 0 env-vars for fn4
2020/03/10 18:16:50 0 env-vars for viveksyngh-fn4
2020/03/10 18:16:54 Image build status: 200
2020/03/10 18:16:54 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn4:latest-master-af32a29'
2020/03/10 18:16:54 pipeline-log: status: 200
2020/03/10 18:16:54 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn4:latest-master-af32a29 as viveksyngh-fn4
Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn4:latest-master-af32a29 as viveksyngh-fn4

Deployed. 202 Accepted.
URL: http://gateway.openfaas:8080/function/viveksyngh-fn4

2020/03/10 18:16:54 Deploy status - 202
2020/03/10 18:16:54 viveksyngh-fn4 deployed successfully
buildStatus docker.io/viveksyngh/viveksyngh-openfaas-functions-fn4:latest-master-af32a29 200 OK
2020/03/10 18:16:56 Duration: 6.359881 seconds
2020/03/10 18:16:57 Forking fprocess.
2020/03/10 18:16:57 Query
2020/03/10 18:16:57 Path  /
2020/03/10 18:16:57 0 env-vars for fn5
2020/03/10 18:16:57 0 env-vars for viveksyngh-fn5
2020/03/10 18:17:01 Image build status: 200
2020/03/10 18:17:01 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn5:latest-master-af32a29'
2020/03/10 18:17:01 pipeline-log: status: 200
2020/03/10 18:17:01 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn5:latest-master-af32a29 as viveksyngh-fn5
Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn5:latest-master-af32a29 as viveksyngh-fn5

Deployed. 202 Accepted.
URL: http://gateway.openfaas:8080/function/viveksyngh-fn5

2020/03/10 18:17:01 Deploy status - 202
2020/03/10 18:17:01 viveksyngh-fn5 deployed successfully
buildStatus docker.io/viveksyngh/viveksyngh-openfaas-functions-fn5:latest-master-af32a29 200 OK
2020/03/10 18:17:03 Duration: 5.642184 seconds
2020/03/10 18:17:03 Forking fprocess.
2020/03/10 18:17:03 Query
2020/03/10 18:17:03 Path  /
2020/03/10 18:17:03 0 env-vars for fn1
2020/03/10 18:17:03 0 env-vars for viveksyngh-fn1
2020/03/10 18:17:08 Image build status: 200
2020/03/10 18:17:08 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn1:latest-master-af32a29'
2020/03/10 18:17:08 pipeline-log: status: 200
2020/03/10 18:17:08 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn1:latest-master-af32a29 as viveksyngh-fn1
Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn1:latest-master-af32a29 as viveksyngh-fn1

Deployed. 202 Accepted.
URL: http://gateway.openfaas:8080/function/viveksyngh-fn1

2020/03/10 18:17:08 Deploy status - 202
2020/03/10 18:17:08 viveksyngh-fn1 deployed successfully
buildStatus docker.io/viveksyngh/viveksyngh-openfaas-functions-fn1:latest-master-af32a29 200 OK
2020/03/10 18:17:09 Duration: 5.878686 seconds
2020/03/10 18:17:10 Forking fprocess.
2020/03/10 18:17:10 Query
2020/03/10 18:17:10 Path  /
2020/03/10 18:17:10 0 env-vars for fn2
2020/03/10 18:17:10 0 env-vars for viveksyngh-fn2
2020/03/10 18:17:17 Image build status: 200
2020/03/10 18:17:17 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-af32a29'
2020/03/10 18:17:17 pipeline-log: status: 200
2020/03/10 18:17:17 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-af32a29 as viveksyngh-fn2
Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-af32a29 as viveksyngh-fn2

Deployed. 202 Accepted.
URL: http://gateway.openfaas:8080/function/viveksyngh-fn2

2020/03/10 18:17:17 Deploy status - 202
2020/03/10 18:17:17 viveksyngh-fn2 deployed successfully
buildStatus docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-af32a29 200 OK
2020/03/10 18:17:18 Duration: 7.991245 seconds



2020/03/10 18:18:49 Forking fprocess.
2020/03/10 18:18:49 Query
2020/03/10 18:18:49 Path  /
2020/03/10 18:18:49 0 env-vars for fn5
2020/03/10 18:18:49 0 env-vars for viveksyngh-fn5
2020/03/10 18:18:55 Image build status: 200
2020/03/10 18:18:55 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn5:latest-master-803874f'
2020/03/10 18:18:55 pipeline-log: status: 200
2020/03/10 18:18:55 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn5:latest-master-803874f as viveksyngh-fn5
Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn5:latest-master-803874f as viveksyngh-fn5

Deployed. 202 Accepted.
URL: http://gateway.openfaas:8080/function/viveksyngh-fn5

2020/03/10 18:18:55 Deploy status - 202
2020/03/10 18:18:55 viveksyngh-fn5 deployed successfully
buildStatus docker.io/viveksyngh/viveksyngh-openfaas-functions-fn5:latest-master-803874f 200 OK
2020/03/10 18:18:57 Duration: 7.342719 seconds
2020/03/10 18:18:59 Forking fprocess.
2020/03/10 18:18:59 Query
2020/03/10 18:18:59 Path  /
2020/03/10 18:18:59 0 env-vars for fn1
2020/03/10 18:18:59 0 env-vars for viveksyngh-fn1
2020/03/10 18:19:04 Image build status: 200
2020/03/10 18:19:04 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn1:latest-master-803874f'
2020/03/10 18:19:04 pipeline-log: status: 200
2020/03/10 18:19:04 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn1:latest-master-803874f as viveksyngh-fn1
Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn1:latest-master-803874f as viveksyngh-fn1

Deployed. 202 Accepted.
URL: http://gateway.openfaas:8080/function/viveksyngh-fn1

2020/03/10 18:19:04 Deploy status - 202
2020/03/10 18:19:04 viveksyngh-fn1 deployed successfully
buildStatus docker.io/viveksyngh/viveksyngh-openfaas-functions-fn1:latest-master-803874f 200 OK
2020/03/10 18:19:05 Duration: 6.297327 seconds
2020/03/10 18:19:07 Forking fprocess.
2020/03/10 18:19:07 Query
2020/03/10 18:19:07 Path  /
2020/03/10 18:19:07 0 env-vars for fn2
2020/03/10 18:19:07 0 env-vars for viveksyngh-fn2
2020/03/10 18:19:11 Image build status: 200
2020/03/10 18:19:11 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-803874f'
2020/03/10 18:19:11 pipeline-log: status: 200
2020/03/10 18:19:11 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-803874f as viveksyngh-fn2
2020/03/10 18:19:13 Duration: 6.113155 seconds
Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-803874f as viveksyngh-fn2

Deployed. 202 Accepted.
URL: http://gateway.openfaas:8080/function/viveksyngh-fn2

2020/03/10 18:19:11 Deploy status - 202
2020/03/10 18:19:11 viveksyngh-fn2 deployed successfully
buildStatus docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-803874f 200 OK
2020/03/10 18:19:14 Forking fprocess.
2020/03/10 18:19:14 Query
2020/03/10 18:19:14 Path  /
2020/03/10 18:19:14 0 env-vars for fn3
2020/03/10 18:19:14 0 env-vars for viveksyngh-fn3
2020/03/10 18:19:18 Image build status: 200
2020/03/10 18:19:18 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn3:latest-master-803874f'
2020/03/10 18:19:18 pipeline-log: status: 200
2020/03/10 18:19:18 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn3:latest-master-803874f as viveksyngh-fn3
Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn3:latest-master-803874f as viveksyngh-fn3

Deployed. 202 Accepted.
URL: http://gateway.openfaas:8080/function/viveksyngh-fn3

2020/03/10 18:19:18 Deploy status - 202
2020/03/10 18:19:18 viveksyngh-fn3 deployed successfully
2020/03/10 18:19:19 Duration: 5.222670 seconds
buildStatus docker.io/viveksyngh/viveksyngh-openfaas-functions-fn3:latest-master-803874f 200 OK
2020/03/10 18:19:20 Forking fprocess.
2020/03/10 18:19:20 Query
2020/03/10 18:19:20 Path  /
2020/03/10 18:19:26 Duration: 5.761246 seconds
2020/03/10 18:19:20 0 env-vars for fn4
2020/03/10 18:19:20 0 env-vars for viveksyngh-fn4
2020/03/10 18:19:24 Image build status: 200
2020/03/10 18:19:24 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn4:latest-master-803874f'
2020/03/10 18:19:24 pipeline-log: status: 200
2020/03/10 18:19:24 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn4:latest-master-803874f as viveksyngh-fn4
Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn4:latest-master-803874f as viveksyngh-fn4

Deployed. 202 Accepted.
URL: http://gateway.openfaas:8080/function/viveksyngh-fn4

2020/03/10 18:19:25 Deploy status - 202
2020/03/10 18:19:25 viveksyngh-fn4 deployed successfully
buildStatus docker.io/viveksyngh/viveksyngh-openfaas-functions-fn4:latest-master-803874f 200 OK
^C

Garbage collect run function

  ➜  openfaas-cloud git:(85f5f49) ✗ kubectl logs -f pods/garbage-collect-7bd6ff8476-wnv69 -n openfaas-fn
2020/03/10 15:47:00 Version: 0.18.1	SHA: b46be5a4d9d9d55da9c4b1e50d86346e0afccf2d
2020/03/10 15:47:00 Timeouts: read: 30s, write: 30s hard: 0s.
2020/03/10 15:47:00 Listening on port: 8080
2020/03/10 15:47:00 Writing lock-file to: /tmp/.lock
2020/03/10 15:47:00 Metrics listening on port: 8081
2020/03/10 15:50:17 Forking fprocess.
2020/03/10 15:50:17 Query
2020/03/10 15:50:17 Path  /
2020/03/10 15:50:18 Duration: 0.584882 seconds
2020/03/10 15:50:17 Functions owned by viveksyngh:
 viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions
Delete: viveksyngh-fn5
Removing old function.
Delete: viveksyngh-fn2
Removing old function.
Delete: viveksyngh-fn3
Removing old function.
Delete: viveksyngh-fn1
Removing old function.
Delete: viveksyngh-fn4
Removing old function.
Garbage collection ran for viveksyngh/openfaas-functions - 5 functions deleted.
2020/03/10 17:20:37 Forking fprocess.
2020/03/10 17:20:37 Query
2020/03/10 17:20:37 Path  /
2020/03/10 17:20:37 Functions owned by viveksyngh:
 viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions
Garbage collection ran for viveksyngh/openfaas-functions - 0 functions deleted.
2020/03/10 17:20:37 Duration: 0.056113 seconds
2020/03/10 17:45:40 Forking fprocess.
2020/03/10 17:45:40 Query
2020/03/10 17:45:40 Path  /
2020/03/10 17:45:40 Duration: 0.076545 seconds
2020/03/10 17:45:40 Functions owned by viveksyngh:
 viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions
Garbage collection ran for viveksyngh/openfaas-functions - 0 functions deleted.
2020/03/10 18:17:19 Forking fprocess.
2020/03/10 18:17:19 Query
2020/03/10 18:17:19 Path  /
2020/03/10 18:17:19 Functions owned by viveksyngh:
 viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions
Garbage collection ran for viveksyngh/openfaas-functions - 0 functions deleted.
2020/03/10 18:17:19 Duration: 0.206629 seconds
2020/03/10 18:19:26 Forking fprocess.
2020/03/10 18:19:26 Query
2020/03/10 18:19:26 Path  /
2020/03/10 18:19:27 Duration: 0.063836 seconds
2020/03/10 18:19:27 Functions owned by viveksyngh:
 viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions
Garbage collection ran for viveksyngh/openfaas-functions - 0 functions deleted.
2020/03/10 18:45:36 Forking fprocess.
2020/03/10 18:45:36 Query
2020/03/10 18:45:36 Path  /
2020/03/10 18:45:36 Duration: 0.623288 seconds
2020/03/10 18:45:36 Functions owned by viveksyngh:
 viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions, viveksyngh/openfaas-functions
Delete: viveksyngh-fn5
Removing old function.
Delete: viveksyngh-fn1
Removing old function.
Delete: viveksyngh-fn2
Removing old function.
Delete: viveksyngh-fn3
Removing old function.
Delete: viveksyngh-fn4
Removing old function.
Garbage collection ran for viveksyngh/openfaas-functions - 5 functions deleted.

@viveksyngh viveksyngh changed the title [WIP] Use CLI SDK for making openfaas calls [Tested] Use CLI SDK for making openfaas calls Mar 10, 2020
@alexellis
Copy link
Member

@Watetdrips please could you review?

Copy link
Contributor

@martindekov martindekov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Vivek, LGTM. Just wondering why we use fmt instead of log? I saw we use fmt in couple of places. Also commented out code can be removed if not used. Those are not blocking though so I approve 👍

buildshiprun/handler.go Outdated Show resolved Hide resolved
buildshiprun/handler.go Outdated Show resolved Hide resolved
garbage-collect/handler.go Outdated Show resolved Hide resolved
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, given the testing and approval from @martindekov

@alexellis alexellis merged commit 8c3defb into openfaas:master Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants