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

Log when using default authentication container name #1526

Merged
merged 2 commits into from
May 6, 2020

Conversation

orenbm
Copy link
Member

@orenbm orenbm commented May 6, 2020

Connected to conjurinc/dap-support#69

If the annotation authentication-container-name is missing in
the host's annotations then we use a default value authenticator.

It can be helpful to the user to see this behaviour in the log. We already
log that an annotation was used to get this value
(e.g Retrieved value of annotation {authn-k8s/authentication-container-name}
but now we can also see that the default value is used.

@orenbm
Copy link
Member Author

orenbm commented May 6, 2020

@shulifink can you approve the following message:

  • Annotation '{0-authentication-container-annotation-name}' not found. Using default value '{1-default-authentication-container}'

For example, `Annotation 'authentication-container-name' not found. Using default value 'authenticator'

@orenbm orenbm self-assigned this May 6, 2020
@orenbm orenbm requested review from sigalsax and jonahx May 6, 2020 09:38
@orenbm orenbm force-pushed the enhance-log-auth-container branch from 40f3729 to f26efbb Compare May 6, 2020 09:47
@orenbm orenbm added this to the PalmTree - sprint 2010 milestone May 6, 2020
@orenbm orenbm requested review from shulifink and removed request for jonahx May 6, 2020 11:13
@orenbm orenbm force-pushed the enhance-log-auth-container branch 2 times, most recently from 42bb21d to 3b0e4dc Compare May 6, 2020 11:17
@orenbm orenbm force-pushed the enhance-log-auth-container branch from 3b0e4dc to c7f32e9 Compare May 6, 2020 13:32
@orenbm orenbm removed the request for review from sigalsax May 6, 2020 13:33
@@ -22,6 +22,9 @@ module AuthnK8s
# validation of ValidateApplicationIdentity
class ApplicationIdentity

AUTHENTICATION_CONTAINER_NAME_ANNOTATION = "authentication-container-name"
Copy link

Choose a reason for hiding this comment

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

Freeze mutable objects assigned to constants.

@@ -22,6 +22,9 @@ module AuthnK8s
# validation of ValidateApplicationIdentity
class ApplicationIdentity

AUTHENTICATION_CONTAINER_NAME_ANNOTATION = "authentication-container-name"
DEFAULT_AUTHENTICATION_CONTAINER_NAME = "authenticator"
Copy link

Choose a reason for hiding this comment

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

Freeze mutable objects assigned to constants.

default_authentication_container_name
end

def default_authentication_container_name
Copy link

Choose a reason for hiding this comment

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

Authentication::AuthnK8s::ApplicationIdentity#default_authentication_container_name doesn't depend on instance state (maybe move it to another class?)

@orenbm orenbm force-pushed the enhance-log-auth-container branch from c7f32e9 to c2f44ee Compare May 6, 2020 13:51
@@ -22,6 +22,9 @@ module AuthnK8s
# validation of ValidateApplicationIdentity
class ApplicationIdentity

AUTHENTICATION_CONTAINER_NAME_ANNOTATION = "authentication-container-name".freeze
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine, but FYI you can also denote all string literals in the file as frozen by adding:

# frozen_string_literal: true

to the top of the file.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh nice, didn't know that. I'll change it and push again.

@orenbm orenbm force-pushed the enhance-log-auth-container branch from c2f44ee to 248829d Compare May 6, 2020 14:03
@jonahx
Copy link
Contributor

jonahx commented May 6, 2020

@orenbm Just noticed this:

https://github.com/cyberark/conjur/blob/248829dee1f72275dc799270f1f4dcef07bd4244/app/domain/logs.rb#L175

I like this method of line breaking long strings, but in the above it will print at “notcall” instead of “not call”. I’ve been standardizing on always adding the space to the line above.

@orenbm
Copy link
Member Author

orenbm commented May 6, 2020

thanks @jonahx, i fixed some other messages while i'm at it.

orenbm added 2 commits May 6, 2020 18:00
If the annotation `authentication-container-name` is missing in
the host's annotations then we use a default value `authenticator`.

It can be helpful to the user to see this behaviour in the log. We already
log that an annotation was used to get this value
(e.g `Retrieved value of annotation {authn-k8s/authentication-container-name}`
but now we can also see that the default value is used.
@orenbm orenbm force-pushed the enhance-log-auth-container branch from 467750d to 2b9f679 Compare May 6, 2020 15:00
@codeclimate
Copy link

codeclimate bot commented May 6, 2020

Code Climate has analyzed commit 2b9f679 and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2

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 85.4% (0.0% change).

View more on Code Climate.

@orenbm orenbm merged commit cc532b9 into master May 6, 2020
@orenbm orenbm deleted the enhance-log-auth-container branch May 6, 2020 17:47
@shulifink
Copy link
Contributor

@shulifink can you approve the following message:

  • Annotation '{0-authentication-container-annotation-name}' not found. Using default value '{1-default-authentication-container}'

For example, `Annotation 'authentication-container-name' not found. Using default value 'authenticator'

@orenbm - approved!

Copy link
Contributor

@shulifink shulifink left a comment

Choose a reason for hiding this comment

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

approved message

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.

4 participants