Skip to content

Update exec.go if needs a token #33

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

Merged
merged 1 commit into from
Jun 4, 2023
Merged

Update exec.go if needs a token #33

merged 1 commit into from
Jun 4, 2023

Conversation

Like0x
Copy link
Contributor

@Like0x Like0x commented Jun 4, 2023

Desired Outcome

Update exec.go if needs a token

Implemented Changes

This is configured using the GlobalBearerToken global variable

Connected Issue/Story

null

Definition of Done

At least 1 todo must be completed in the sections below for the PR to be
merged.

Changelog

  • The CHANGELOG has been updated, or
  • This PR does not include user-facing changes and doesn't require a
    CHANGELOG update

Test coverage

  • This PR includes new unit and integration tests to go with the code
    changes, or
  • The changes in this PR do not require tests

Documentation

  • Docs (e.g. READMEs) were updated in this PR
  • A follow-up issue to update official docs has been filed here: [insert issue ID]
  • This PR does not require updating any documentation

Behavior

  • This PR changes product behavior and has been reviewed by a PO, or
  • These changes are part of a larger initiative that will be reviewed later, or
  • No behavior was changed with this PR

Security

  • Security architect has reviewed the changes in this PR,
  • These changes are part of a larger initiative with a separate security review, or
  • There are no security aspects to these changes

@g3rzi
Copy link
Collaborator

g3rzi commented Jun 4, 2023

I am thinking maybe moving it to the InitHttpClient, because there are already similar check

if config != nil && config.BearerToken != "" {
GlobalBearerToken = config.BearerToken
}

@g3rzi g3rzi merged commit f2d1bf3 into cyberark:master Jun 4, 2023
@g3rzi
Copy link
Collaborator

g3rzi commented Jun 4, 2023

Thank you for your contribution :)

@Like0x
Copy link
Contributor Author

Like0x commented Jun 4, 2023

I am thinking maybe moving it to the InitHttpClient, because there are already similar check

if config != nil && config.BearerToken != "" {
GlobalBearerToken = config.BearerToken
}

I found that --token-file parameter did not work properly on the authenticated 10250 port. So I observed the code and found that the config variable was re-assigned in exec.go. It did not inherit the previous configuration. So it did not carry the token. Since I am not very familiar with the project, I found that GlobalBearerToken can be used as a temporary judgment basis. If there is a better way, you can make modifications.

https://github.com/Like0x/kubeletctl/blob/173e12de55d46d0708e0627d303d6434846c36db/pkg/api/exec.go#L34-L43

@g3rzi
Copy link
Collaborator

g3rzi commented Jun 4, 2023

Thank you for your clarification.
For now, I merged your solution, and it looks good.
But maybe in the future, we will need to do some modifications so it will be before the function.

Thanks again, I appreciate your contribution

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