kube

package
v0.0.0-...-614ca16 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRole core.ClusterRole = "default"
View Source
const (
	DefaultStackName = "default"
)
View Source
const (
	LabelNamespaceRole = "naveego.com/namespace-role"
)
View Source
const (
	StackLabel = "bosun.aunalytics.com/stack"
)

Variables

This section is empty.

Functions

func ConfigureMickok8sNetworking

func ConfigureMickok8sNetworking() error

func PortForward

func PortForward(podName, namespace string, port int) func()

PortForward creates a long running port forward command that runs until you call the return function. It will keep trying to re open the port indefinitely.

func TemplateFuncs

func TemplateFuncs() template.FuncMap

Types

type AmazonClusterConfig

type AmazonClusterConfig struct {
	Region string `yaml:"region"`
}

type Cluster

type Cluster struct {
	ClusterConfig
	Kubectl Kubectl
	Client  *kubernetes.Clientset
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster(config ClusterConfig, ctx command.ExecutionContext, allowIncomplete bool) (*Cluster, error)

func (*Cluster) Activate

func (c *Cluster) Activate() error

func (*Cluster) ConfigureKubectl

func (c *Cluster) ConfigureKubectl() error

func (*Cluster) CreateStack

func (c *Cluster) CreateStack(name string, templateName string) (*Stack, error)

func (*Cluster) GetDefaultNamespace

func (c *Cluster) GetDefaultNamespace() string

func (*Cluster) GetStack

func (c *Cluster) GetStack(name string) (*Stack, error)

func (*Cluster) GetStackState

func (c *Cluster) GetStackState(name string) (*StackState, error)

func (*Cluster) GetStackStateFast

func (c *Cluster) GetStackStateFast(name string) (*StackState, error)

func (*Cluster) GetStackStates

func (c *Cluster) GetStackStates() (StackStateMap, error)

func (*Cluster) GetStackTemplate

func (c *Cluster) GetStackTemplate(templateName string) (*StackTemplate, error)

func (*Cluster) GetStackTemplateForStackName

func (c *Cluster) GetStackTemplateForStackName(name string) (*StackTemplate, error)

func (*Cluster) GetStackTemplates

func (c *Cluster) GetStackTemplates() []*StackTemplate

func (*Cluster) SaveStackState

func (c *Cluster) SaveStackState(stackState *StackState) error

type ClusterCert

type ClusterCert struct {
	SecretName string                `yaml:"secretName"`
	VaultUrl   string                `yaml:"vaultUrl"`
	VaultToken *command.CommandValue `yaml:"vaultToken"`
	VaultPath  string                `yaml:"vaultPath"`
	CommonName string                `yaml:"commonName"`
	AltNames   []string              `yaml:"altNames"`
}

type ClusterConfig

type ClusterConfig struct {
	StackTemplate    `yaml:",inline"`
	KubeconfigPath   string                 `yaml:"kubeconfigPath,omitempty"`
	Provider         string                 `yaml:"-"`
	EnvironmentAlias string                 `yaml:"environmentAlias,omitempty"`
	Environment      string                 `yaml:"environment,omitempty"`
	DefaultNamespace string                 `yaml:"defaultNamespace,omitempty"`
	Roles            core.ClusterRoles      `yaml:"roles,flow"`
	Protected        bool                   `yaml:"protected"`
	Oracle           *OracleClusterConfig   `yaml:"oracle,omitempty"`
	Minikube         *MinikubeConfig        `yaml:"minikube,omitempty"`
	Microk8s         *Microk8sConfig        `yaml:"microk8s,omitempty"`
	Amazon           *AmazonClusterConfig   `yaml:"amazon,omitempty"`
	Rancher          *RancherClusterConfig  `yaml:"rancher,omitempty"`
	ExternalCluster  *ExternalClusterConfig `yaml:"externalCluster,omitempty"`
	StackTemplates   []*StackTemplate       `yaml:"stackTemplates,omitempty"`
	IsDefaultCluster bool                   `yaml:"isDefaultCluster"`
	Aliases          []string               `yaml:"aliases,omitempty"`
	// Set by the environment during load
	PullSecrets []PullSecret  `yaml:"-"`
	Brn         brns.StackBrn `yaml:"-"`
}

func (ClusterConfig) GetKubeconfigPath

func (c ClusterConfig) GetKubeconfigPath() string

func (*ClusterConfig) GetValueSetCollection

func (e *ClusterConfig) GetValueSetCollection() values.ValueSetCollection

func (*ClusterConfig) MarshalYAML

func (f *ClusterConfig) MarshalYAML() (interface{}, error)

func (*ClusterConfig) SetFromPath

func (c *ClusterConfig) SetFromPath(fp string)

func (*ClusterConfig) UnmarshalYAML

func (f *ClusterConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type ClusterConfigs

type ClusterConfigs []*ClusterConfig

func (ClusterConfigs) GetCluster

func (k ClusterConfigs) GetCluster(name string, ctx command.ExecutionContext) (*Cluster, error)

func (ClusterConfigs) GetClusterConfig

func (k ClusterConfigs) GetClusterConfig(name string) (*ClusterConfig, error)

func (ClusterConfigs) GetClusterConfigByBrn

func (k ClusterConfigs) GetClusterConfigByBrn(brn brns.StackBrn) (*ClusterConfig, error)

func (ClusterConfigs) GetPossiblyUnconfiguredCluster

func (k ClusterConfigs) GetPossiblyUnconfiguredCluster(name string, ctx command.ExecutionContext) (*Cluster, error)

func (ClusterConfigs) Headers

func (k ClusterConfigs) Headers() []string

func (ClusterConfigs) Rows

func (k ClusterConfigs) Rows() [][]string

type ClusterRoleGetter

type ClusterRoleGetter interface {
	GetClusterRole() core.ClusterRole
}

type ConfigureCertsAction

type ConfigureCertsAction struct{}

type ConfigureContextAction

type ConfigureContextAction struct{}

type ConfigureNamespacesAction

type ConfigureNamespacesAction struct{}

type ConfigurePullSecretsAction

type ConfigurePullSecretsAction struct{}

type ConfigureRequest

type ConfigureRequest struct {
	Action           interface{}
	Brn              brns.StackBrn
	KubeConfigPath   string
	Force            bool
	Log              *logrus.Entry
	ExecutionContext command.ExecutionContext
}

type ExternalClusterConfig

type ExternalClusterConfig struct {
}

ExternalClusterConfig represents a cluster we do not control. When using this we will not create things like storage classes etc.

type Kubectl

type Kubectl struct {
	Namespace  string
	Cluster    string
	Kubeconfig string
}

func (Kubectl) Exec

func (k Kubectl) Exec(args ...string) (string, error)

type Microk8sConfig

type Microk8sConfig struct {
	Channel        string `yaml:"channel"`
	Remote         bool   `yaml:"remote"`
	SSHKeyLocation string `yaml:"sshKeyLocation,omitempty"`
	SSHDestination string `yaml:"sshDestination,omitempty"`
}

type MinikubeConfig

type MinikubeConfig struct {
	HostIP   string `yaml:"hostIP" json:"hostIP"`
	Driver   string `yaml:"driver" json:"driver"`
	DiskSize string `yaml:"diskSize" json:"diskSize"`
	MemoryMB int    `yaml:"memoryMB,omitempty"`
	CPUs     int    `yaml:"cpus,omitempty"`
	Version  string `yaml:"version" json:"version"`
}

type NamespaceConfig

type NamespaceConfig struct {
	Name   string `yaml:"name"`
	Shared bool   `yaml:"shared,omitempty"`
}

type NamespaceConfigs

type NamespaceConfigs map[core.NamespaceRole]NamespaceConfig

func (NamespaceConfigs) ToStringMap

func (n NamespaceConfigs) ToStringMap() map[string]NamespaceConfig

func (NamespaceConfigs) UniqueNames

func (n NamespaceConfigs) UniqueNames() []string

type OracleClusterConfig

type OracleClusterConfig struct {
	OCID   string `yaml:"ocid"`
	Region string `yaml:"region"`
}

type PullSecret

type PullSecret struct {
	Name             string               `yaml:"name"`
	Domain           string               `yaml:"domain"`
	FromDockerConfig bool                 `yaml:"fromDockerConfig,omitempty"`
	Username         string               `yaml:"username,omitempty"`
	Password         command.CommandValue `yaml:"password,omitempty"`
}

type RancherClusterConfig

type RancherClusterConfig struct {
}

type Stack

type Stack struct {
	StackTemplate
	Brn     brns.StackBrn
	Cluster *Cluster

	// Set to true if we have reason to think that this stack has been defined and deployed
	BelievedToExist bool
	// contains filtered or unexported fields
}

func NewStack

func NewStack(cluster *Cluster, name string, templateName string, template StackTemplate) (*Stack, error)

func NewStackFromState

func NewStackFromState(cluster *Cluster, state *StackState) (*Stack, error)

func (Stack) ConfigureCerts

func (k Stack) ConfigureCerts() error

func (Stack) ConfigureNamespaces

func (k Stack) ConfigureNamespaces() error

func (Stack) ConfigurePullSecrets

func (k Stack) ConfigurePullSecrets() error

func (*Stack) Destroy

func (c *Stack) Destroy() error

func (*Stack) GetAppValueSetCollectionProvider

func (c *Stack) GetAppValueSetCollectionProvider(appName string) values.ValueSetCollectionProvider

func (*Stack) GetNamespace

func (k *Stack) GetNamespace(role core.NamespaceRole) (NamespaceConfig, error)

func (*Stack) GetState

func (c *Stack) GetState(refresh bool) (*StackState, error)

func (*Stack) GetStoryID

func (c *Stack) GetStoryID() string

func (*Stack) GetValueSetCollection

func (e *Stack) GetValueSetCollection() values.ValueSetCollection

func (*Stack) Initialize

func (k *Stack) Initialize() error

func (Stack) IsAppDisabled

func (s Stack) IsAppDisabled(name string) bool

func (*Stack) IsInitialized

func (c *Stack) IsInitialized() bool

func (*Stack) Save

func (c *Stack) Save() error

func (*Stack) SetStoryID

func (c *Stack) SetStoryID(id string)

func (*Stack) UpdateApp

func (c *Stack) UpdateApp(updates ...StackApp) error

type StackApp

type StackApp struct {
	Name         string    `yaml:"name"`
	Version      string    `yaml:"version"`
	Release      string    `yaml:"release"`
	Provider     string    `yaml:"provider"`
	Repo         string    `yaml:"repo"`
	Branch       string    `yaml:"branch"`
	Commit       string    `yaml:"commit"`
	DeployedAt   time.Time `yaml:"deployedAt"`
	DevopsBranch string    `yaml:"devopsBranch"`
	StoryKey     string    `yaml:"storyKey"`
	Details      string    `yaml:"details"`
}

type StackState

type StackState struct {
	Name          string `yaml:"name"`
	TemplateName  string `yaml:"templateName"`
	StoryID       string `yaml:"storyId"`
	Uninitialized bool
	DeployedApps  map[string]StackApp `yaml:"apps"`
}

func (StackState) Headers

func (s StackState) Headers() []string

func (StackState) Rows

func (s StackState) Rows() [][]string

type StackStateMap

type StackStateMap map[string]*StackState

func (StackStateMap) Headers

func (s StackStateMap) Headers() []string

func (StackStateMap) Rows

func (s StackStateMap) Rows() [][]string

type StackTemplate

type StackTemplate struct {
	core.ConfigShared `yaml:",inline"`
	NamePattern       string                               `yaml:"namePattern"`
	Variables         []*environmentvariables.Variable     `yaml:"variables,omitempty"`
	Namespaces        NamespaceConfigs                     `yaml:"namespaces"`
	Apps              map[string]values.ValueSetCollection `yaml:"apps"`
	Certs             []ClusterCert                        `yaml:"certs"`
	ValueOverrides    *values.ValueSetCollection           `yaml:"valueOverrides,omitempty"`
}

func (*StackTemplate) Render

func (e *StackTemplate) Render(name string) (*StackTemplate, error)

func (*StackTemplate) SetFromPath

func (e *StackTemplate) SetFromPath(path string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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