kubectl

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyKustomization

func ApplyKustomization(ctx context.Context, kubeconfigPath string, opts *ApplyKustomizationOptions, filePaths ...string) error

ApplyKustomization applies the given files to the cluster that the kubeconfigPath points to with the given ApplyKustomizationOptions.

Example:

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

err := ApplyKustomization(
	ctx,
	"/path/to/kubeconfig",
	&ApplyKustomizationOptions{
	},
	[]string{
		"/path/to/kustomization",
	},
)
if err != nil {
	// Handle error
}

func ApplyManifests

func ApplyManifests(ctx context.Context, kubeconfigPath string, opts *ApplyManifestsOptions, filePaths ...string) error

ApplyManifests applies the given files to the cluster that the kubeconfigPath points to with the given ApplyManifestsOptions.

Example:

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

err := ApplyManifests(
	ctx,
	"/path/to/kubeconfig",
	&ApplyManifestsOptions{
	},
	[]string{
		"/path/to/manifest1.yaml",
		"/path/to/manifest2.yaml",
	},
)
if err != nil {
	// Handle error
}

func DeleteKustomization

func DeleteKustomization(ctx context.Context, kubeconfigPath string, filePaths ...string) error

DeleteKustomization deletes the resources created by the given kustomization files from the cluster that the kubeconfigPath points to.

Example:

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

err := DeleteKustomization(
	ctx,
	"/path/to/kubeconfig",
	[]string{"path/to/kustomization1", "path/to/kustomization2"}...
)

if err != nil {
	// Handle error
}

func DeleteManifests

func DeleteManifests(ctx context.Context, kubeconfigPath string, filePaths ...string) error

DeleteManifests deletes the resource created by the given manifest files from the cluster that the kubeconfigPath points to.

Example:

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

err := DeleteManifests(
	ctx,
	"/path/to/kubeconfig",
	[]string{"path/to/file1", "path/to/file2"}...
)

if err != nil {
	// Handle error
}

Types

type ApplyKustomizationOptions

type ApplyKustomizationOptions struct {
	// FIXME: When dry-run is working, we should add it here
	// DryRun    DryRunType
	Recursive bool
}

type ApplyManifestsOptions

type ApplyManifestsOptions struct {
	// FIXME: When dry-run is working, we should add it here
	// DryRun    DryRunType
	Recursive bool
}

type DryRunType

type DryRunType uint8
const (
	DryRunNone DryRunType = iota
	DryRunClient
	DryRunServer
)

func (DryRunType) String

func (d DryRunType) String() string

Jump to

Keyboard shortcuts

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