Fix: Retain namespace labels on managed namespace update#655
Open
tejhan wants to merge 1 commit into
Open
Conversation
Signed-off-by: tejhan-diallo <tejhan.diallo@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes managed namespace updates so existing labels (including AKS Desktop + Headlamp project labels) are preserved, and moves the long-running update flow into a background clusterAction so the UI can show progress without blocking on the Info tab.
Changes:
- Preserve existing managed-namespace labels during
az aks namespace updateby fetching current details and re-supplying--labels. - Run the InfoTab update via
clusterActionand passsubscriptionIdinto the update call. - Update InfoTab hook tests to mock
clusterActionand adapt assertions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
plugins/aks-desktop/src/utils/azure/az-namespaces.ts |
Fetches current managed namespace labels and re-supplies them to prevent label loss on update. |
plugins/aks-desktop/src/components/InfoTab/hooks/useInfoTab.ts |
Wraps save/update in clusterAction, passes subscription, and switches update to --no-wait. |
plugins/aks-desktop/src/components/InfoTab/hooks/useInfoTab.test.ts |
Adds clusterAction mock and adjusts save-failure expectations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+235
to
+236
| } catch { | ||
| // Proceed without labels if the fetch fails. |
| memoryRequest: formData.memoryRequest, | ||
| memoryLimit: formData.memoryLimit, | ||
| subscriptionId: subscription, | ||
| noWait: true, |
| noWait: true, | ||
| }); | ||
| setBaselineFormData(formData); | ||
| setError(null); |
Comment on lines
326
to
340
| await act(async () => { | ||
| await result.current.handleSave(); | ||
| }); | ||
|
|
||
| expect(mockUpdateManagedNamespace).toHaveBeenCalledWith( | ||
| expect.objectContaining({ | ||
| clusterName: 'my-cluster', | ||
| resourceGroup: 'rg-prod', | ||
| namespaceName: 'my-project', | ||
| ingressPolicy: 'DenyAll', | ||
| }) | ||
| ); | ||
| // Baseline advances so hasChanges resets | ||
| expect(result.current.hasChanges).toBe(false); | ||
| }); |
skoeva
reviewed
May 12, 2026
| { | ||
| startMessage: t('Updating namespace {{ name }}…', { name: projectId }), | ||
| cancelledMessage: t('Cancelled update of namespace {{ name }}.', { name: projectId }), | ||
| successMessage: t('Updated namespace {{ name }}.', { name: projectId }), |
Collaborator
There was a problem hiding this comment.
I think you'll need to run npm run i18n:collect at the top-level to update these translations
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.
Description
Currently, when updating a managed namespace via the Info tab, it silently removes the Headlamp & AKSD project labels. This renders Headlamp unable to recognize the project, leaving the user stuck with an infinite loading screen & a missing project on reload.
Separately, the az aks namespace command itself can often be slow, taking several minutes at worst, which even on a successful update, blocks the UI for the full duration.
Changes Made
updateManagedNamespacecommand so that they're preserved on update. This is needed due to the ARM PUT being a full replacement.clusterActionso we can display the progress & operate async to relieve the user for long operation times vs. waiting on the one screen.subscriptionIdintogetManagedNamespaceso that we have correct specificity for a multi-sub setup.Type of change
Testing
npm run plugin testManual Testing
Test Cases
Describe the test cases that were run:
Screenshots/Videos
If applicable, add screenshots or videos to demonstrate the changes.
Checklist
Breaking Changes
If this is a breaking change, describe:
Performance Impact
Documentation Updates
Reviewer Notes
Any specific areas you'd like reviewers to focus on or questions you have.