import { Plus } from 'lucide-react'; import { FormikErrors } from 'formik'; import { KubernetesApplicationPublishingTypes } from '@/kubernetes/models/application/models'; import { Card } from '@@/Card'; import { TextTip } from '@@/Tip/TextTip'; import { Button } from '@@/buttons'; import { generateUniqueName, newPort, serviceFormDefaultValues } from './utils'; import { ServiceFormValues, ServicePort } from './types'; import { ClusterIpServiceForm } from './ClusterIpServiceForm'; interface Props { services: ServiceFormValues[]; onChangeService: (services: ServiceFormValues[]) => void; errors?: FormikErrors; appName: string; selector: Record; } export function ClusterIpServicesForm({ services, onChangeService, errors, appName, selector, }: Props) { const clusterIPServiceCount = services.filter( (service) => service.Type === KubernetesApplicationPublishingTypes.CLUSTER_IP ).length; return (
Publish internally in the cluster via a{' '} ClusterIP service, optionally exposing externally to the outside world via an ingress. {clusterIPServiceCount > 0 && (
{services.map((service, index) => service.Type === KubernetesApplicationPublishingTypes.CLUSTER_IP ? ( { const newServices = [...services]; newServices[index].Ports = servicePorts; onChangeService(newServices); }} services={services} serviceIndex={index} onChangeService={onChangeService} /> ) : null )}
)}
); }