Skip to content
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

Bump authn-k8s, conjur-api-go, summon and other dependencies #1446

Merged
merged 4 commits into from
Jan 14, 2022
Merged

Conversation

szh
Copy link
Contributor

@szh szh commented Jan 13, 2022

Desired Outcome

  • Use the latest versions of conjur-authn-k8s-client with support for JWT and tracing.
  • Use the latest version of other dependencies.

Implemented Changes

  • Updated versions of dependencies
  • Modified internal/providers/conjur/provider.go to use the new authn flow that supports JWT
  • Added go:build ignore flags to sample CRD go files to avoid compilation errors. These files are provided for documentation purposes and are not meant to be compiled with the project.

Connected Issue/Story

CyberArk internal issue link: ONYX-16170

Definition of Done

  • Using latest version of cyberark dependencies
  • All tests pass

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

@szh szh marked this pull request as ready for review January 13, 2022 15:12
@szh szh requested a review from a team as a code owner January 13, 2022 15:12
@szh szh changed the title Bump authn k8s Bump authn-k8s, conjur-api-go, summon and other dependencies Jan 13, 2022
tzheleznyak
tzheleznyak previously approved these changes Jan 13, 2022
Copy link
Contributor

@tzheleznyak tzheleznyak left a comment

Choose a reason for hiding this comment

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

LGTM

@szh
Copy link
Contributor Author

szh commented Jan 13, 2022

Waiting to update until new authn-k8s-client is released

go.mod Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
Copy link
Contributor

@diverdane diverdane left a comment

Choose a reason for hiding this comment

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

Looks great!!! Thanks to you and @tzheleznyak for getting this moving along!
A couple of suggestions, but your call on those.

@@ -97,10 +95,17 @@ func ProviderFactory(options plugin_v1.ProviderOptions) (plugin_v1.Provider, err
log.Printf("Info: Conjur provider using Kubernetes authenticator-based authentication")

// Load the authenticator with the config from the environment, and log in to Conjur
if authenticator, err = loadAuthenticator(provider.AuthnURL, provider.Version, provider.Config); err != nil {
conjurAuthenticatorConf, err = authnConfig.NewConfigFromEnv()
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you're making changes in this section of the code... This may be a personal preference sort of thing, but instead of using a but instead of bunch of if...if-else...if-else statements, we could use a switch:

switch {
case provider.Username != "" && provider.APIKey != "":
    // Conjur provider using API key. Do stuff
case tokenFile != "":
    // Conjur provider using access token. Do stuff
case provider.AuthnURL != "" && strings.Contains(provider.AuthnURL, "authn-k8s"):
    // Conjur provider using authenticator. Do stuff
default:
    // Return error
}

For me, the switch is easier to see what's going on, but your call, don't want to hold up on this.

Copy link
Contributor Author

@szh szh Jan 14, 2022

Choose a reason for hiding this comment

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

Looking at the Effective Go style guide:

It's therefore possible—and idiomatic—to write an if-else-if-else chain as a switch

So I'll make this change

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, it's much easier to read!

### Changed
- Use latest version of conjur-authn-k8s-client which supports JWT loging and tracing.
[cyberark/secretless-broker#1446](https://github.com/cyberark/secretless-broker/pull/1446)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we should include a CHANGELOG.md entry to say that we bumped K8s API version to 1.23.
This might be considered a user-facing change, since it affects in which Kubernetes clusters the SP can be run.
(Although this may only affect users who are using CRD/CRs to configure the SP... since I think that's why we're depending on Kubernetes API client and machinery?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it only affect CRDs

@@ -22,10 +22,10 @@ require (
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.22.3
k8s.io/api v0.23.1
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice work. These K8s updates are always so tricky.

@szh szh requested a review from diverdane January 14, 2022 17:04
@codeclimate
Copy link

codeclimate bot commented Jan 14, 2022

Code Climate has analyzed commit 5adc53c and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Style 1

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 54.8% (0.0% change).

View more on Code Climate.

Copy link
Contributor

@diverdane diverdane left a comment

Choose a reason for hiding this comment

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

LGTM!!!

@@ -97,10 +95,17 @@ func ProviderFactory(options plugin_v1.ProviderOptions) (plugin_v1.Provider, err
log.Printf("Info: Conjur provider using Kubernetes authenticator-based authentication")

// Load the authenticator with the config from the environment, and log in to Conjur
if authenticator, err = loadAuthenticator(provider.AuthnURL, provider.Version, provider.Config); err != nil {
conjurAuthenticatorConf, err = authnConfig.NewConfigFromEnv()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, it's much easier to read!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants