import { GitProject } from "@atomist/automation-client";
import { ExecuteGoal, GoalWithFulfillment, RepoContext, SdmGoalEvent } from "@atomist/sdm";
import * as k8s from "@kubernetes/client-node";
import { DeepPartial, Merge } from "ts-essentials";
import { Container, ContainerRegistration, ContainerScheduler, GoalContainer, GoalContainerVolume } from "./container";
/** Merge of base and Kubernetes goal container interfaces. */
export declare type K8sGoalContainer = Merge<GoalContainer, DeepPartial<k8s.V1Container>> & Pick<GoalContainer, "name" | "image">;
/** Merge of base and Kubernetes goal container volume interfaces. */
export declare type K8sGoalContainerVolume = Merge<k8s.V1Volume, GoalContainerVolume>;
/** @deprecated use K8sContainerSpecCallback */
export declare type K8sGoalContainerSpec = Omit<K8sContainerRegistration, "callback">;
/**
 * Function signature for callback that can modify and return the
 * [[ContainerRegistration]] object.
 */
export declare type K8sContainerSpecCallback = (r: K8sContainerRegistration, p: GitProject, g: Container, e: SdmGoalEvent, ctx: RepoContext) => Promise<Omit<K8sContainerRegistration, "callback">>;
/**
 * Additional options for Kubernetes implementation of container goals.
 */
export interface K8sContainerRegistration extends ContainerRegistration {
    /**
     * Replace generic containers in [[ContainerRegistration]] with
     * Kubernetes containers.
     *
     * Containers to run for this goal.  The goal result is based on
     * the exit status of the first element of the `containers` array.
     * The other containers are considered "sidecar" containers
     * provided functionality that the main container needs to
     * function.  If not set, the working directory of the first
     * container is set to [[ContainerProjectHome]], which contains
     * the project upon which the goal should operate.  If
     * `workingDir` is set, it is not changed.  If `workingDir` is set
     * to the empty string, the `workingDir` property is deleted from
     * the main container spec, meaning the container default working
     * directory will be used.
     */
    containers: K8sGoalContainer[];
    /**
     * Replace generic callback in [[ContainerRegistration]] with
     * Kubernetes-specific callback.
     */
    callback?: K8sContainerSpecCallback;
    /**
     * Init containers to run for this goal.  Any containers provided
     * here will run after the one inserted by the SDM to manage the
     * cloned repository.
     */
    initContainers?: k8s.V1Container[];
    /**
     * Replace generic volumes in [[ContainerRegistration]] with
     * Kubernetes volumes available to mount in containers.
     */
    volumes?: K8sGoalContainerVolume[];
}
export declare const k8sContainerScheduler: ContainerScheduler;
/**
 * Add Kubernetes job scheduling information to SDM goal event data
 * for use by the [[KubernetesGoalScheduler]].
 */
export declare function k8sFulfillmentCallback(goal: Container, registration: K8sContainerRegistration): (sge: SdmGoalEvent, rc: RepoContext) => Promise<SdmGoalEvent>;
/**
 * Get container registration from goal event data, use
 * [[k8sFulfillmentcallback]] to get a goal event schedulable by a
 * [[KubernetesGoalScheduler]], then schedule the goal using that
 * scheduler.
 */
export declare const scheduleK8sJob: ExecuteGoal;
/**
 * Wait for first container to exit and stream its logs to the
 * progress log.
 */
export declare function executeK8sJob(): ExecuteGoal;
/**
 * Goal that fulfills requested container goals by scheduling them as
 * Kubernetes jobs.
 */
export declare const K8sContainerFulfiller: GoalWithFulfillment;
//# sourceMappingURL=k8s.d.ts.map