k3d

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 18 Imported by: 0

README

K3d

Usage

Plugin
package plugin

type Plugin struct {
	l        log.Logger
  k3d      *k3d.K3d
	commands command.Commands
}

func New(l log.Logger) (plugin.Plugin, error) {
	inst := &Plugin{
		l:        l,
		commands: command.Commands{},
	}

  var err error

  // ...

  inst.k3d, err = k3d.New(l)
  if err != nil {
    return nil, errors.Wrap(err, "failed to create k3d")
  }

	// ...

  inst.commands.MustAdd(k3d.NewCommand(l, inst.k3d, inst.kubectl))

	// ...

	return inst, nil
}
Config
## K3d
k3d:
  charts:
    path: devops/k3d
    prefix: shared-
  registry:
    name: foomo-registry
    port: 12345
  clusters:
    local:
      port: 9443
      alias: foomo
      enableTraefikRouter: false
      image: rancher/k3s:v1.28.2-k3s1
Ownbrew

To install binary locally, add:

ownbrew:
  packages:
    ## https://github.com/k3d-io/k3d/releases
    - name: k3d
      tap: foomo/tap/k3d-io/k3d
      version: 5.6.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterChecker added in v0.4.1

func ClusterChecker(inst *K3d, name string) check.Checker

func RegistryChecker added in v0.4.1

func RegistryChecker(inst *K3d) check.Checker

Types

type Cluster

type Cluster struct {
	Name string `json:"name"`
}

type Command

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

func NewCommand

func NewCommand(l log.Logger, k3d *K3d, kubectl *kubectl.Kubectl, opts ...CommandOption) (*Command, error)

func (*Command) Complete

func (c *Command) Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest

func (*Command) Description

func (c *Command) Description() string

func (*Command) Execute

func (c *Command) Execute(ctx context.Context, r *readline.Readline) error

func (*Command) Help

func (c *Command) Help(ctx context.Context, r *readline.Readline) string

func (*Command) Name

func (c *Command) Name() string

type CommandOption

type CommandOption func(*Command) error

func CommandWithName

func CommandWithName(v string) CommandOption

type Config

type Config struct {
	Charts   ConfigCharts             `json:"charts" yaml:"charts"`
	Registry ConfigRegistry           `json:"registry" yaml:"registry"`
	Clusters map[string]ConfigCluster `json:"clusters" yaml:"clusters"`
}

func (Config) Cluster

func (c Config) Cluster(name string) (ConfigCluster, error)

func (Config) ClusterNames

func (c Config) ClusterNames() []string

type ConfigCharts

type ConfigCharts struct {
	Path   string `json:"path" yaml:"path"`
	Prefix string `json:"prefix" yaml:"prefix"`
}

func (ConfigCharts) Names

func (c ConfigCharts) Names() ([]string, error)

type ConfigCluster

type ConfigCluster struct {
	// Cluster name
	Name string `json:"-" yaml:"-"`
	// K3d cluster name
	Alias string `json:"alias" yaml:"alias"`
	// Docker image to use
	Image string `json:"image" yaml:"image"`
	// Port to bind to
	Port string `json:"port" yaml:"port"`
	// EnableTraefikRouter allows to create the cluster with the default traefik router
	EnableTraefikRouter bool `json:"enableTraefikRouter" yaml:"enableTraefikRouter"`
	// Additional arguments
	Args []string `json:"args" yaml:"args"`
}

func (ConfigCluster) AliasName

func (c ConfigCluster) AliasName() string

type ConfigRegistry

type ConfigRegistry struct {
	Name string `json:"name" yaml:"name"`
	Port string `json:"port" yaml:"port"`
}

type K3d

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

func New

func New(l log.Logger, opts ...Option) (*K3d, error)

func (*K3d) Cluster

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

func (*K3d) Config

func (i *K3d) Config() *Config

func (*K3d) Registry

func (i *K3d) Registry(ctx context.Context, name string) (*Registry, error)

type Option

type Option func(*K3d) error

func WithConfigKey

func WithConfigKey(v string) Option

type Registry

type Registry struct {
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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