Skip to content

Commit 116a49a

Browse files
authored
Merge pull request #55 from same7ammar/feat/add-k8s-security
2 parents ab55199 + 48e4225 commit 116a49a

File tree

10 files changed

+2349
-186
lines changed

10 files changed

+2349
-186
lines changed

src/App.tsx

Lines changed: 338 additions & 35 deletions
Large diffs are not rendered by default.

src/components/DeploymentForm.tsx

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import { Plus, Minus, Server, Settings, Database, Key, Trash2, Copy, Globe, Shield, FileText } from 'lucide-react';
2-
import type { DeploymentConfig, Container, ConfigMap, Secret, EnvVar } from '../types';
1+
import { Plus, Minus, Server, Settings, Database, Key, Trash2, Copy, Globe, Shield, FileText, Users, X } from 'lucide-react';
2+
import type { DeploymentConfig, Container, ConfigMap, Secret, EnvVar, ServiceAccount } from '../types';
33

44
interface DeploymentFormProps {
55
config: DeploymentConfig;
66
onChange: (config: DeploymentConfig) => void;
77
availableNamespaces: string[];
88
availableConfigMaps: ConfigMap[];
99
availableSecrets: Secret[];
10+
availableServiceAccounts: ServiceAccount[];
11+
onNavigateToServiceAccounts?: () => void;
1012
}
1113

12-
export function DeploymentForm({ config, onChange, availableNamespaces, availableConfigMaps, availableSecrets }: DeploymentFormProps) {
14+
export function DeploymentForm({ config, onChange, availableNamespaces, availableConfigMaps, availableSecrets, availableServiceAccounts, onNavigateToServiceAccounts }: DeploymentFormProps) {
1315
const updateConfig = (updates: Partial<DeploymentConfig>) => {
1416
onChange({ ...config, ...updates });
1517
};
@@ -330,6 +332,56 @@ export function DeploymentForm({ config, onChange, availableNamespaces, availabl
330332
))}
331333
</select>
332334
</div>
335+
336+
<div className="sm:col-span-2">
337+
<div className="flex items-center justify-between mb-2">
338+
<label className="block text-sm font-medium text-gray-700">
339+
Service Account
340+
</label>
341+
{onNavigateToServiceAccounts && (
342+
<button
343+
type="button"
344+
onClick={onNavigateToServiceAccounts}
345+
className="inline-flex items-center px-2 py-1 text-xs bg-cyan-600 text-white rounded hover:bg-cyan-700 transition-colors duration-200"
346+
>
347+
<Plus className="w-3 h-3 mr-1" />
348+
New Service Account
349+
</button>
350+
)}
351+
</div>
352+
<div className="flex space-x-2">
353+
<select
354+
value={config.serviceAccount || ''}
355+
onChange={(e) => updateConfig({ serviceAccount: e.target.value || undefined })}
356+
className="flex-1 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm sm:text-base"
357+
>
358+
<option value="">Default (no service account)</option>
359+
{availableServiceAccounts
360+
.filter(sa => sa.namespace === config.namespace)
361+
.map(serviceAccount => (
362+
<option key={serviceAccount.name} value={serviceAccount.name}>
363+
{serviceAccount.name}
364+
</option>
365+
))}
366+
</select>
367+
{config.serviceAccount && (
368+
<button
369+
type="button"
370+
onClick={() => updateConfig({ serviceAccount: undefined })}
371+
className="px-3 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 focus:ring-2 focus:ring-red-500 focus:border-transparent text-sm transition-colors duration-200"
372+
title="Remove service account"
373+
>
374+
<X className="w-4 h-4 text-gray-500 hover:text-red-600" />
375+
</button>
376+
)}
377+
</div>
378+
{config.serviceAccount && (
379+
<div className="mt-2 flex items-center space-x-2 text-xs text-gray-600">
380+
<Users className="w-3 h-3 text-cyan-500" />
381+
<span>Using service account: {config.serviceAccount}</span>
382+
</div>
383+
)}
384+
</div>
333385
</div>
334386
</div>
335387

src/components/KubernetesIcons.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,16 @@ export const K8sPodIcon: React.FC<IconProps> = ({ className = "w-4 h-4" }) => (
5656
<svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
5757
<path d="M12 2L4 6V18L12 22L20 18V6L12 2ZM12 4.21L17.37 7L12 9.83L6.63 7L12 4.21ZM6 16.89L5 16.35V8.17L11 11.15V19.29L6 16.89ZM13 19.29V11.15L19 8.17V16.35L18 16.89L13 19.29Z" fill="currentColor"/>
5858
</svg>
59+
);
60+
61+
export const K8sSecurityIcon: React.FC<IconProps> = ({ className = "w-4 h-4" }) => (
62+
<svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
63+
<path d="M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,7C13.4,7 14.8,8.6 14.8,10V11H16V16H8V11H9.2V10C9.2,8.6 10.6,7 12,7M12,8.2C11.2,8.2 10.4,8.7 10.4,10V11H13.6V10C13.6,8.7 12.8,8.2 12,8.2Z" fill="currentColor"/>
64+
</svg>
65+
);
66+
67+
export const K8sServiceAccountIcon: React.FC<IconProps> = ({ className = "w-4 h-4" }) => (
68+
<svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
69+
<path d="M12 2C13.1 2 14 2.9 14 4C14 5.1 13.1 6 12 6C10.9 6 10 5.1 10 4C10 2.9 10.9 2 12 2ZM21 9V7L15 5.5C14.8 4.1 13.9 2.9 12.6 2.2L11.2 5.6C11.5 5.8 11.7 6.1 11.8 6.5L17.5 7.5C17.3 7.2 17.1 6.9 16.8 6.7L21 9ZM3 9L7.2 6.7C6.9 6.9 6.7 7.2 6.5 7.5L12.2 6.5C12.3 6.1 12.5 5.8 12.8 5.6L11.4 2.2C10.1 2.9 9.2 4.1 9 5.5L3 7V9ZM9 13C9 15.8 11.2 18 14 18S19 15.8 19 13V11H17V13C17 14.7 15.7 16 14 16S11 14.7 11 13V11H9V13ZM5 13C5 15.8 7.2 18 10 18S15 15.8 15 13V11H13V13C13 14.7 11.7 16 10 16S7 14.7 7 13V11H5V13Z" fill="currentColor"/>
70+
</svg>
5971
);

0 commit comments

Comments
 (0)