@adpt/cloud
Version:
AdaptJS cloud component library
68 lines • 2.27 kB
TypeScript
import Adapt, { BuildHelpers, DeferredComponent } from "@adpt/core";
import { OmitT } from "type-ops";
import { ServiceProps as AbsServiceProps } from "../Service";
import { ClusterInfo } from "./common";
import { K8sContainerProps } from "./Container";
import { PodProps } from "./Pod";
import { ServiceProps } from "./Service";
/**
* Props for {@link k8s.ServiceDeployment}
*
* @public
*/
export interface ServiceDeploymentProps extends AbsServiceProps {
config: ClusterInfo;
serviceProps?: Partial<ServiceProps>;
podProps?: Partial<PodProps>;
containerProps?: Partial<OmitT<K8sContainerProps, "image">>;
}
/**
* A component for mapping a group of abstract {@link Container}s and
* {@link NetworkService}s to Kubernetes {@link k8s.Pod}s and
* {@link k8s.K8sContainer}s.
*
* @remarks
* This component is intended to be used to replace {@link Container} and
* {@link NetworkService} components that are grouped together, as the
* only children of a common parent in a pattern that looks like this:
*
* ```tsx
* <Service>
* <Container ... />
* <Container ... />
* <NetworkService ... />
* </Service>
* ```
*
* `ServiceDeployment` would map those abstract components into corresponding
* k8s components like this:
* ```tsx
* <Group>
* <docker.RegistryDockerImage ... /> //If props.config specifies a registry
* <k8s.Pod ... >
* <k8s.K8sContainer ... />
* </k8s.Pod>
* <docker.RegistryDockerImage ... /> //If props.config specifies a registry
* <k8s.Pod ... >
* <k8s.K8sContainer ... />
* </k8s.Pod>
* <k8s.Service ... />
* </Group>
* ```
* An example style rule to do this is:
* ```tsx
* {Adapt.rule((matchedProps) => {
* const { handle, ...remainingProps } = matchedProps;
* return <ServiceDeployment config={kubeconfig} {...remainingProps} />;
* })}
* ```
* `ServiceDeployment` also requires the `config` prop which specifies
* connection and authentication information for the Kubernetes cluster on
* which these objects should be created.
*
* @public
*/
export declare class ServiceDeployment extends DeferredComponent<ServiceDeploymentProps> {
build(helpers: BuildHelpers): Adapt.AdaptElement<Adapt.AnyProps>;
}
//# sourceMappingURL=ServiceDeployment.d.ts.map