import { Service } from 'kubernetes-types/core/v1'; import { ExternalLink } from 'lucide-react'; import { EnvironmentId } from '@/react/portainer/environments/types'; import { useEnvironment } from '@/react/portainer/environments/queries'; import { Icon } from '@@/Icon'; import { TextTip } from '@@/Tip/TextTip'; type Props = { environmentId: EnvironmentId; appServices?: Service[]; }; export function ApplicationServicesTable({ environmentId, appServices, }: Props) { const { data: environment } = useEnvironment(environmentId); return ( <>
Service name | Type | Cluster IP | External IP | Container port | Service port(s) | |
{service.metadata?.name} | {service.spec?.type} | {service.spec?.clusterIP} | {service.spec?.type === 'LoadBalancer' && (
{service.status?.loadBalancer?.ingress?.[0] &&
service.spec?.ports?.[0] && (
{service.spec.externalIPs?.[0]
? service.spec.externalIPs[0]
: 'pending...'}
)}
|
)}
{service.spec?.type !== 'LoadBalancer' && (
{service.spec?.externalIPs?.[0] ? service.spec.externalIPs[0] : '-'} | )}
{service.spec?.ports?.map((port) => (
{port.targetPort}
))}
|
{service.spec?.ports?.map((port) => (
{environment?.PublicURL && port.nodePort && (
))}
{port.port}
{port.nodePort ? ' : ' : ''}
{port.nodePort}/{port.protocol}
)}
|