Fix PrefectDeployment namespace resolution fallback logic#205
Merged
chrisguidry merged 2 commits intomainfrom Sep 19, 2025
Merged
Fix PrefectDeployment namespace resolution fallback logic#205chrisguidry merged 2 commits intomainfrom
chrisguidry merged 2 commits intomainfrom
Conversation
The PrefectDeployment controller had a bug where it would hardcode "default" as the fallback namespace instead of using the deployment's own namespace when the server reference didn't specify a namespace. This caused deployments to fail when the PrefectServer was in a different namespace than "default", even when both resources were in the same namespace. Changes: - Updated NewClientFromServerReference to accept fallbackNamespace parameter - Fixed fallback logic to use provided namespace instead of hardcoded "default" - Updated NewClientFromK8s to pass the deployment's namespace as fallback - Added comprehensive tests to verify the fix works correctly - Updated Ginkgo version in .mise.toml to match go.mod (2.25.2) The fix ensures that when a PrefectDeployment references a PrefectServer by name only (without namespace), it correctly falls back to using the deployment's namespace instead of always defaulting to "default". Closes #202 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Replaced the problematic test that attempted actual port-forwarding during test execution with focused URL generation tests. The original test was failing in CI due to port-forwarding setup issues, but the core namespace fallback logic is properly tested through direct URL generation verification. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
mitchnielsen
approved these changes
Sep 19, 2025
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.
The PrefectDeployment controller had a bug where it would hardcode "default"
as the fallback namespace instead of using the deployment's own namespace when
the server reference didn't specify a namespace.
This caused deployments to fail when the PrefectServer was in a different
namespace than "default", even when both resources were in the same namespace.
Changes
The fix ensures that when a PrefectDeployment references a PrefectServer by
name only (without namespace), it correctly falls back to using the
deployment's namespace instead of always defaulting to "default".
Testing
Closes #202
🤖 Generated with Claude Code