Skip to content

Support Custom Key for Authentication Secret #12993

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

Open
gkoppura-github opened this issue Mar 17, 2025 · 3 comments
Open

Support Custom Key for Authentication Secret #12993

gkoppura-github opened this issue Mar 17, 2025 · 3 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@gkoppura-github
Copy link

gkoppura-github commented Mar 17, 2025

Currently, the NGINX Ingress Controller requires the basic authentication secret to have the key auth. However, some environments enforce strict secret structures where the authentication data is stored under a different key (e.g., token).

There is no built-in way to specify a custom key for authentication, making it difficult to integrate with systems that do not allow modifying secret keys.

Request:

Please add support for a custom key in the authentication secret via an annotation such as:

nginx.ingress.kubernetes.io/auth-secret-key: "token"

This would allow users to specify the exact key inside the secret instead of being forced to use auth.

Use Case:

Some enterprise environments enforce specific secret formats where credentials are stored under a predefined key (e.g., token).
Current workarounds require additional automation (e.g., init containers or external services), which adds operational overhead.
Allowing a configurable secret key would improve flexibility without breaking existing implementations.

Expected Behavior:
If the annotation nginx.ingress.kubernetes.io/auth-secret-key is set, the NGINX Ingress Controller should look for the specified key inside the secret instead of the default auth key.

Example Usage:

kind: Ingress
metadata:
  name: my-ingress
  annotations:
    nginx.ingress.kubernetes.io/auth-type: "basic"
    nginx.ingress.kubernetes.io/auth-secret: "my-auth-secret"
    nginx.ingress.kubernetes.io/auth-secret-key: "token"  # New annotation request
    nginx.ingress.kubernetes.io/auth-realm: "Authentication Required"

This would instruct the Ingress controller to look for credentials under the token key instead of auth.

Current Workarounds (Not Ideal):

Creating a new secret manually with the correct key.
Using an init container to copy the secret and rename the key dynamically.
Implementing an external authentication service.

Adding this feature would simplify integration and improve usability.

@gkoppura-github gkoppura-github added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 17, 2025
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Mar 17, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@strongjz
Copy link
Member

Please read more about the project status here #13002

Copy link

This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach #ingress-nginx-dev on Kubernetes Slack.

@github-actions github-actions bot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
Development

No branches or pull requests

3 participants