-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Update configuration on add-headers and proxy-set-headers ConfigMap change #5238
Comments
Thanks for raising this issue! What's the appropriate way to handle those kind of issues in a production environment? Thank you! |
Does it happen even if you use
|
It does not matter how you change the configmap. The functionality does not exist to re-read the configmap. This is a known situation as described in the previous issue where @aledbf requested a new issue (this one). The pods can be restarted, but this feature is to remove that limitation. Looking forward to |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Guys, what is the workaround for this? I'm hitting this at the moment, and the only way to effect the change is to restart pods. Which is kinda not cool for production, yes? |
OK for those using terraform, I found a workaround. The idea is run this command if the values of add-headers changed: kubectl --namespace ingress rollout restart deployment nginx-ingress-controller Now in Terraform, the hack is like this: First, declare headers a s var. locals {
ingress_add_headers_yaml = jsonencode({
"X-Cluster" = "${local.cluster_dns_fqdn}"
"X-Test" = "this is test 4"
})
} Then do the regular helm thing: resource "helm_release" "ingress" {
name = "nginx-ingress"
namespace = kubernetes_namespace.ingress.metadata[0].name
repository = "https://kubernetes-charts.storage.googleapis.com"
chart = "nginx-ingress"
version = "1.41.2"
# Use addHeaders defined in a var
values = [
<<-EOF
controller:
addHeaders: ${local.ingress_add_headers_yaml}
EOF
]
} And finally, do a shell exec to reload things. Note that this will only run if there are changes in the header. resource "null_resource" "ingress-reload-changes-in-add-headers" {
depends_on = [
helm_release.ingress,
]
triggers = {
run_if_changed = sha256(local.ingress_add_headers_yaml)
cluster_context_name = local.cluster_context_name
comment = "it is safe to replace this every time in terraform"
ingress_add_headers_yaml = local.ingress_add_headers_yaml
ingress_namespace = kubernetes_namespace.ingress.metadata[0].name
}
provisioner "local-exec" {
# kubectl --namespace ingress rollout restart deployment nginx-ingress-controller
command = "kubectl --context '${self.triggers.cluster_context_name}' --namespace '${self.triggers.ingress_namespace}' rollout restart deployment nginx-ingress-controller"
}
} Not ideal but kinda works. And it would be nice to have config reload as part of the core functionality so people don't have to hack around it. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
/remove-lifecycle stale |
I am having this problem now. I add headers to configmap and the pod restart doesn't update the changes to nginx.conf. Another observation is when multiple add_header statement to configmap and only one is retained on saving the changes. |
@rohitagarwal003 and @hobti01 what version of k8s and inigress-nginx are you using? Does this issue still exist in v0.48.1? Thanks /triage needs-information |
Hi @strongjz , please see the discussion in the PR that was to implement code for this and was not implemented #4030 @aledbf requested that I open a new issue (this one) to capture the result of the previous issue (enhancement request) that has a PR that was not merged. I'm not aware that the logic has ever been implemented, therefore it would never have been working. Therefore... the versions are irrelevant unless you can point to an implementation :) |
Hi, As stated in #4030 the implementation should be more simple than that, but we have no intent right now of prioritizing this due to:
I'm open to reviewing some simpler implementation, but right now I don't think we can deal with this, so the issue will be a backlog for medium to long term. |
/help |
@iamNoah1: GuidelinesPlease ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met. If this request no longer meets these requirements, the label can be removed In response to this:
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/test-infra repository. |
/triage-accepted |
/triage accepted |
This should be removed if kubernetes#5238 is fixed.
* clarify link * Add section headers * console blocks * grpc example json was not valid * multi-tls update text The preceding point 1 related to https://github.com/kubernetes-retired/contrib/blob/4f2cb51ef82b4dddb625f6053ad132c1faf07aa1/ingress/controllers/nginx/examples/ingress.yaml and the deployments referenced in https://github.com/kubernetes-retired/contrib/blob/4f2cb51ef82b4dddb625f6053ad132c1faf07aa1/ingress/controllers/nginx/examples/README.md They are not relevant to the current instructions. * add whitespace around parens * grammar setup would be a proper noun, but it is not the intended concept, which is a state * grammar * is-only * via * Use bullets for choices * ingress-controller nginx is a distinct brand. generally this repo talks about ingress-controller, although it is quite inconsistent about how... * drop stray paren * OAuth is a brand and needs an article here also GitHub is a brand * Indent text under numbered lists * use e.g. * Document that customer header config maps changes do not trigger updates This should be removed if #5238 is fixed. * article * period * infinitive verb + period * clarify that the gRPC server is responsible for listening for TCP traffic and not some other part of the backend application * avoid using ; and reword * whitespace * brand: gRPC * only-does is the right form `for` adds nothing here * spelling: GitHub * punctuation `;` is generally not the right punctuation... * drop stray `to` * sentence * backticks * fix link * Improve readability of compare/vs * Renumber list * punctuation * Favor Ingress-NGINX and Ingress NGINX * Simplify custom header restart text * Undo typo damage Co-authored-by: Josh Soref <[email protected]>
Bump bump. Almost celebrating a 2 year anniversary -- time flies in lockdown! 😀 Would be nice to have a "fix" at some point. 😀 |
maybe you want to delete the one pod and check the changes |
@alokhom @ppanyukov we are super happy for any contributions :) |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
I notice that this is labeled /remove-lifecycle stale |
* clarify link * Add section headers * console blocks * grpc example json was not valid * multi-tls update text The preceding point 1 related to https://github.com/kubernetes-retired/contrib/blob/4f2cb51ef82b4dddb625f6053ad132c1faf07aa1/ingress/controllers/nginx/examples/ingress.yaml and the deployments referenced in https://github.com/kubernetes-retired/contrib/blob/4f2cb51ef82b4dddb625f6053ad132c1faf07aa1/ingress/controllers/nginx/examples/README.md They are not relevant to the current instructions. * add whitespace around parens * grammar setup would be a proper noun, but it is not the intended concept, which is a state * grammar * is-only * via * Use bullets for choices * ingress-controller nginx is a distinct brand. generally this repo talks about ingress-controller, although it is quite inconsistent about how... * drop stray paren * OAuth is a brand and needs an article here also GitHub is a brand * Indent text under numbered lists * use e.g. * Document that customer header config maps changes do not trigger updates This should be removed if kubernetes#5238 is fixed. * article * period * infinitive verb + period * clarify that the gRPC server is responsible for listening for TCP traffic and not some other part of the backend application * avoid using ; and reword * whitespace * brand: gRPC * only-does is the right form `for` adds nothing here * spelling: GitHub * punctuation `;` is generally not the right punctuation... * drop stray `to` * sentence * backticks * fix link * Improve readability of compare/vs * Renumber list * punctuation * Favor Ingress-NGINX and Ingress NGINX * Simplify custom header restart text * Undo typo damage Co-authored-by: Josh Soref <[email protected]>
This issue has not been updated in over 1 year, and should be re-triaged. You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
This issue is currently awaiting triage. If Ingress contributors determines this is a relevant issue, they will accept it by applying the The 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/test-infra repository. |
When the ConfigMap specified in add-headers or proxy-set-headers is modified, the nginx configuration should be updated.
Current behavior is to not update nginx configuration when the referenced ConfigMap is modified. This leads to unexpected results when headers are added/modified in the ConfigMap and no change is realized in the running instances. Restarting instances results in a reload of the configuration, but this is not desired.
Previously raised in #3868
/kind feature
The text was updated successfully, but these errors were encountered: