Encapsulate OPENFAAS_NS lookup - #1029
Conversation
Read OPENFAAS_NS inside getNamespace so callers no longer pass the same environment value explicitly. Signed-off-by: Han Verstraete (OpenFaaS Ltd) <han@openfaas.com>
AI Pull Request OverviewDisclaimer: This review was generated by automated AI and may contain errors. Do not trust its outputs without human verification. Summary
Approval rating (1-10)9/10. The change is focused, preserves existing precedence, and updates relevant tests; no blocking issue was identified. Summary per fileSummary per file
Overall AssessmentThe PR is a small refactor with the intended behavior preserved in the final state. Detailed ReviewDetailed ReviewNo blocking findings. The scoped changes are internally consistent: all reviewed The only meaningful behavior shift is that The updated tests are aligned with the new design because they validate environment fallback through AI agent details. |
Description
Move the
OPENFAAS_NSenvironment lookup intogetNamespaceand restore its two-argument signature.Update namespace-aware commands and tests to use the self-contained helper. Namespace precedence and behaviour remain unchanged.
Motivation and Context
This is a follow-up to #1028 and its review discussion.
Every caller previously passed the same
os.Getenv("OPENFAAS_NS")value intogetNamespace. Keeping the lookup within the helper removes repetitive plumbing and keeps namespace resolution in one place.How Has This Been Tested?
The namespace resolution unit tests set
OPENFAAS_NSthrough the test environment and cover the environment fallback along with flag and stack namespace precedence.The CLI was also tested against an OpenFaaS gateway with
OPENFAAS_NSset, verifying that it resolved the namespace and listed functions successfully.Types of changes
Checklist:
git commit -s