Merged
Conversation
vmelikyan
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
nginx-controller consuming a lot of memory and OOMKills
Root Cause:
#in PR value corrupts nginx-ingresscleanConfdepth trackingThe nginx-ingress controller generates
nginx.confby rendering a Go template and then post-processing it through a function calledcleanConf. This function re-indents the config by tracking brace depth — it increments depth on{and decrements on}, writing that many tabs at the start of each line.Critical flaw:
cleanConftreats#as a comment character in all contexts (it has no awareness of nginx string literals). Once it encounters#, it enters comment mode for the rest of that line — meaning any{or}characters after the#are ignored for depth tracking.The
ingressBannerSnippetfunction generated aconfiguration-snippetcontaining:On the single long line containing the JSON array, the sequence is:
When
cleanConfhits#inside"value":"#20845", it stops counting braces for the rest of the line. The{that opened the PR object is counted, but its matching}and all subsequent{}pairs (sha,branch,service name,build) are not counted. This leaves the depth counter permanently+1after each such location block is processed.Impact
nginx.confgrew to 35MB (vs. a normal <1MB)This explains why the old cluster handled 500+ ingresses within 1Gi but this cluster could not — the old cluster did not have lifecycle environment ingresses with this
#-in-value pattern at this scale.Fix
Remove the
#prefix from the PR value in the LFC_BANNER JSON:The PR number without
#is still meaningful since the full PR URL is already present in theurlfield. This eliminates the#character from the nginx snippet entirely, preventingcleanConffrom entering comment mode mid-line.Verification
After this change is deployed, the
nginx.confsize should drop from ~35MB back to a normal range (<2MB), and memory usage per pod should stabilize well below 1Gi even during reloads.