2023-10-09 18:23:12 +00:00
|
|
|
import { Box, Edit, Layers, Lock, Network, Server } from 'lucide-react';
|
2022-06-28 07:42:42 +00:00
|
|
|
|
2022-10-23 06:53:25 +00:00
|
|
|
import { EnvironmentId } from '@/react/portainer/environments/types';
|
2022-11-13 08:10:18 +00:00
|
|
|
import { Authorized } from '@/react/hooks/useUser';
|
2023-10-09 18:23:12 +00:00
|
|
|
import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
|
2022-06-23 07:25:56 +00:00
|
|
|
|
2022-06-28 07:42:42 +00:00
|
|
|
import { DashboardLink } from '../items/DashboardLink';
|
2022-06-23 07:25:56 +00:00
|
|
|
import { SidebarItem } from '../SidebarItem';
|
2022-06-28 07:42:42 +00:00
|
|
|
import { VolumesLink } from '../items/VolumesLink';
|
2023-10-09 18:23:12 +00:00
|
|
|
import { SidebarParent } from '../SidebarItem/SidebarParent';
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
import { KubectlShellButton } from './KubectlShell';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
environmentId: EnvironmentId;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function KubernetesSidebar({ environmentId }: Props) {
|
|
|
|
return (
|
|
|
|
<>
|
2023-10-09 18:23:12 +00:00
|
|
|
<div className="w-full flex mb-2 justify-center -mt-2">
|
|
|
|
<KubectlShellButton environmentId={environmentId} />
|
|
|
|
</div>
|
2022-06-23 07:25:56 +00:00
|
|
|
|
2022-06-28 16:36:40 +00:00
|
|
|
<DashboardLink
|
|
|
|
environmentId={environmentId}
|
|
|
|
platformPath="kubernetes"
|
|
|
|
data-cy="k8sSidebar-dashboard"
|
|
|
|
/>
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.templates.custom"
|
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Edit}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="Custom Templates"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-customTemplates"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
|
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.resourcePools"
|
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Layers}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="Namespaces"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-namespaces"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
|
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.applications"
|
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Box}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="Applications"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-applications"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarParent
|
|
|
|
label="Networking"
|
|
|
|
icon={Network}
|
2023-03-02 19:45:19 +00:00
|
|
|
to="kubernetes.services"
|
|
|
|
params={{ endpointId: environmentId }}
|
2023-10-09 18:23:12 +00:00
|
|
|
pathOptions={{ includePaths: ['kubernetes.ingresses'] }}
|
|
|
|
data-cy="k8sSidebar-networking"
|
|
|
|
>
|
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.services"
|
|
|
|
params={{ endpointId: environmentId }}
|
|
|
|
label="Services"
|
|
|
|
isSubMenu
|
|
|
|
data-cy="k8sSidebar-services"
|
|
|
|
/>
|
2023-03-02 19:45:19 +00:00
|
|
|
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.ingresses"
|
|
|
|
params={{ endpointId: environmentId }}
|
|
|
|
label="Ingresses"
|
|
|
|
isSubMenu
|
|
|
|
data-cy="k8sSidebar-ingresses"
|
|
|
|
/>
|
|
|
|
</SidebarParent>
|
2022-09-21 04:49:42 +00:00
|
|
|
|
2022-06-23 07:25:56 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.configurations"
|
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Lock}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="ConfigMaps & Secrets"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-configurations"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
|
2022-06-28 16:36:40 +00:00
|
|
|
<VolumesLink
|
|
|
|
environmentId={environmentId}
|
|
|
|
platformPath="kubernetes"
|
|
|
|
data-cy="k8sSidebar-volumes"
|
|
|
|
/>
|
2022-06-23 07:25:56 +00:00
|
|
|
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarParent
|
2022-06-23 07:25:56 +00:00
|
|
|
label="Cluster"
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Server}
|
2023-10-09 18:23:12 +00:00
|
|
|
to="kubernetes.cluster"
|
2022-06-23 07:25:56 +00:00
|
|
|
params={{ endpointId: environmentId }}
|
2023-10-09 18:23:12 +00:00
|
|
|
pathOptions={{ includePaths: ['kubernetes.registries'] }}
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-cluster"
|
2022-06-23 07:25:56 +00:00
|
|
|
>
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarItem
|
|
|
|
label="Details"
|
|
|
|
to="kubernetes.cluster"
|
|
|
|
ignorePaths={[
|
|
|
|
'kubernetes.cluster.setup',
|
|
|
|
'kubernetes.cluster.securityConstraint',
|
|
|
|
]}
|
|
|
|
params={{ endpointId: environmentId }}
|
|
|
|
isSubMenu
|
|
|
|
data-cy="k8sSidebar-clusterDetails"
|
|
|
|
/>
|
2022-07-22 02:14:31 +00:00
|
|
|
<Authorized
|
|
|
|
authorizations="K8sClusterSetupRW"
|
|
|
|
adminOnlyCE
|
|
|
|
environmentId={environmentId}
|
|
|
|
>
|
2022-06-23 07:25:56 +00:00
|
|
|
<SidebarItem
|
2022-07-22 02:14:31 +00:00
|
|
|
to="kubernetes.cluster.setup"
|
2022-09-21 04:49:42 +00:00
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="Setup"
|
2023-10-09 18:23:12 +00:00
|
|
|
isSubMenu
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-setup"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
</Authorized>
|
|
|
|
|
2022-07-22 02:14:31 +00:00
|
|
|
<Authorized
|
|
|
|
authorizations="K8sClusterSetupRW"
|
|
|
|
adminOnlyCE
|
|
|
|
environmentId={environmentId}
|
|
|
|
>
|
2022-06-23 07:25:56 +00:00
|
|
|
<SidebarItem
|
2022-07-22 02:14:31 +00:00
|
|
|
to="kubernetes.cluster.securityConstraint"
|
2022-09-21 04:49:42 +00:00
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="Security constraints"
|
2023-10-09 18:23:12 +00:00
|
|
|
isSubMenu
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-securityConstraints"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
</Authorized>
|
|
|
|
|
2023-10-09 18:23:12 +00:00
|
|
|
{isBE && (
|
|
|
|
<Authorized
|
|
|
|
authorizations="K8sClusterSetupRW"
|
|
|
|
adminOnlyCE
|
|
|
|
environmentId={environmentId}
|
|
|
|
>
|
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.cluster.securityConstraint"
|
|
|
|
params={{ endpointId: environmentId }}
|
|
|
|
label="Security Constraints"
|
|
|
|
isSubMenu
|
|
|
|
data-cy="k8sSidebar-securityConstraints"
|
|
|
|
/>
|
|
|
|
</Authorized>
|
|
|
|
)}
|
|
|
|
|
2022-06-23 07:25:56 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.registries"
|
|
|
|
params={{ endpointId: environmentId }}
|
|
|
|
label="Registries"
|
2023-10-09 18:23:12 +00:00
|
|
|
isSubMenu
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-registries"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
2023-10-09 18:23:12 +00:00
|
|
|
</SidebarParent>
|
2022-06-23 07:25:56 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|