import * as pulumi from "@pulumi/pulumi"; import * as yaml from "../yaml"; /** * Directory is a component representing a collection of resources described by a kustomize directory (kustomization). * * ## Example Usage * ### Local Kustomize Directory * * ```typescript * import * as k8s from "@pulumi/kubernetes"; * * const helloWorld = new k8s.kustomize.Directory("helloWorldLocal", { * directory: "./helloWorld", * }); * ``` * ### Kustomize Directory from a Git Repo * * ```typescript * import * as k8s from "@pulumi/kubernetes"; * * const helloWorld = new k8s.kustomize.Directory("helloWorldRemote", { * directory: "https://github.com/kubernetes-sigs/kustomize/tree/v3.3.1/examples/helloWorld", * }); * ``` * ### Kustomize Directory with Transformations * * ```typescript * import * as k8s from "@pulumi/kubernetes"; * * const helloWorld = new k8s.kustomize.Directory("helloWorldRemote", { * directory: "https://github.com/kubernetes-sigs/kustomize/tree/v3.3.1/examples/helloWorld", * transformations: [ * // Make every service private to the cluster, i.e., turn all services into ClusterIP instead of LoadBalancer. * (obj: any, opts: pulumi.CustomResourceOptions) => { * if (obj.kind === "Service" && obj.apiVersion === "v1") { * if (obj.spec && obj.spec.type && obj.spec.type === "LoadBalancer") { * obj.spec.type = "ClusterIP"; * } * } * }, * * // Set a resource alias for a previous name. * (obj: any, opts: pulumi.CustomResourceOptions) => { * if (obj.kind === "Deployment") { * opts.aliases = [{ name: "oldName" }] * } * }, * * // Omit a resource from the Chart by transforming the specified resource definition to an empty List. * (obj: any, opts: pulumi.CustomResourceOptions) => { * if (obj.kind === "Pod" && obj.metadata.name === "test") { * obj.apiVersion = "v1" * obj.kind = "List" * } * }, * ], * }); * ``` */ export declare class Directory extends yaml.CollectionComponentResource { /** * Create an instance of the specified kustomize directory. * * @param name Name of the kustomization (e.g., nginx-ingress). * @param config Configuration options for the kustomization. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, config: DirectoryOpts, opts?: pulumi.ComponentResourceOptions); } /** * The set of arguments for constructing a Directory resource. */ interface DirectoryOpts { /** * The directory containing the kustomization to apply. The value can be a local directory or a folder in a * git repository. * Example: ./helloWorld * Example: https://github.com/kubernetes-sigs/kustomize/tree/master/examples/helloWorld */ directory: string; /** * An optional prefix for the auto-generated resource names. * Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". */ resourcePrefix?: string; /** * Optional array of transformations to apply to the objects generated by kustomize before they are applied to * the cluster. Allows further changes to the kustomization without modifying the directory itself. * * @example * ```typescript * transformations: [ * (obj: any, opts: pulumi.CustomResourceOptions) => { * if (obj.kind === "Deployment" && obj.metadata.name == "cert-manager") { * opts.aliases = [{ type: "apps/v1beta1:Deployment" }] * } * * if (obj.metadata) { * obj.metadata.namespace = namespaceName; * } else { * obj.metadata = {namespace: namespaceName}; * } * }] * ``` */ transformations?: ((o: any, opts: pulumi.CustomResourceOptions) => void)[]; } export {};