cluster

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//DefaultClusterName is the cluster for the unspecified cluster
	DefaultClusterName = "_default"
)

Variables

This section is empty.

Functions

func GetClusters added in v0.9.3

func GetClusters(client versioned.Interface, ns string, opts metav1.ListOptions) (*v1alpha1.ClusterList, error)

GetClusters get clusters resourcese. If this resource not exist on cluster, just ignore it.

Types

type ClusterRefresher added in v0.9.3

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

func NewClusterRefresher added in v0.9.3

func NewClusterRefresher(ns string, cfg *rest.Config) *ClusterRefresher

NewClusterRefresher ... This runnable intent to inform captain to restart when it found a new cluster. This is not a ideal solution, but it works on most occasions. Add/Remove cluster should be a rear operation in prod environment.

func (*ClusterRefresher) Start added in v0.9.3

func (c *ClusterRefresher) Start(ctx context.Context) error

type Info

type Info struct {
	// Name is the cluster name, usually the Cluster resource's name
	Name string
	// Endpoint the apiserver's endpoint of the cluster
	Endpoint string
	// Token is a admin token , it should have all the access to the cluster
	Token string

	// Namespace the namespace which the chart will be installed to
	Namespace string
}

Info represents a Cluster,

func RestConfigToCluster

func RestConfigToCluster(config *rest.Config, generatedName string) *Info

RestConfigToCluster generate a cluster Info from a rest config This method and the Info.ToRestConfig both only support bearer token for now luckily, the in-cluster rest config also use bearer token

func (*Info) GetContext

func (i *Info) GetContext() string

GetContext is the context name for this cluster, this name format is generated from k8s code

func (*Info) ToRestConfig

func (i *Info) ToRestConfig() *rest.Config

ToRestConfig generate rest.Config from cluster info.

Jump to

Keyboard shortcuts

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