kindenv

package
v2.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Overview

Package kindenv manages Kind (github.com/kubernetes-sigs/kind) environments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SkopeoCommand

func SkopeoCommand(ctx context.Context, args ...string) *exec.Cmd

Types

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

Cluster represents a Kind cluster. It may not exist yet.

func New

func New(ctx context.Context, name string) (*Cluster, error)

New creates a new Cluster object, suitable for manipulating the named cluster. If name is empty, the cluster in the current kubernetes context will be used, if it's a pachdev cluster.

func (*Cluster) AllocatePort

func (c *Cluster) AllocatePort(ctx context.Context, namespace, service string) (string, error)

Allocate port returns a port number for the named service. If multiple ports are allocated to the named service, they are all returned separated by commas.

func (*Cluster) Close

func (c *Cluster) Close() error

Close cleans up temporary data associated with the Cluster object.

func (*Cluster) ConfigurePachctl

func (c *Cluster) ConfigurePachctl(ctx context.Context, namespace string, activate bool) error

func (*Cluster) Create

func (c *Cluster) Create(ctx context.Context, opts *CreateOpts) (retErr error)

Create creates a new cluster.

func (*Cluster) Delete

func (c *Cluster) Delete(ctx context.Context) error

Delete destroys the cluster.

func (*Cluster) GetConfig

func (c *Cluster) GetConfig(ctx context.Context, namespace string) (*ClusterConfig, error)

func (*Cluster) GetKubeconfig

func (c *Cluster) GetKubeconfig(ctx context.Context) (Kubeconfig, error)

GetKubeconfig returns a Kubeconfig object for the cluster. Call `Close()` when you're done to avoid filling up /tmp with junk.

func (*Cluster) InstallPachyderm

func (c *Cluster) InstallPachyderm(ctx context.Context, install *HelmConfig) error

InstallPachyderm installs or upgrades Pachyderm.

func (*Cluster) PachdAddress

func (c *Cluster) PachdAddress(ctx context.Context, namespace string) (string, error)

func (*Cluster) PushImage

func (c *Cluster) PushImage(ctx context.Context, src string, name string) error

PushImage pushes an image to the cluster.

func (*Cluster) PushPachyderm

func (c *Cluster) PushPachyderm(ctx context.Context) error

PushPachyderm pushes the images necessary to run Pachyderm.

func (*Cluster) WaitForPachd

func (c *Cluster) WaitForPachd(ctx context.Context, namespace string) error

type ClusterConfig

type ClusterConfig struct {
	// Version of kindenv that deployed the cluster.
	Version int
	// A skopeo url that pushes images to this cluster.
	ImagePushPath string
	// A docker prefix that pulls images pushed to this cluster; use in
	// pod.spec.containers.image to refer to images pushed to this cluster.
	ImagePullPath string
	// A hostname that serves the exposed ports of the cluster.
	Hostname string
	// If true, use https/grpcs.
	TLS bool
	// If set, override the version of console.
	ConsoleTag string
}

ClusterConfig is the configuration of the attached cluster.

type CreateOpts

type CreateOpts struct {
	// TestNamespaceCount controls how many K8s tests can run concurrently.
	TestNamespaceCount int32
	// ExternalHostname is the hostname for the cluster.
	ExternalHostname string
	// ImagePushPath is the Skopeo path of the local container registry from the host machine,
	// usually something like `oci:/path/to/pach-registry`.  If empty, a new registry will be
	// started and a correct push path automatically configured.
	ImagePushPath string
	// BindHTTPPorts, if true, binds <externalHost>:80 and <externalHost>:443 to 30080 and 30443
	// in the cluster; used for the install of Pachyderm in the "default" namespace.
	BindHTTPPorts bool
	// StartingPort is the port number that begins the exposed ports for this cluster.  Each
	// TestNamespace gets 10.  If -1, then no ports will be created.  If unset (0), then ports
	// start at 30500.
	StartingPort int32
	// TLS is true if external communications to pachd/console should use tls (grpcs, https).
	TLS bool
	// contains filtered or unexported fields
}

CreateOpts specifies a Kind environment.

Note: kind treats port numbers as int32, so we do too.

type HelmConfig

type HelmConfig struct {
	Namespace       string // Must be set; "" does not mean "default".
	Diff            bool   // If true, print diff instead of performing upgrade.
	NoSwitchContext bool   // If true, don't switch the active Pachyderm context to this.
	ConsoleTag      string // If set, use a different image tag of console.
}

type Kubeconfig

type Kubeconfig string

Kubeconfig is the path to a kubeconfig file. It has methods on it for working on the cluster that is configured by that file.

func (Kubeconfig) Client

func (k Kubeconfig) Client() (kubernetes.Interface, error)

Client returns a kubernetes.Interface connected to the cluster referenced by k.

func (*Kubeconfig) Close

func (k *Kubeconfig) Close() error

Close removes the kubeconfig file.

func (Kubeconfig) HelmCommand

func (k Kubeconfig) HelmCommand(ctx context.Context, args ...string) *exec.Cmd

HelmCommand returns an exec.Cmd that will run helm.

func (Kubeconfig) KubectlCommand

func (k Kubeconfig) KubectlCommand(ctx context.Context, args ...string) *exec.Cmd

KubectlCommand returns an exec.Cmd that will run kubectl.

Jump to

Keyboard shortcuts

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