-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhancement: Add token based auth as alternative to basic-auth for http requests. #192
base: master
Are you sure you want to change the base?
Conversation
I cannot label the PR, but it is an enhancement. |
Would you be able to add a test for your scenario? |
Fixed description on auth mechanism
fixed linebreak
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really wished for a test case ;)
Not sure about the currently implemented test concept. Implementing it will cost more time on my end, until I understood it. |
There's no real test concept. What we have right now is a e2e test using Kind and a longish bash script whose exit code is relevant for fail or pass. Adding a test case would mean to adapt the script accordingly or introduce a sound test concept. I'd be ok with either. |
I do not exactly know how to test it locally, but I think I got the general concept. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, thank you for your contribution! Approving already but do you think a negative test for wrong api key would be worth the effort?
test/resources/sidecar.yaml
Outdated
volumeMounts: | ||
- name: shared-volume | ||
mountPath: /tmp/ | ||
- name: script-volume |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need the script here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. removed the script
test/resources/sidecar.yaml
Outdated
value: /tmp/ | ||
- name: RESOURCE | ||
value: both | ||
- name: SCRIPT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. removed the script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also switched resource to configmap
test/resources/sidecar.yaml
Outdated
volumes: | ||
- name: shared-volume | ||
emptyDir: {} | ||
- name: script-volume |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. removed the script
test/server/server.py
Outdated
@@ -27,3 +38,9 @@ async def read_item(): | |||
@app.post("/503", status_code=503) | |||
async def read_item(): | |||
return 503 | |||
|
|||
|
|||
@app.get("/200/api_key") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add another endpoint with a different API key so we can add a negative test case as well? That would be awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a new container with wrong credentials/secret and used the same endpoint
@jansalapatek it seems the test breaks: https://github.com/kiwigrid/k8s-sidecar/runs/6875936389?check_suite_focus=true |
I think we only need to get the build green before merging/releasing. |
It seems, the test file is not present in the pod, but I do not know where to download the pod logs to check, why. |
Can you run the build pipe once more? thx! |
Build failed, because python image could not be fetched from registry :-/ server had a 503. |
New build running... ... and failing. @jansalapatek please investigate. You can download the pods log from the action summary page (can you?) |
Added two new variables to manage token based authentication which for example is required for using k8s-sidecar with git(lab), since it does not support basic-auth.