fix: heap sizing and signing policy changes without a CA restart (#592, #588) - #593
Merged
Merged
Conversation
resolveJavaArgs sizes the JVM heap at 90 percent of the pod's memory limit when javaArgs is unset. The CRD default made that unreachable: the field was never empty, the explicit branch always won, and every Server ran with -Xms512m -Xmx1024m no matter how much memory it was given. A Server with 8Gi used 1Gi of it. Third instance of one mistake after #550 and #576. A nested or plain default removes the empty state a fallback depends on, so the default belongs in the chart where it is visible, not in the CRD where it disables code. The existing unit tests did not catch this and could not: they call resolveJavaArgs directly and therefore pass whether or not the field can ever be empty in a real cluster. Added the round-trip through the API server instead, which fails against the old CRD with the materialised value in the message. Restores the auto-tuning statement in the README and the feature list, which I had corrected to match the broken behaviour rather than the intended one. Closes #592
Every SigningPolicy edit rolled the CA pod. The policy Secret was mounted with SubPath, which the kubelet never refreshes, so the operator compensated with a hash annotation on the pod template. Because the CA Deployment uses the Recreate strategy, that meant a short outage - no signing, no CRL - for a change that alters no running state. On a VM-based Puppet, editing autosign configuration has no serving impact at all. Nothing downstream required the restart: openvox-autosign is executed per CSR and reads the file each time. Only the mount did. Mount the Secret as a directory instead, the way the CRL Secret already is for the same reason, and pass the file to the binary with --config. The hash annotation is gone, so a policy edit no longer touches the pod template. The trade-off is timing: a change now takes effect within the kubelet sync period, up to about a minute, rather than immediately after a restart. For a rule deciding which CSRs get signed, that is the better end of the trade. The former test asserted the annotation exists; it now asserts the opposite and that the mount carries no SubPath, since a SubPath would silently reintroduce the whole problem. The rendered puppet.conf is checked for the config path too - a wrong one denies every CSR and would otherwise only surface in an end-to-end run. Closes #588
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.
Two fixes, one commit each.
#592 -- javaArgs default made the heap derivation dead code
resolveJavaArgssizes the JVM heap at 90 percent of the pod's memory limit whenjavaArgsis unset. The CRD default made that unreachable: the field was never empty, so every Server ran with-Xms512m -Xmx1024mregardless of its limit. A Server given 8Gi used 1Gi of it.Third instance of one mistake after #550 (image repository/tag) and #576 (pullPolicy). A default removes the empty state a fallback depends on, so it belongs in the chart where it is visible rather than in the CRD where it disables code.
Worth noting how it survived: three unit tests already covered
resolveJavaArgs, including the memory-derived branch, and all passed. They call the function directly and so prove nothing about whether the field can be empty in a real cluster. Replaced them with a round-trip through the API server, which fails against the old CRD and names the materialised value:This also restores the auto-tuning statement in the README and feature list, which I had corrected in #591 to match the broken behaviour rather than the intended one.
Upgrade note: existing Servers carry
javaArgsmaterialised from the old default and keep it until the field is cleared. Ahelm upgradeclears it; hand-written resources need it removed.#588 -- policy edits restarted the CA
The policy Secret was mounted with
SubPath, which the kubelet never refreshes, so the operator compensated with a hash annotation on the pod template. With the CA Deployment on theRecreatestrategy, every SigningPolicy edit meant a short outage -- no signing, no CRL -- for a change that alters no running state.Nothing downstream needed it:
openvox-autosignis executed per CSR and reads the file each time. Only the mount did.Now mounted as a directory, the way the CRL Secret already is for the same reason, with the file passed via
--config. The hash annotation is gone.Trade-off: a change takes effect within the kubelet sync period, up to about a minute, instead of immediately after a restart. For a rule deciding which CSRs get signed, that is the better end of the trade -- and it is stated in the concept page rather than left as a surprise.
Test changes
The old test asserted the annotation exists. It now asserts the opposite and that the mount carries no
SubPath, since reintroducing one would silently bring the whole problem back. The renderedpuppet.confis checked for the config path as well: a wrong path denies every CSR and would otherwise surface only in an end-to-end run.Verification
make test(with envtest),make manifestsand golangci-lint 2.13.2 are clean. Theautosign-policye2e scenario exercises the new mount path end to end.Closes #592
Closes #588