kruise

package
v0.0.0-...-4d112fb Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Kruise is a black box CLI that is driven by a config

Kruise helps with abstractly deploying workloads to Kubernetes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(fs *pflag.FlagSet, args []string)

Delete determines passed deployments from args and passes the cobra Cmd FlagSet to the Uninstall function

func Deploy

func Deploy(fs *pflag.FlagSet, args []string)

Deploy determines passed deployments from args and passes the cobra Cmd FlagSet to the Uninstall function

func Init

func Init(fs *pflag.FlagSet, installers ...Installer)

Init invokes the Install function for all Installers that should only be installed during initialization (i.e. HelmRepositories and KubectlSecrets)

func Initialize

func Initialize()

Initialize is used to initialize Kruise

func InitializeConfig

func InitializeConfig()

InitializeConfig is used to initialize Kruise configuration

func InitializeLogger

func InitializeLogger()

InitializeLogger is used to initialize the Kruise logger

func Install

func Install(fs *pflag.FlagSet, installers ...Installer)

Install invokes the Install function for all Installers passed

func Uninstall

func Uninstall(fs *pflag.FlagSet, installers ...Installer)

Uninstall invokes the Uninstall function for all Installers passed

Types

type Command

type Command struct {
	Name   string
	Args   []string
	DryRun bool
	StdOut bool
}

Command defines how to execute a set or arguments on the command line

Used with the exec.Command function: https://pkg.go.dev/os/exec#Command

func (Command) Execute

func (c Command) Execute() error

Execute is used to execute the Kruise Command

type CommandBuilder

type CommandBuilder struct {
	Command
}

CommandBuilder is used to build a Kruise Command

func (CommandBuilder) Build

func (c CommandBuilder) Build() ICommand

Build returns an ICommand from a CommandBuilder

func (CommandBuilder) WithArgs

func (c CommandBuilder) WithArgs(args []string) ICommandBuilder

WithArgs defines the argument list for a command

func (CommandBuilder) WithDryRun

func (c CommandBuilder) WithDryRun(dr bool) ICommandBuilder

WithDryRun determines whether the command should be printed or executed

func (CommandBuilder) WithNoStdOut

func (c CommandBuilder) WithNoStdOut() ICommandBuilder

WithNoStdOut determines whether the command should show stdout upon being executed

type Deployment

type Deployment latest.Deployment

Deployment is used to capture the map key as the name field from the latest.Deployment object

type Deployments

type Deployments []Deployment

Deployments is a slice of Deployment objects

func GetDeployments

func GetDeployments() Deployments

GetDeployments gets deployments from Kruise config

type HelmChart

type HelmChart latest.HelmChart

HelmChart represents information about a Helm chart

func (HelmChart) GetPriority

func (c HelmChart) GetPriority() int

GetPriority is used to get the priority of the installer

func (HelmChart) Install

func (c HelmChart) Install(fs *pflag.FlagSet)

Install is used to execute a Helm install command

func (HelmChart) IsInit

func (m HelmChart) IsInit() bool

IsInit is used to determine whether the installer should be installed during initialization

func (HelmChart) Uninstall

func (c HelmChart) Uninstall(fs *pflag.FlagSet)

Uninstall is used to execute a Helm uninstall command

type HelmCharts

type HelmCharts []HelmChart

HelmCharts represents a slice of HelmChart objects

type HelmDeployment

type HelmDeployment latest.HelmDeployment

HelmDeployment encapsulates Helm objects like HelmRepositories and HelmCharts for a given deployment

type HelmDeployments

type HelmDeployments []HelmDeployment

HelmDeployments represents a slice of HelmDeployment objects

type HelmRepositories

type HelmRepositories []HelmRepository

HelmRepositories represents a slice of HelmRepository objects

type HelmRepository

type HelmRepository latest.HelmRepository

HelmRepository represents information about a Helm repository

func (HelmRepository) GetPriority

func (r HelmRepository) GetPriority() int

GetPriority is used to get the priority of the installer

func (HelmRepository) Install

func (r HelmRepository) Install(fs *pflag.FlagSet)

Install is used to execute a Helm repo add command

func (HelmRepository) IsInit

func (m HelmRepository) IsInit() bool

IsInit is used to determine whether the installer should be installed during initialization

func (HelmRepository) Uninstall

func (r HelmRepository) Uninstall(fs *pflag.FlagSet)

Uninstall is used to execute a Helm repo remove command

type ICommand

type ICommand interface {
	Execute() error
}

ICommand defines the functions for a Kruise Command

type ICommandBuilder

type ICommandBuilder interface {
	WithArgs(a []string) ICommandBuilder
	WithDryRun(dr bool) ICommandBuilder
	WithNoStdOut() ICommandBuilder
	Build() ICommand
}

ICommandBuilder defines the builder functions for the Kruise CommandBuilder

func NewCmd

func NewCmd(name string) ICommandBuilder

NewCmd returns a new Kruise ICommmandBuilder

Not to be confused with the Kruise Kommand which is a wrapper for the cobra Command

type Installer

type Installer interface {
	Install(fs *pflag.FlagSet)
	Uninstall(fs *pflag.FlagSet)
	GetPriority() int
	IsInit() bool
}

Installer represents an interface for generic objects that can be installed and uninstalled

type Installers

type Installers []Installer

Installers represents a slice of Installer objects

type Konfig

type Konfig struct {
	Paths       []string
	HiddenPaths []string
	Name        string
	Override    string
	Manifest    latest.KruiseConfig
}

Konfig struct used to combine file metadata with unmarshalled Kruise configuration

var (
	// Kfg is a global config object for Kruise into which config is unmarshalled
	Kfg *Konfig
	// Logger is the global logger used by Kruise
	Logger *log.Logger
)

func NewKonfig

func NewKonfig() *Konfig

NewKonfig is used to create a new Kruise config (Konfig) object

If the KRUISE_CONFIG environment variable is set, that config file is used, otherwise the following locations are checked in this order:

cwd/kruise.json/toml/yaml

xdg.ConfigHome/kruise/kruise.json/toml/yaml

cwd/.kruise.json/toml/yaml

xdg.ConfigHome/kruise/.kruise.json/toml/yaml

xdg.Home/.kruise.json/toml/yaml

func (*Konfig) ApplyUserConfig

func (k *Konfig) ApplyUserConfig()

ApplyUserConfig reads in a configuration file that is passed to viper and unmarshalled

type KubectlDeployment

type KubectlDeployment latest.KubectlDeployment

KubectlDeployment encapsulates Helm objects like KubectlGenericSecrets, KubectlDockerRegistrySecrets and KubectlManifests for a given deployment

type KubectlDeployments

type KubectlDeployments []KubectlDeployment

KubectlDeployments represents a slice of KubectlDeployment objects

type KubectlDockerRegistrySecret

type KubectlDockerRegistrySecret struct {
	latest.KubectlDockerRegistrySecret
	Namespaces []string
}

KubectlDockerRegistrySecret represents information about a docker-registry Kubernetes secret The Namespaces field is used to support creating the same secret across multiple namespaces and only prompting the user once.

func (KubectlDockerRegistrySecret) GetPriority

func (s KubectlDockerRegistrySecret) GetPriority() int

GetPriority is used to get the priority of the installer

func (KubectlDockerRegistrySecret) Install

func (s KubectlDockerRegistrySecret) Install(fs *pflag.FlagSet)

Install is used to execute a Kubectl create docker-registry secret command

func (KubectlDockerRegistrySecret) IsInit

func (m KubectlDockerRegistrySecret) IsInit() bool

IsInit is used to determine whether the installer should be installed during initialization

func (KubectlDockerRegistrySecret) Uninstall

func (s KubectlDockerRegistrySecret) Uninstall(fs *pflag.FlagSet)

Uninstall is used to execute a Kubectl delete secret command

type KubectlDockerRegistrySecrets

type KubectlDockerRegistrySecrets []KubectlDockerRegistrySecret

KubectlDockerRegistrySecrets represents a slice of KubectlDockerRegistrySecret objects

type KubectlGenericSecret

type KubectlGenericSecret struct {
	latest.KubectlGenericSecret
	Namespaces []string
}

KubectlGenericSecret represents information about a generic Kubernetes secret The Namespaces field is used to support creating the same secret across multiple namespaces and only prompting the user once.

func (KubectlGenericSecret) GetPriority

func (s KubectlGenericSecret) GetPriority() int

GetPriority is used to get the priority of the installer

func (KubectlGenericSecret) Install

func (s KubectlGenericSecret) Install(fs *pflag.FlagSet)

Install is used to execute a Kubectl create generic secret command

func (KubectlGenericSecret) IsInit

func (m KubectlGenericSecret) IsInit() bool

IsInit is used to determine whether the installer should be installed during initialization

func (KubectlGenericSecret) Uninstall

func (s KubectlGenericSecret) Uninstall(fs *pflag.FlagSet)

Uninstall is used to execute a Kubectl delete secret command

type KubectlGenericSecrets

type KubectlGenericSecrets []KubectlGenericSecret

KubectlGenericSecrets represents a slice of KubectlGenericSecret objects

type KubectlManifest

type KubectlManifest latest.KubectlManifest

KubectlManifest represents information about a Kubectl manifest

func (KubectlManifest) GetPriority

func (m KubectlManifest) GetPriority() int

GetPriority is used to get the priority of the installer

func (KubectlManifest) Install

func (m KubectlManifest) Install(fs *pflag.FlagSet)

Install is used to execute a Kubectl apply command

func (KubectlManifest) IsInit

func (m KubectlManifest) IsInit() bool

IsInit is used to determine whether the installer should be installed during initialization

func (KubectlManifest) Uninstall

func (m KubectlManifest) Uninstall(fs *pflag.FlagSet)

Uninstall is used to execute a Kubectl delete command

type KubectlManifests

type KubectlManifests []KubectlManifest

KubectlManifests represents a slice of KubectlManifest objects

type Profile

type Profile latest.Profile

Profile represents the arguments and description for a CLI profile

type Profiles

type Profiles []Profile

Profiles represents a slice of Profile objects

func GetDeployProfiles

func GetDeployProfiles() Profiles

GetDeployProfiles gets deploy profiles from Kruise config

Jump to

Keyboard shortcuts

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