kustomize

package
v2.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directory

type Directory struct {
	pulumi.ResourceState

	Resources pulumi.Output
}

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

## Example Usage ### Local Kustomize Directory

```go package main

import (

"github.com/pulumi/pulumi-kubernetes/sdk/v2/go/kubernetes/kustomize"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"

)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := kustomize.NewDirectory(ctx, "helloWorldLocal",
            kustomize.DirectoryArgs{
                Directory: pulumi.String("./helloWorld"),
            },
        )
        if err != nil {
            return err
        }

        return nil
    })
}

``` ### Kustomize Directory from a Git Repo

```go package main

import (

"github.com/pulumi/pulumi-kubernetes/sdk/v2/go/kubernetes/kustomize"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"

)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := kustomize.NewDirectory(ctx, "helloWorldRemote",
            kustomize.DirectoryArgs{
                Directory: pulumi.String("https://github.com/kubernetes-sigs/kustomize/tree/v3.3.1/examples/helloWorld"),
            },
        )
        if err != nil {
            return err
        }

        return nil
    })
}

``` ### Kustomize Directory with Transformations

```go package main

import (

"github.com/pulumi/pulumi-kubernetes/sdk/v2/go/kubernetes/kustomize"
"github.com/pulumi/pulumi-kubernetes/sdk/v2/go/kubernetes/yaml"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"

)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := kustomize.NewDirectory(ctx, "helloWorldRemote",
            kustomize.DirectoryArgs{
                Directory: pulumi.String("https://github.com/kubernetes-sigs/kustomize/tree/v3.3.1/examples/helloWorld"),
                Transformations: []yaml.Transformation{
                    // Make every service private to the cluster, i.e., turn all services into ClusterIP
                    // instead of LoadBalancer.
                    func(state map[string]interface{}, opts ...pulumi.ResourceOption) {
                        if state["kind"] == "Service" {
                            spec := state["spec"].(map[string]interface{})
                            spec["type"] = "ClusterIP"
                        }
                    },

                    // Set a resource alias for a previous name.
                    func(state map[string]interface{}, opts ...pulumi.ResourceOption) {
                        if state["kind"] == "Deployment" {
                            aliases := pulumi.Aliases([]pulumi.Alias{
                                {
                                    Name: pulumi.String("oldName"),
                                },
                            })
                            opts = append(opts, aliases)
                        }
                    },

                    // Omit a resource from the Chart by transforming the specified resource definition
                    // to an empty List.
                    func(state map[string]interface{}, opts ...pulumi.ResourceOption) {
                        name := state["metadata"].(map[string]interface{})["name"]
                        if state["kind"] == "Pod" && name == "test" {
                            state["apiVersion"] = "core/v1"
                            state["kind"] = "List"
                        }
                    },
                },
            },
        )
        if err != nil {
            return err
        }

        return nil
    })
}

```

func NewDirectory

func NewDirectory(ctx *pulumi.Context,
	name string, args DirectoryArgs, opts ...pulumi.ResourceOption) (*Directory, error)

NewDirectory registers a new resource with the given unique name, arguments, and options.

type DirectoryArgs

type DirectoryArgs struct {
	// 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 pulumi.StringInput
	// Transformations is an optional list of transformations to apply to Kubernetes resource definitions
	// before registering with the engine.
	Transformations []yaml.Transformation
	// ResourcePrefix is an optional prefix for the auto-generated resource names. For example, a resource named `bar`
	// created with resource prefix of `"foo"` would produce a resource named `"foo-bar"`.
	ResourcePrefix string
}

DirectoryArgs specifies arguments for constructing a kustomize resource.

func (DirectoryArgs) ElementType

func (DirectoryArgs) ElementType() reflect.Type

func (DirectoryArgs) ToDirectoryArgsOutput

func (i DirectoryArgs) ToDirectoryArgsOutput() DirectoryArgsOutput

func (DirectoryArgs) ToDirectoryArgsOutputWithContext

func (i DirectoryArgs) ToDirectoryArgsOutputWithContext(ctx context.Context) DirectoryArgsOutput

type DirectoryArgsInput

type DirectoryArgsInput interface {
	pulumi.Input

	ToDirectoryArgsOutput() DirectoryArgsOutput
	ToDirectoryArgsOutputWithContext(context.Context) DirectoryArgsOutput
}

type DirectoryArgsOutput

type DirectoryArgsOutput struct{ *pulumi.OutputState }

func (DirectoryArgsOutput) ElementType

func (DirectoryArgsOutput) ElementType() reflect.Type

func (DirectoryArgsOutput) ToDirectoryArgsOutput

func (o DirectoryArgsOutput) ToDirectoryArgsOutput() DirectoryArgsOutput

func (DirectoryArgsOutput) ToDirectoryArgsOutputWithContext

func (o DirectoryArgsOutput) ToDirectoryArgsOutputWithContext(ctx context.Context) DirectoryArgsOutput

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL