-
Notifications
You must be signed in to change notification settings - Fork 16
Adding Rolebindings Form #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for gorgeous-maamoul-daf273 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a comprehensive RoleBindings management feature to the Kube Composer application. The implementation adds both RoleBinding and ClusterRoleBinding support with an intuitive wizard-style interface and integrates seamlessly with the existing RBAC functionality.
- Enhanced RBAC management with RoleBinding/ClusterRoleBinding creation and editing
- Added new type definitions and YAML generation utilities for RoleBindings
- Implemented comprehensive UI components including wizard-style forms and visual previews
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
src/utils/yamlGenerator.ts | Added RoleBinding YAML generation support and integrated with multi-deployment generator |
src/utils/localStorage.ts | Extended config storage to include RoleBindings |
src/types/index.ts | Added Subject and RoleBinding type definitions |
src/components/YamlPreview.tsx | Enhanced accessibility with aria-labels |
src/components/VisualPreview.tsx | Added RoleBinding visual components and filtering |
src/components/RoleWizardManager.tsx | New comprehensive role creation wizard |
src/components/RoleBindingManager.tsx | New RoleBinding management interface |
src/App.tsx | Integrated RoleBinding management throughout the application |
setRoleData({ | ||
metadata: { | ||
name: initialRole.metadata.name, | ||
namespace: 'kind' in initialRole && 'namespace' in initialRole.metadata ? initialRole.metadata.namespace : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type checking logic is complex and repeated. Consider creating a type guard function like isNamespacedRole(role: KubernetesRole | KubernetesClusterRole): role is KubernetesRole
to improve readability and maintainability.
namespace: 'kind' in initialRole && 'namespace' in initialRole.metadata ? initialRole.metadata.namespace : undefined, | |
namespace: isNamespacedRole(initialRole) ? initialRole.metadata.namespace : undefined, |
Copilot uses AI. Check for mistakes.
<Info className="inline w-3 h-3" /> | ||
</span> | ||
</label> | ||
{subject.kind === 'ServiceAccount' as any ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'as any' type assertion defeats TypeScript's type safety. The comparison should work without the type assertion since subject.kind is already typed as 'User' | 'Group' | 'ServiceAccount'.
{subject.kind === 'ServiceAccount' as any ? ( | |
{subject.kind === 'ServiceAccount' ? ( |
Copilot uses AI. Check for mistakes.
@@ -1208,25 +1228,24 @@ data: | |||
} | |||
|
|||
// === JOBS === | |||
if (jobs.length > 0) { | |||
if (customNamespaces.length > 0 || configMaps.length > 0 || secrets.length > 0 || deployments.length > 0) { | |||
if (jobs.length > 0 || cronjobs.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The condition check combines jobs and cronjobs but doesn't verify if there are actually any jobs of each type before adding the section header. Consider checking each type individually to avoid empty sections.
if (jobs.length > 0 || cronjobs.length > 0) { | |
if (jobs.length > 0) { |
Copilot uses AI. Check for mistakes.
src/components/RoleWizardManager.tsx
Outdated
const newErrors = { ...prev }; | ||
delete newErrors[errorKey]; | ||
return newErrors; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console.log statement should be removed from production code or replaced with proper logging.
Copilot uses AI. Check for mistakes.
|
||
type PreviewMode = 'visual' | 'yaml' | 'summary' | 'argocd' | 'flow'; | ||
type SidebarTab = 'deployments' | 'daemonsets' | 'namespaces' | 'storage' | 'security' | 'jobs' | 'configmaps' | 'secrets' | 'roles'; | ||
|
||
function App() { | ||
const hideDemoIcons = import.meta.env.VITE_HIDE_DEMO_ICONS === 'true'; | ||
// Add a flag to hide header actions if ?q=plaground or ?q=playground is present | ||
const hideHeaderActions = typeof window !== 'undefined' && (window.location.search.includes('q=plaground') || window.location.search.includes('q=playground')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo in the parameter check: 'q=plaground' should be 'q=playground'.
const hideHeaderActions = typeof window !== 'undefined' && (window.location.search.includes('q=plaground') || window.location.search.includes('q=playground')); | |
const hideHeaderActions = typeof window !== 'undefined' && (window.location.search.includes('q=playground') || window.location.search.includes('q=playground')); |
Copilot uses AI. Check for mistakes.
src/components/RoleWizardManager.tsx
Outdated
setShowRuleTemplates(false); | ||
|
||
// Show success feedback (you can add a toast notification here if you have one) | ||
console.log(`Applied template "${template.name}" - added ${template.rules.length} rules`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console.log statement should be removed from production code or replaced with proper logging.
Copilot uses AI. Check for mistakes.
setShowRuleTemplates(false); | ||
|
||
// Show success feedback | ||
console.log(`Applied template "${templateId}" - added ${rules.length} rules`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console.log statement should be removed from production code or replaced with proper logging.
Copilot uses AI. Check for mistakes.
No description provided.