openfaas / nats-queue-worker

Queue-worker for OpenFaaS with NATS Streaming
https://docs.openfaas.com/reference/async/
MIT License
128 stars 59 forks source link

Remove warning message for basic auth #41

Closed viveksyngh closed 5 years ago

viveksyngh commented 6 years ago

This commit removes warning message when basic auth is not enabled and basic auth secrets are not passed.

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

Description

Motivation and Context

How Has This Been Tested?

Tested on local docker swarm cluster

Basic auth disabled for gatway and no secrets passed to queue worker.

func_queue-worker.1.eh3w76xgdp0f@linuxkit-025000000001    | [#1] Received on [faas-request]: 'sequence:1 subject:"faas-request" data:"{\"Header\":{\"Accept-Encoding\":[\"gzip\"],\"Content-Length\":[\"6\"],\"Content-Type\":[\"text/plain\"],\"User-Agent\":[\"Go-http-client/1.1\"],\"X-Call-Id\":[\"9edf1de4-f443-4271-80d6-e77addf4ff7d\"],\"X-Start-Time\":[\"1537816599406541631\"]},\"Host\":\"localhost:8080\",\"Body\":\"Vml2ZWsK\",\"Method\":\"POST\",\"Path\":\"\",\"QueryString\":\"\",\"Function\":\"figlet\",\"CallbackUrl\":null}" timestamp:1537816599407531060 '
func_queue-worker.1.eh3w76xgdp0f@linuxkit-025000000001    | Request for figlet.
func_queue-worker.1.eh3w76xgdp0f@linuxkit-025000000001    | Wrote 162 Bytes
func_queue-worker.1.eh3w76xgdp0f@linuxkit-025000000001    | 200 OK
func_queue-worker.1.eh3w76xgdp0f@linuxkit-025000000001    | Posting report - 200

Basic auth disabled and secrets passed to queue worker

func_queue-worker.1.ohwotv6new4t@linuxkit-025000000001    | [#1] Received on [faas-request]: 'sequence:2 subject:"faas-request" data:"{\"Header\":{\"Accept-Encoding\":[\"gzip\"],\"Content-Length\":[\"6\"],\"Content-Type\":[\"text/plain\"],\"User-Agent\":[\"Go-http-client/1.1\"],\"X-Call-Id\":[\"5a2cb4a5-3cc0-4e52-92ad-f79b380dce10\"],\"X-Start-Time\":[\"1537817181131051735\"]},\"Host\":\"localhost:8080\",\"Body\":\"Vml2ZWsK\",\"Method\":\"POST\",\"Path\":\"\",\"QueryString\":\"\",\"Function\":\"figlet\",\"CallbackUrl\":null}" timestamp:1537817181131629704 '
func_queue-worker.1.ohwotv6new4t@linuxkit-025000000001    | Request for figlet.
func_queue-worker.1.ohwotv6new4t@linuxkit-025000000001    | Wrote 162 Bytes
func_queue-worker.1.ohwotv6new4t@linuxkit-025000000001    | 200 OK
func_queue-worker.1.ohwotv6new4t@linuxkit-025000000001    | Posting report - 200

Basic auth enabled and secrets passed to queue worker

func_queue-worker.1.rugjmed1riei@linuxkit-025000000001    | [#1] Received on [faas-request]: 'sequence:3 subject:"faas-request" data:"{\"Header\":{\"Accept-Encoding\":[\"gzip\"],\"Content-Length\":[\"6\"],\"Content-Type\":[\"text/plain\"],\"User-Agent\":[\"Go-http-client/1.1\"],\"X-Call-Id\":[\"9bf3ced2-265f-4728-b9ab-8ce76be481b9\"],\"X-Start-Time\":[\"1537818186645166535\"]},\"Host\":\"localhost:8080\",\"Body\":\"Vml2ZWsK\",\"Method\":\"POST\",\"Path\":\"\",\"QueryString\":\"\",\"Function\":\"figlet\",\"CallbackUrl\":null}" timestamp:1537818186645611229 '
func_queue-worker.1.rugjmed1riei@linuxkit-025000000001    | Request for figlet.
func_queue-worker.1.rugjmed1riei@linuxkit-025000000001    | Wrote 162 Bytes
func_queue-worker.1.rugjmed1riei@linuxkit-025000000001    | 200 OK
func_queue-worker.1.rugjmed1riei@linuxkit-025000000001    | Posting report - 200

Basic auth enabled and no secrets passed to queue worker

func_queue-worker.1.uvhbvqox0and@linuxkit-025000000001    | [#1] Received on [faas-request]: 'sequence:4 subject:"faas-request" data:"{\"Header\":{\"Accept-Encoding\":[\"gzip\"],\"Content-Length\":[\"6\"],\"Content-Type\":[\"text/plain\"],\"User-Agent\":[\"Go-http-client/1.1\"],\"X-Call-Id\":[\"5d6b3040-543f-4cf3-9803-1ef4e15b03bb\"],\"X-Start-Time\":[\"1537818785440410448\"]},\"Host\":\"localhost:8080\",\"Body\":\"Vml2ZWsK\",\"Method\":\"POST\",\"Path\":\"\",\"QueryString\":\"\",\"Function\":\"figlet\",\"CallbackUrl\":null}" timestamp:1537818785440898243 '
func_queue-worker.1.uvhbvqox0and@linuxkit-025000000001    | Request for figlet.
func_queue-worker.1.uvhbvqox0and@linuxkit-025000000001    | Wrote 162 Bytes
func_queue-worker.1.uvhbvqox0and@linuxkit-025000000001    | 200 OK
func_queue-worker.1.uvhbvqox0and@linuxkit-025000000001    | Error with AddBasicAuth : Unable to read basic auth: unable to load /run/secrets/basic-auth-user
func_queue-worker.1.uvhbvqox0and@linuxkit-025000000001    | Posting report - 401

Types of changes

Checklist:

viveksyngh commented 5 years ago

The test result for updated code.

Basic auth enabled and secrets passed to queue worker

func_queue-worker.1.xp8h7xqhes2t@linuxkit-025000000001    | Loading basic authentication credentials
func_queue-worker.1.xp8h7xqhes2t@linuxkit-025000000001    | Wait for  15m0s
func_queue-worker.1.xp8h7xqhes2t@linuxkit-025000000001    | Listening on [faas-request], clientID=[faas-worker-6cbbb7c30394], qgroup=[faas] durable=[]

func_queue-worker.1.xp8h7xqhes2t@linuxkit-025000000001    | Request for figlet.
func_queue-worker.1.xp8h7xqhes2t@linuxkit-025000000001    | [#2] Received on [faas-request]: 'sequence:2 subject:"faas-request" data:"{\"Header\":{\"Accept-Encoding\":[\"gzip\"],\"Content-Length\":[\"6\"],\"Content-Type\":[\"text/plain\"],\"User-Agent\":[\"Go-http-client/1.1\"],\"X-Call-Id\":[\"e1203b09-7e01-4529-8d75-7b9fc6f3dfd8\"],\"X-Start-Time\":[\"1538502422464605769\"]},\"Host\":\"localhost:8080\",\"Body\":\"Vml2ZWsK\",\"Method\":\"POST\",\"Path\":\"\",\"QueryString\":\"\",\"Function\":\"figlet\",\"CallbackUrl\":null}" timestamp:1538502422465092917 '
func_queue-worker.1.xp8h7xqhes2t@linuxkit-025000000001    | Wrote 162 Bytes
func_queue-worker.1.xp8h7xqhes2t@linuxkit-025000000001    | 200 OK
func_queue-worker.1.xp8h7xqhes2t@linuxkit-025000000001    | Posting report - 200

Basic auth enabled and no secrets passed to queue worker

func_queue-worker.1.iutwqhv7p3lb@linuxkit-025000000001    | Loading basic authentication credentials
func_queue-worker.1.iutwqhv7p3lb@linuxkit-025000000001    | Error with LoadCredentials: Unable to read basic auth: unable to load /run/secrets/basic-auth-user
func_queue-worker.1.iutwqhv7p3lb@linuxkit-025000000001    | Wait for  15m0s
func_queue-worker.1.iutwqhv7p3lb@linuxkit-025000000001    | Listening on [faas-request], clientID=[faas-worker-92fce1014079], qgroup=[faas] durable=[]

func_queue-worker.1.iutwqhv7p3lb@linuxkit-025000000001    | [#1] Received on [faas-request]: 'sequence:1 subject:"faas-request" data:"{\"Header\":{\"Accept-Encoding\":[\"gzip\"],\"Content-Length\":[\"6\"],\"Content-Type\":[\"text/plain\"],\"User-Agent\":[\"Go-http-client/1.1\"],\"X-Call-Id\":[\"3a391e29-3cb2-4f06-8727-7d9c19fc95be\"],\"X-Start-Time\":[\"1538502684872997500\"]},\"Host\":\"localhost:8080\",\"Body\":\"Vml2ZWsK\",\"Method\":\"POST\",\"Path\":\"\",\"QueryString\":\"\",\"Function\":\"figlet\",\"CallbackUrl\":null}" timestamp:1538502684873805863 '
func_queue-worker.1.iutwqhv7p3lb@linuxkit-025000000001    | Request for figlet.
func_queue-worker.1.iutwqhv7p3lb@linuxkit-025000000001    | Wrote 162 Bytes
func_queue-worker.1.iutwqhv7p3lb@linuxkit-025000000001    | 200 OK
func_queue-worker.1.iutwqhv7p3lb@linuxkit-025000000001    | Posting report - 401

Basic auth disabled for gatway and no secrets passed to queue worker.

docker service logs -f func_queue-worker
func_queue-worker.1.tywfkl7yylc1@linuxkit-025000000001    | Wait for  15m0s
func_queue-worker.1.tywfkl7yylc1@linuxkit-025000000001    | Listening on [faas-request], clientID=[faas-worker-7d70bb89983c], qgroup=[faas] durable=[]

func_queue-worker.1.tywfkl7yylc1@linuxkit-025000000001    | [#1] Received on [faas-request]: 'sequence:1 subject:"faas-request" data:"{\"Header\":{\"Accept-Encoding\":[\"gzip\"],\"Content-Length\":[\"6\"],\"Content-Type\":[\"text/plain\"],\"User-Agent\":[\"Go-http-client/1.1\"],\"X-Call-Id\":[\"796e06b3-17de-4608-b22c-11bc2310cac1\"],\"X-Start-Time\":[\"1538504998745711642\"]},\"Host\":\"localhost:8080\",\"Body\":\"Vml2ZWsK\",\"Method\":\"POST\",\"Path\":\"\",\"QueryString\":\"\",\"Function\":\"figlet\",\"CallbackUrl\":null}" timestamp:1538504998746361774 '
func_queue-worker.1.tywfkl7yylc1@linuxkit-025000000001    | Request for figlet.
func_queue-worker.1.tywfkl7yylc1@linuxkit-025000000001    | Wrote 162 Bytes
func_queue-worker.1.tywfkl7yylc1@linuxkit-025000000001    | 200 OK
func_queue-worker.1.tywfkl7yylc1@linuxkit-025000000001    | Posting report - 200

Basic auth disabled and secrets passed to queue worker

docker service logs -f func_queue-worker
func_queue-worker.1.mzoar439z62h@linuxkit-025000000001    | Wait for  15m0s
func_queue-worker.1.mzoar439z62h@linuxkit-025000000001    | Listening on [faas-request], clientID=[faas-worker-1330e32b670b], qgroup=[faas] durable=[]

func_queue-worker.1.mzoar439z62h@linuxkit-025000000001    | Request for figlet.
func_queue-worker.1.mzoar439z62h@linuxkit-025000000001    | [#1] Received on [faas-request]: 'sequence:1 subject:"faas-request" data:"{\"Header\":{\"Accept-Encoding\":[\"gzip\"],\"Content-Length\":[\"6\"],\"Content-Type\":[\"text/plain\"],\"User-Agent\":[\"Go-http-client/1.1\"],\"X-Call-Id\":[\"2988ee8e-ccfe-4d36-a8b5-cc3e3cc2bc94\"],\"X-Start-Time\":[\"1538506101607786790\"]},\"Host\":\"localhost:8080\",\"Body\":\"Vml2ZWsK\",\"Method\":\"POST\",\"Path\":\"\",\"QueryString\":\"\",\"Function\":\"figlet\",\"CallbackUrl\":null}" timestamp:1538506101608498617 '
func_queue-worker.1.mzoar439z62h@linuxkit-025000000001    | Wrote 162 Bytes
func_queue-worker.1.mzoar439z62h@linuxkit-025000000001    | 200 OK
func_queue-worker.1.mzoar439z62h@linuxkit-025000000001    | Posting report - 200
alexellis commented 5 years ago

@viveksyngh please can you check all my review comments are addressed? I'll cut a release, please can you update the docker-compose.yml, helm chart and K8s YAML asap? cc @martindekov if you can get to it sooner.

alexellis commented 5 years ago

https://github.com/openfaas/nats-queue-worker/releases/tag/0.5.3