Skip to content

Conversation

welteki
Copy link
Member

@welteki welteki commented Jan 26, 2022

Solves edge case where basic auth fails for function statistics post back to
the gateway when the basic_auth env variable is set to “1”.

Description

Use config.BasicAuth instead of checking the env_var in the postReport function.

Motivation and Context

How Has This Been Tested?

Installed openfaas using kind and arkade.
Updated the queue-worker deployment.

kubectl edit deploy/queue-worker -n openfaas

changes:

template:
  spec:
    containers:
    - env:
      - name: gateway_invoke
        value: "false"
      - name: basic_auth
        value: "1"
      image: welteki/queue-worker:async-report

Deployed figlet from the store and invoked it async.
Logs for the queue-worker:

[#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\":[\"9a9c9817-6436-47a3-8329-40023db9a14e\"],\"X-Start-Time\":[\"1643187927333584634\"]},\"Host\":\"127.0.0.1:8080\",\"Body\":\"YXN5bmMK\",\"Method\":\"POST\",\"Path\":\"\",\"QueryString\":\"\",\"Function\":\"figlet\",\"QueueName\":\"\",\"CallbackUrl\":null}" timestamp:1643187927345634173 '
[#1] Invoking: figlet with 6 bytes, via: http://figlet.openfaas-fn.svc.cluster.local:8080/
[#1] Invoked: figlet [200] in 0.198375s
[#1] figlet returned 174 bytes
[#1] Posting report for figlet, status: 202

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Solves edge case where basic auth fails for function statistics post back to
the gateway when the basic_auth env variable is set to “1”.

Signed-off-by: Han Verstraete <welteki@pm.me>
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.

@alexellis alexellis merged commit 369198f into openfaas:master Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants