kubernetes

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client = dapr.Client
View Source
var ErrDaprNotInstall = errors.New("dapr is not installed in your cluster")

Functions

func AddRepo added in v0.4.5

func AddRepo(name, url string) error

func AdminLogin added in v0.4.5

func AdminLogin(password string) (token string, err error)

func CleanToken added in v0.4.5

func CleanToken()

func CoreApply added in v0.4.5

func CoreApply(filenames []string) error

func CoreCreate added in v0.4.5

func CoreCreate(filenames []string) error

func CoreGet added in v0.4.5

func CoreGet(entityID string) error

func CoreList added in v0.4.5

func CoreList(search, selector string) error

func CoreWatch added in v0.4.5

func CoreWatch(entityID string) error

func CreateTenant

func CreateTenant(tenant *TenantCreateIn) error

func DeleteRepo added in v0.4.5

func DeleteRepo(name string) error

func DisablePlugin added in v0.4.5

func DisablePlugin(pluginID, tenantID string) error

func EnablePlugin added in v0.4.5

func EnablePlugin(pluginID, tenantID string) error

func GetStatusAndHealthyInPodList added in v0.2.0

func GetStatusAndHealthyInPodList(appList DaprAppList) (status string, healthy string)

GetStatusAndHealthyInPodList loop through all replicas and update to Running/Healthy status only if all instances are Running and Healthy.

func GetTKeelNamespace added in v0.4.5

func GetTKeelNamespace(client k8s.Interface) (string, error)

func GroupByAppID added in v0.4.5

func GroupByAppID(l DaprAppList) map[string]DaprAppList

func HelmUninstall added in v0.4.5

func HelmUninstall(namespace, pluginName string) (*release.UninstallReleaseResponse, error)

func Init

func Init(config InitConfiguration) error

Init deploys the tKeel operator using the supplied runtime version.

func Install added in v0.4.5

func Install(repo, plugin, version, name string, config []byte) error

func Invoke added in v0.2.0

func Invoke(pluginID, method string, data []byte, verb string, reqOpts ...RestRequestOption) (string, error)

Invoke is a command to invoke a remote or local dapr instance.

func InvokeByPortForward added in v0.4.5

func InvokeByPortForward(pluginID, method string, data []byte, verb string, reqOpts ...HTTPRequestOption) (string, error)

InvokeByPortForward is a command to invoke a remote or local dapr instance.

func KeelChart added in v0.4.5

func KeelChart(config InitConfiguration) (*chart.Chart, *chart.Chart, *chart.Chart, map[string]map[string]interface{}, error)

func PluginUpgrade added in v0.4.5

func PluginUpgrade(repo, plugin, version, name string, config []byte) error

func RegisterPlugin added in v0.4.5

func RegisterPlugin(plugin string) error

func RegisterPlugins

func RegisterPlugins(client k8s.Interface, pluginID string) error

func TenantCreate

func TenantCreate(title, remark, adminName, adminPW string) error

func TenantDelete added in v0.4.5

func TenantDelete(tenantID string) error

func TenantUserCreate added in v0.4.5

func TenantUserCreate(tenantID, username, password string) error

func TenantUserDelete added in v0.4.5

func TenantUserDelete(tenantID, userID string) error

tenant user manage.

func Uninstall

func Uninstall(pluginID string, debugMode bool) error

Uninstall removes tKeel's plugin from a Kubernetes cluster.

func UninstallAllPlugin added in v0.4.5

func UninstallAllPlugin(namespace string, debugMode bool) error

func UninstallPlatform added in v0.4.5

func UninstallPlatform(namespace string, timeout uint, debugMode bool) error

UninstallPlatform removes tKeel from a Kubernetes cluster.

func UninstallPlugin added in v0.4.5

func UninstallPlugin(pluginID string) error

func Upgrade added in v0.4.5

func Upgrade(config InitConfiguration) error

func WebsocketByPortForward added in v0.4.5

func WebsocketByPortForward(pluginID, method string, data []byte) (string, error)

WebsocketByPortForward websocket request to the k8s pod.

func WithAppPod added in v0.4.5

func WithAppPod(pf *PortForward, app *AppPod) error

func WithAppPort added in v0.4.5

func WithAppPort(pf *PortForward, app *AppPod) error

func WithHTTPPort added in v0.4.5

func WithHTTPPort(pf *PortForward, app *AppPod) error

Types

type AddRepoRequest added in v0.4.5

type AddRepoRequest struct {
	URL string `json:"url"`
}

type AppInfo added in v0.4.5

type AppInfo struct {
	AppID     string `csv:"APP ID"      json:"app_id"        yaml:"app_id"`
	HTTPPort  int    `csv:"HTTP PORT"   json:"http_port"     yaml:"http_port"`
	GRPCPort  int    `csv:"GRPC PORT"   json:"grpc_port"     yaml:"grpc_port"`
	AppPort   int    `csv:"APP PORT"    json:"app_port"      yaml:"app_port"`
	PodName   string `csv:"POD NAME"    json:"pod_name"      yaml:"pod_name"`
	Namespace string `csv:"NAMESPACE"   json:"namespace"    yaml:"namespace"`
	Age       string `csv:"AGE"      json:"age"     yaml:"age"`
	Created   string `csv:"CREATED"  json:"created" yaml:"created"`
	Version   string `csv:"VERSION"  json:"version" yaml:"version"`
}

func (*AppInfo) Request added in v0.4.5

func (a *AppInfo) Request(r *rest.Request, method string, data []byte) (*rest.Request, error)

type AppPod added in v0.2.0

type AppPod struct {
	AppInfo
	// contains filtered or unexported fields
}

func GetAppPod added in v0.4.5

func GetAppPod(client k8s.Interface, appID string) (*AppPod, error)

type AuthRequest added in v0.4.5

type AuthRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type CoreStruct added in v0.4.5

type CoreStruct struct {
	APIVersion string                 `yaml:"apiVersion"` //nolint
	Type       string                 `yaml:"type"`
	ID         string                 `yaml:"id"`
	Source     string                 `yaml:"source"`
	Owner      string                 `yaml:"owner"`
	Properties map[string]interface{} `yaml:"properties"`
}

type DaprAppList added in v0.4.5

type DaprAppList []*AppPod

func ListAppInfos added in v0.4.5

func ListAppInfos(client k8s.Interface, appIDs ...string) (DaprAppList, error)

ListAppInfos ListPluginPods outputs plugins list.

type DaprPod added in v0.2.0

type DaprPod core_v1.Pod

type DaprStatus added in v0.4.5

type DaprStatus struct {
	Installed   bool   `json:"installed"`
	Version     string `json:"version"`
	Namespace   string `json:"namespace"`
	MTLSEnabled bool   `json:"mtls_enabled"`
	Error       error
}

func Check added in v0.4.5

func Check() *DaprStatus

type DeleteResponse added in v0.4.5

type DeleteResponse struct {
	Plugin *Plugin `json:"plugin"`
}

type EnablePluginRequest added in v0.4.5

type EnablePluginRequest struct {
	PluginID string `json:"plugin_id"`
}

type HTTPRequestOption added in v0.4.5

type HTTPRequestOption func(*http.Request) error

func InvokeSetHTTPHeader added in v0.4.5

func InvokeSetHTTPHeader(header, val string) HTTPRequestOption

type InitConfiguration

type InitConfiguration struct {
	Version       string
	CoreVersion   string
	RudderVersion string
	Namespace     string
	Secret        string
	EnableMTLS    bool
	EnableHA      bool
	DaprVersion   string
	Args          []string
	Wait          bool
	Timeout       uint
	DebugMode     bool
	ConfigFile    string
	Password      string
	Repo          *kitconfig.Repo
	DefaultConfig bool
}

type InstalledListOutput added in v0.4.5

type InstalledListOutput struct {
	Name          string `csv:"NAME"`
	Plugin        string `csv:"PLUGIN"`
	PluginVersion string `csv:"PLUGIN VERSION"`
	Repo          string `csv:"REPO"`
	RegisterAt    string `csv:"REGISTER_AT"`
	Status        string `csv:"STATE"`
}

func InstalledList added in v0.4.5

func InstalledList() ([]InstalledListOutput, error)

func PluginInfo added in v0.4.5

func PluginInfo(pluginID string) ([]InstalledListOutput, error)

type InstallerListOutPut added in v0.4.5

type InstallerListOutPut struct {
	Name    string `csv:"NAME"`
	Version string `csv:"VERSION"`
	Repo    string `csv:"REPO"`
	Status  string `csv:"STATUS"`
}

func InstallerInfo added in v0.4.5

func InstallerInfo(repo, installer, version string) ([]InstallerListOutPut, error)

func InstallerList added in v0.4.5

func InstallerList(repo string) ([]InstallerListOutPut, error)

func InstallerListAll added in v0.4.5

func InstallerListAll() ([]InstallerListOutPut, error)

type ListOutput

type ListOutput struct {
	AppID   string `csv:"APP ID"`
	AppPort string `csv:"APP PORT"`
	Age     string `csv:"AGE"`
	Created string `csv:"CREATED"`
	Status  string `json:"status"`
}

ListOutput represents the application ID, application port and creation time.

type ListResponse added in v0.4.5

type ListResponse struct {
	PluginList []*Plugin `json:"plugin_list"`
}

type Plugin

type Plugin struct {
	ID                string                  `json:"id,omitempty"`                 // plugin id.
	PluginVersion     string                  `json:"plugin_version,omitempty"`     // plugin version.
	TkeelVersion      string                  `json:"tkeel_version,omitempty"`      // plugin depend tkeel version.
	AddonsPoint       []*v1.AddonsPoint       `json:"addons_point,omitempty"`       // plugin declares addons.
	ImplementedPlugin []*v1.ImplementedPlugin `json:"implemented_plugin,omitempty"` // plugin implemented plugin list.
	Secret            string                  `json:"secret,omitempty"`             // plugin registered secret.
	RegisterTimestamp int64                   `json:"register_timestamp,omitempty"` // register timestamp.
	ActiveTenantes    []string                `json:"active_tenantes,omitempty"`    // active tenant's id list.
	RegisterAddons    []*RegisterAddons       `json:"register_addons,omitempty"`    // register addons router.
	Status            v1.PluginStatus         `json:"status,omitempty"`             // register plugin status.
}

func ListPlugins

func ListPlugins(client k8s.Interface) ([]*Plugin, error)

func Unregister added in v0.4.5

func Unregister(pluginID string) (*Plugin, error)

func UnregisterPlugins added in v0.4.5

func UnregisterPlugins(client k8s.Interface, pluginID string) (*Plugin, error)

func (*Plugin) String added in v0.4.5

func (p *Plugin) String() string

type PortForward added in v0.4.5

type PortForward struct {
	Config     *rest.Config
	Method     string
	URL        *url.URL
	Host       string
	LocalPort  int
	RemotePort int
	EmitLogs   bool
	App        *AppPod
	StopCh     chan struct{}
	ReadyCh    chan struct{}
}

PortForward provides a port-forward connection in a kubernetes cluster.

func GetPortforward added in v0.4.5

func GetPortforward(appName string, options ...PortForwardConfigureOption) (*PortForward, error)

func NewPortForward added in v0.4.5

func NewPortForward(
	config *rest.Config,
	namespace, podName string,
	host string, localPort, remotePort int,
	emitLogs bool,
) (*PortForward, error)

NewPortForward returns an instance of PortForward struct that can be used for establishing port-forwarding connection to a pod in kubernetes cluster, specified by namespace and deployName.

func (*PortForward) GetStop added in v0.4.5

func (pf *PortForward) GetStop() <-chan struct{}

GetStop returns StopCh for a PortForward instance. Receiving on StopCh will block until the port forwarding stops.

func (*PortForward) Init added in v0.4.5

func (pf *PortForward) Init() error

Init creates and runs a port-forward connection. This function blocks until connection is established. Note: Caller should call Stop() to finish the connection.

func (*PortForward) Stop added in v0.4.5

func (pf *PortForward) Stop()

Stop terminates port-forwarding connection.

type PortForwardConfigureOption added in v0.4.5

type PortForwardConfigureOption func(*PortForward, *AppPod) error

type RegisterAddons added in v0.4.5

type RegisterAddons struct {
	Addons   string `json:"addons,omitempty"`   // addons name.
	Upstream string `json:"upstream,omitempty"` // upstream path.
}

type RepoListOutput added in v0.4.5

type RepoListOutput struct {
	Name   string `csv:"REPO NAME"`
	Remote string `csv:"REMOTE"`
}

func ListRepo added in v0.4.5

func ListRepo() ([]RepoListOutput, error)

type RepoPluginListOutput added in v0.4.5

type RepoPluginListOutput struct {
	Name    string `csv:"NAME"`
	Version string `csv:"VERSION"`
}

func ListPluginsFromRepo added in v0.4.5

func ListPluginsFromRepo(repo string) ([]RepoPluginListOutput, error)

func ListPluginsFromTenant added in v0.4.5

func ListPluginsFromTenant(tenant string) ([]RepoPluginListOutput, error)

type RestRequestOption added in v0.4.5

type RestRequestOption func(*rest.Request) error

func InvokeSetRestRequestHeader added in v0.4.5

func InvokeSetRestRequestHeader(header string, val string) RestRequestOption

type SearchCondition added in v0.4.5

type SearchCondition struct {
	Field    string      `json:"field"`
	Operator string      `json:"operator"`
	Value    interface{} `json:"value"`
}

type SearchRequest added in v0.4.5

type SearchRequest struct {
	Query     string             `json:"query"`
	Condition []*SearchCondition `json:"condition"`
}

type StatusClient

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

func NewStatusClient

func NewStatusClient() (*StatusClient, error)

Create a new k8s client for status commands.

type StatusOutput

type StatusOutput struct {
	Name         string `csv:"NAME"`
	Namespace    string `csv:"NAMESPACE"`
	Healthy      string `csv:"HEALTHY"`
	Status       string `csv:"STATUS"`
	PluginStatus string `csv:"PLUGINSTATUS"`
	Replicas     int    `csv:"REPLICAS"`
	Version      string `csv:"VERSION"`
	Age          string `csv:"AGE"`
	Created      string `csv:"CREATED"`
}

StatusOutput represents the status of a named tKeel resource.

func List

func List() ([]StatusOutput, error)

type TenantAdmin added in v0.4.5

type TenantAdmin struct {
	UserName string `json:"username"` //nolint
	Password string `json:"password"` //nolint
}

type TenantCreateIn added in v0.4.5

type TenantCreateIn struct {
	Title  string      `json:"title"`
	Remark string      `json:"remark"`
	Admin  TenantAdmin `json:"admin"`
}

type TenantListOutPut added in v0.4.5

type TenantListOutPut struct {
	ID     string `csv:"ID"`
	Title  string `csv:"TITLE"`
	Remark string `csv:"REMARK"`
}

func TenantInfo added in v0.4.5

func TenantInfo(tenantID string) ([]TenantListOutPut, error)

func TenantList

func TenantList() ([]TenantListOutPut, error)

type UserInfo added in v0.4.5

type UserInfo struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type UserListOutPut added in v0.4.5

type UserListOutPut struct {
	ID       string `csv:"ID"`
	Username string `csv:"USERNAME"`
	TenantID string `csv:"TENANT ID"`
}

func TenantUserInfo added in v0.4.5

func TenantUserInfo(tenantID, userID string) ([]UserListOutPut, error)

func TenantUserList added in v0.4.5

func TenantUserList(tenantID string) ([]UserListOutPut, error)

Jump to

Keyboard shortcuts

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