Skip to content

Fix read authorization_metadata_key from public_client_config in _refresh_credentials_from_command#1065

Merged
eapolinario merged 17 commits into
flyteorg:masterfrom
sonjaer:add-support-for-custom-auth-from-env-variables
Jun 16, 2022
Merged

Fix read authorization_metadata_key from public_client_config in _refresh_credentials_from_command#1065
eapolinario merged 17 commits into
flyteorg:masterfrom
sonjaer:add-support-for-custom-auth-from-env-variables

Conversation

@sonjaer

@sonjaer sonjaer commented Jun 15, 2022

Copy link
Copy Markdown
Contributor

TL;DR

FLYTE_CREDENTIALS_AUTHORIZATION_METADATA_KEY environment variable was removed in this PR #858 in favor of reading the authorization metadata key from Admin.

There was a miss in the PR where the _refresh_credentials_from_command did not switch to get the authorization key from self.public_client_config.authorization_metadata_key but instead used the default value authorization.

Spotify uses flyte-authorization so we received an error about calls being UNAUTHENTICATED since the header name didn't correspond to the one expected by admin.

This PR adds support for reading authorization_metadata_key from public_client_config in _refresh_credentials_from_command

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

Tracking Issue

https://github.com/flyteorg/flyte/issues/

Follow-up issue

NA
OR
https://github.com/flyteorg/flyte/issues/

Comment thread flytekit/clis/flyte_cli/main.py Outdated
sonjaer and others added 4 commits June 15, 2022 11:09
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Comment thread flytekit/configuration/internal.py Outdated
sonjaer added 2 commits June 15, 2022 11:30
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
@codecov

codecov Bot commented Jun 15, 2022

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 86.52%. Comparing base (14b3a4c) to head (af9b033).
Report is 1057 commits behind head on master.

Files Patch % Lines
flytekit/clients/raw.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1065      +/-   ##
==========================================
+ Coverage   86.51%   86.52%   +0.01%     
==========================================
  Files         268      268              
  Lines       24864    24893      +29     
  Branches     2799     2803       +4     
==========================================
+ Hits        21510    21539      +29     
+ Misses       2877     2875       -2     
- Partials      477      479       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

sonjaer and others added 4 commits June 15, 2022 12:49
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
@sonjaer sonjaer changed the title Add support for custom auth from env Add support for configuring custom auth from environment variables Jun 15, 2022
sonjaer added 3 commits June 15, 2022 16:37
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

@eapolinario eapolinario left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this fix, the change to pass the authorization key in the case of external commands was missing.

Comment thread flytekit/clients/raw.py
Comment thread flytekit/clients/raw.py Outdated
Comment thread tests/flytekit/unit/clients/test_raw.py Outdated
sonjaer added 3 commits June 16, 2022 10:33
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
@sonjaer sonjaer changed the title Add support for configuring custom auth from environment variables Add support for reading authorization_metadata_key form public_client_config in custom auth from external process Jun 16, 2022
@sonjaer sonjaer changed the title Add support for reading authorization_metadata_key form public_client_config in custom auth from external process Add support for reading authorization_metadata_key form public_client_config in _refresh_credentials_from_command Jun 16, 2022
@sonjaer sonjaer changed the title Add support for reading authorization_metadata_key form public_client_config in _refresh_credentials_from_command Add support for reading authorization_metadata_key from public_client_config in _refresh_credentials_from_command Jun 16, 2022
@sonjaer sonjaer changed the title Add support for reading authorization_metadata_key from public_client_config in _refresh_credentials_from_command Fix read authorization_metadata_key from public_client_config in _refresh_credentials_from_command Jun 16, 2022
Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
@sonjaer

sonjaer commented Jun 16, 2022

Copy link
Copy Markdown
Contributor Author

@eapolinario what takes precedence from config, env and passing a flag?

@eapolinario

Copy link
Copy Markdown
Collaborator

@eapolinario what takes precedence from config, env and passing a flag?

flyte-cli rules are a bit more complicated, but in general, for configuration settings, environment variables take precedence over config data, with the exception of the host and insecure flags.

@eapolinario eapolinario merged commit ed048c8 into flyteorg:master Jun 16, 2022
@sonjaer sonjaer deleted the add-support-for-custom-auth-from-env-variables branch June 17, 2022 09:20
eapolinario pushed a commit that referenced this pull request Jun 17, 2022
…resh_credentials_from_command (#1065)

* add support for custom auth from env

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* Update flytekit/clis/flyte_cli/main.py

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* Update test_raw.py

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>

* fix

Signed-off-by: Sonja Ericsson <sonjae@spotify.com>
@eapolinario eapolinario mentioned this pull request Jun 17, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants