Want to learn about running containers in Lambda? Join our free hands-on workshop. Register Now

Module kustomize

This page documents the language specification for the kubernetes package. If you're looking for help working with the inputs, outputs, or functions of kubernetes resources in a Pulumi program, please see the resource documentation for examples and API reference.

APIs

APIs

class Directory

class Directory extends CollectionComponentResource

Directory is a component representing a collection of resources described by a kustomize directory (kustomization).

Example Usage

Local Kustomize Directory
import * as k8s from "@pulumi/kubernetes";

const helloWorld = new k8s.kustomize.Directory("helloWorldLocal", {
  directory: "./helloWorld",
});
Kustomize Directory from a Git Repo
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
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"
      }
    },
  ],
});

constructor

new Directory(name: string, config: DirectoryOpts, opts?: pulumi.ComponentResourceOptions)

Create an instance of the specified kustomize directory.

  • name Name of the kustomization (e.g., nginx-ingress).
  • config Configuration options for the kustomization.
  • opts A bag of options that control this resource's behavior.

method getCustomResource

public getCustomResource<T>(groupVersionKind: string, namespace: string): pulumi.Output<T>

getCustomResource returns a resource defined by a CRD with the given group/version/kind and name.

For example: getCustomResource(“monitoring.coreos.com/v1/ServiceMonitor”, “kube-prometheus-exporter-kubernetes”)

public getCustomResource<T>(groupVersionKind: string, namespace: string, name: string): pulumi.Output<T>

method getData

protected getData(): Promise<TData>

Retrieves the data produces by [initialize]. The data is immediately available in a derived class’s constructor after the super(...) call to ComponentResource.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method getResource

public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", name: string): pulumi.Output<MutatingWebhookConfiguration>

getResource returns a resource defined by a built-in Kubernetes group/version/kind and name.

For example: getResource(“apps/v1/Deployment”, “nginx”)

public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", namespace: string, name: string): pulumi.Output<MutatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", name: string): pulumi.Output<MutatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", namespace: string, name: string): pulumi.Output<MutatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", name: string): pulumi.Output<ValidatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", namespace: string, name: string): pulumi.Output<ValidatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfigurationList", name: string): pulumi.Output<ValidatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfigurationList", namespace: string, name: string): pulumi.Output<ValidatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/MutatingWebhookConfiguration", name: string): pulumi.Output<MutatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/MutatingWebhookConfiguration", namespace: string, name: string): pulumi.Output<MutatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/MutatingWebhookConfigurationList", name: string): pulumi.Output<MutatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/MutatingWebhookConfigurationList", namespace: string, name: string): pulumi.Output<MutatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/ValidatingWebhookConfiguration", name: string): pulumi.Output<ValidatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/ValidatingWebhookConfiguration", namespace: string, name: string): pulumi.Output<ValidatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/ValidatingWebhookConfigurationList", name: string): pulumi.Output<ValidatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/ValidatingWebhookConfigurationList", namespace: string, name: string): pulumi.Output<ValidatingWebhookConfigurationList>
public getResource(groupVersionKind: "apiextensions.k8s.io/v1/CustomResourceDefinition", name: string): pulumi.Output<CustomResourceDefinition>
public getResource(groupVersionKind: "apiextensions.k8s.io/v1/CustomResourceDefinition", namespace: string, name: string): pulumi.Output<CustomResourceDefinition>
public getResource(groupVersionKind: "apiextensions.k8s.io/v1/CustomResourceDefinitionList", name: string): pulumi.Output<CustomResourceDefinitionList>
public getResource(groupVersionKind: "apiextensions.k8s.io/v1/CustomResourceDefinitionList", namespace: string, name: string): pulumi.Output<CustomResourceDefinitionList>
+ 374 additional overloads

method getResourceProperty

public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">

getResourceProperty returns a single property of a resource defined by a built-in Kubernetes group/version/kind and name.

For example: getResourceProperty(“v1/Service”, “nginx”, “spec”)

public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", namespace: string, name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", name: string, property: "kind"): pulumi.Output<"MutatingWebhookConfiguration">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", namespace: string, name: string, property: "kind"): pulumi.Output<"MutatingWebhookConfiguration">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", name: string, property: "metadata"): pulumi.Output<ObjectMeta>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", namespace: string, name: string, property: "metadata"): pulumi.Output<ObjectMeta>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", name: string, property: "webhooks"): pulumi.Output<MutatingWebhook[]>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", namespace: string, name: string, property: "webhooks"): pulumi.Output<MutatingWebhook[]>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", namespace: string, name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", name: string, property: "items"): pulumi.Output<MutatingWebhookConfiguration[]>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", namespace: string, name: string, property: "items"): pulumi.Output<MutatingWebhookConfiguration[]>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", name: string, property: "kind"): pulumi.Output<"MutatingWebhookConfigurationList">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", namespace: string, name: string, property: "kind"): pulumi.Output<"MutatingWebhookConfigurationList">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", name: string, property: "metadata"): pulumi.Output<ListMeta>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", namespace: string, name: string, property: "metadata"): pulumi.Output<ListMeta>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", namespace: string, name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", name: string, property: "kind"): pulumi.Output<"ValidatingWebhookConfiguration">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", namespace: string, name: string, property: "kind"): pulumi.Output<"ValidatingWebhookConfiguration">
+ 1836 additional overloads

method initialize

protected initialize(args: Inputs): Promise<TData>

Can be overridden by a subclass to asynchronously initialize data for this Component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use .getData.

method isInstance

static isInstance(obj: any): obj is ComponentResource

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.

ComponentResources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.

property resources

resources: pulumi.Output<{[key: string]: CustomResource}>;

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.