common

package
v0.0.71 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecCommand

func ExecCommand(name string, arg ...string) error

ExecCommand runs a command

func ExecCommandGetOutput added in v0.0.54

func ExecCommandGetOutput(name string, arg ...string) (string, error)

ExecCommandGetOutput run command and get output

func ExecCommandInDirectory added in v0.0.62

func ExecCommandInDirectory(name, dir string, arg ...string) (err error)

ExecCommandInDirectory runs a command in a particular directory

func GetClient

func GetClient() (client dynamic.Interface, clientSet *kubernetes.Clientset, err error)

GetClient returns the k8s client

func GetClientset added in v0.0.50

func GetClientset(ctx context.Context) (clientset *kubernetes.Clientset)

GetClientset gets the clientset of k8s

func GetDynamicClient added in v0.0.50

func GetDynamicClient(ctx context.Context) (client dynamic.Interface)

GetDynamicClient gets the dynamic k8s client from context

func GetKubeShpereDeployment

func GetKubeShpereDeployment() []string

GetKubeShpereDeployment returns the deployment of KubeSphere

func GetNightlyTag

func GetNightlyTag(date string) (dateStr, tag string)

GetNightlyTag parse the nightly tag

func GetPluginAbleComponents

func GetPluginAbleComponents() []string

GetPluginAbleComponents returns the component list which can plug-in or plug-out

func GetRestClient added in v0.0.51

func GetRestClient(ctx context.Context) (client *rest.RESTClient)

GetRestClient returns the restClient of the Kubernetes

func NoFileCompletion

func NoFileCompletion(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective)

NoFileCompletion avoid completion with files

func PortIsFree

func PortIsFree(port int) bool

PortIsFree checks if the port is free or not

func UpdateWithEditor

func UpdateWithEditor(resource schema.GroupVersionResource, ns, name string, client dynamic.Interface) (err error)

UpdateWithEditor update the k8s resources with a editor

Types

type Authentication added in v0.0.48

type Authentication struct {
	JwtSecret string `yaml:"jwtSecret"`
}

Authentication represents the Authentication of KubeSphere

type ClientFactory added in v0.0.50

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

ClientFactory is for getting k8s client

func (*ClientFactory) GetClient added in v0.0.50

func (c *ClientFactory) GetClient() (client dynamic.Interface, clientSet *kubernetes.Clientset, restClient *rest.RESTClient)

GetClient returns k8s client

func (*ClientFactory) SetContext added in v0.0.50

func (c *ClientFactory) SetContext(ctx string)

SetContext sets the k8s context

type CompletionFunc

type CompletionFunc func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

CompletionFunc is the function for command completion

func ArrayCompletion

func ArrayCompletion(array ...string) CompletionFunc

ArrayCompletion return a completion which base on an array

func KubeSphereDeploymentCompletion

func KubeSphereDeploymentCompletion() CompletionFunc

KubeSphereDeploymentCompletion returns a completion function for KuebSphere deployments

func PluginAbleComponentsCompletion

func PluginAbleComponentsCompletion() CompletionFunc

PluginAbleComponentsCompletion returns a completion function for pluginAble components

type ComponentStatus

type ComponentStatus struct {
	Enabled bool
}

ComponentStatus is a common status

type FreePort

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

FreePort is the tool to find free ports of KubeSphere

func NewFreePort added in v0.0.62

func NewFreePort(extraCount int) *FreePort

NewFreePort creates a FreePort with a specific extra count of ports

func (*FreePort) FindFreePortsOfKubeSphere

func (f *FreePort) FindFreePortsOfKubeSphere() ([]int, error)

FindFreePortsOfKubeSphere returns the free ports of KubeSphere The order of the ports is: console, jenkins

type KSInstaller

type KSInstaller struct {
	Spec KSInstallerSpec `yaml:"spec"`
}

KSInstaller is the installer for KubeSphere

type KSInstallerSpec

type KSInstallerSpec struct {
	Version        string
	ImageNamespace string

	Authentication Authentication `yaml:"authentication"`
	Servicemesh    ComponentStatus
	Openpitrix     ComponentStatus
	Notification   ComponentStatus
	NetworkPolicy  ComponentStatus
	MetricsServer  ComponentStatus
	Logging        ComponentStatus
	Events         ComponentStatus
	DevOps         ComponentStatus
	Auditing       ComponentStatus
	Alerting       ComponentStatus
	Multicluster   Multicluster `yaml:"multicluster"`
}

KSInstallerSpec is ks-installer

type Multicluster

type Multicluster struct {
	ClusterRole string `yaml:"clusterRole"`
}

Multicluster represents multi-cluster

Jump to

Keyboard shortcuts

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