Fix undefined types error in k8s client#69
Merged
JoshuaAFerguson merged 5 commits intoNov 17, 2025
Conversation
Add missing 'k8s.io/apimachinery/pkg/types' import required for types.StrategicMergePatchType in PatchNode function. Fixes compilation error: undefined: types
Fixed multiple compilation errors: nodes.go: - Added missing 'resource' import from k8s.io/apimachinery/pkg/api/resource - Removed unused 'metav1' and 'types' imports - Fixed newQuantity() to return resource.Quantity instead of corev1.Quantity - Fixed resource.Quantity.Add() calls by getting value, modifying, then reassigning to map stubs.go: - Fixed iteration over NodeList to use nodes.Items instead of nodes directly - Fixed len() calls on PodList to use pods.Items instead of pods - Fixed len() calls on NodeList to use nodes.Items instead of nodes Resolves compilation errors with undefined types and invalid pointer method calls.
Both /admin/users and /admin/groups pages were missing the Layout component wrapper that provides the admin sidebar navigation. This caused the sidebar to disappear when navigating to these pages. Changes: - Added Layout import to Users.tsx and Groups.tsx - Wrapped Container content in Layout component - Maintains existing WebSocketErrorBoundary wrapper structure Fixes sidebar navigation visibility on admin Users and Groups pages.
Added stub implementations for compliance endpoints that return empty data when the streamspace-compliance plugin is not installed. This prevents 404 errors on the Compliance admin page while clearly indicating that the full functionality requires the plugin. Changes: - Added compliance stub handlers in api/internal/api/stubs.go: - ListComplianceFrameworks (returns empty frameworks array) - CreateComplianceFramework (returns 501 with plugin installation message) - ListCompliancePolicies (returns empty policies array) - CreateCompliancePolicy (returns 501 with plugin installation message) - ListViolations (returns empty violations array) - RecordViolation (returns 501 with plugin installation message) - ResolveViolation (returns 501 with plugin installation message) - GetComplianceDashboard (returns zero metrics) - Uncommented compliance routes in api/cmd/main.go: - Added /compliance/dashboard endpoint - Enabled all compliance CRUD endpoints under /compliance/* routes - Added documentation noting these are stubs until plugin is installed Benefits: - No more 404 errors in browser console on Compliance page - Clear indication when compliance features require plugin installation - Graceful degradation when plugin is not available - Plugin can override stubs when installed Resolves compliance page 404 errors for frameworks, policies, violations, and dashboard.
Fixed TypeError on Nodes admin page where totalCapacity was undefined.
The issue was that corev1.ResourceList was being directly serialized to
JSON which didn't match the expected frontend interface.
Changes:
- Created ClusterStatsResources struct with proper JSON-friendly format:
- cpu: string (e.g., "4.0" for 4 cores)
- memory: string (e.g., "8.0Gi")
- pods: int (e.g., 110)
- Updated ClusterStats struct to use ClusterStatsResources pointers
instead of corev1.ResourceList for totalCapacity and totalAllocatable
- Rewrote calculateClusterStats to:
- Aggregate resources using temporary Quantity variables
- Format resources into human-readable strings
- Return properly structured ClusterStatsResources
- Added helper functions:
- formatCPU: converts milliCPU to cores string (e.g., "4.0")
- formatMemory: converts bytes to human-readable format (Ki/Mi/Gi/Ti)
Frontend now receives proper JSON structure:
{
"totalNodes": 3,
"readyNodes": 3,
"notReadyNodes": 0,
"totalCapacity": {
"cpu": "12.0",
"memory": "24.0Gi",
"pods": 330
},
"totalAllocatable": {...}
}
Resolves Nodes page crash: 'can't access property "cpu", j.totalCapacity is undefined'
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.
No description provided.