-
Notifications
You must be signed in to change notification settings - Fork 125
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Authentication | ||
module AuthnK8s | ||
|
||
|
@@ -22,6 +24,9 @@ module AuthnK8s | |
# validation of ValidateApplicationIdentity | ||
class ApplicationIdentity | ||
|
||
AUTHENTICATION_CONTAINER_NAME_ANNOTATION = "authentication-container-name" | ||
DEFAULT_AUTHENTICATION_CONTAINER_NAME = "authenticator" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Freeze mutable objects assigned to constants. |
||
|
||
def initialize(host_id:, host_annotations:, service_id:) | ||
@host_id = host_id | ||
@host_annotations = host_annotations | ||
|
@@ -45,11 +50,21 @@ def constraints | |
end | ||
|
||
def container_name | ||
annotation_name = "authentication-container-name" | ||
annotation_value("authn-k8s/#{@service_id}/#{annotation_name}") || | ||
annotation_value("authn-k8s/#{annotation_name}") || | ||
annotation_value("kubernetes/#{annotation_name}") || | ||
"authenticator" | ||
@container_name ||= annotation_value("authn-k8s/#{@service_id}/#{AUTHENTICATION_CONTAINER_NAME_ANNOTATION}") || | ||
annotation_value("authn-k8s/#{AUTHENTICATION_CONTAINER_NAME_ANNOTATION}") || | ||
annotation_value("kubernetes/#{AUTHENTICATION_CONTAINER_NAME_ANNOTATION}") || | ||
default_authentication_container_name | ||
end | ||
|
||
def default_authentication_container_name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?) |
||
Rails.logger.debug( | ||
LogMessages::Authentication::ContainerNameAnnotationDefaultValue.new( | ||
AUTHENTICATION_CONTAINER_NAME_ANNOTATION, | ||
DEFAULT_AUTHENTICATION_CONTAINER_NAME | ||
) | ||
) | ||
|
||
DEFAULT_AUTHENTICATION_CONTAINER_NAME | ||
end | ||
|
||
# returns true if the only constraint is on the namespace, false otherwise | ||
|
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.
Freeze mutable objects assigned to constants.