jx: github.com/jenkins-x/jx/pkg/cluster Index | Files | Directories

package cluster

import "github.com/jenkins-x/jx/pkg/cluster"

Index

Package Files

constants.go helpers.go interface.go

Constants

const (

    // EnvGKEProject the environment variable for the GKE project
    EnvGKEProject = "GKE_PROJECT"

    // EnvGKERegion the environment variable for the GKE region
    EnvGKERegion = "GKE_REGION"
)

func HasAnyKey Uses

func HasAnyKey(labels map[string]string, filters map[string]string) bool

HasAnyKey returns true if the labels map has none of the keys in the filter

func LabelsMatch Uses

func LabelsMatch(labels map[string]string, filter map[string]string) bool

LabelsMatch returns true if the filter labels are contained in the label map

func NewLabelValue Uses

func NewLabelValue() (string, error)

NewLabelValue returns a cluster safe unique label we can use for locking

func RemoveLabels Uses

func RemoveLabels(client Client, cluster *Cluster, removeLabels []string) (map[string]string, error)

RemoveLabels removes the set of labels from the cluster

type Client Uses

type Client interface {
    // List lists the clusters in the current context - which is usually a project or user id etc
    List() ([]*Cluster, error)

    // ListFilter lists the clusters with the matching label filters
    ListFilter(strings map[string]string) ([]*Cluster, error)

    // Connect connects to the given cluster - returning an error if the connection cannot be made
    Connect(cluster *Cluster) error

    // String returns a text representation of the client
    String() string

    // SetClusterLabels adds labels to the given cluster
    SetClusterLabels(cluster *Cluster, labels map[string]string) error

    // Get looks up a given cluster by name returning nil if its not found
    Get(name string) (*Cluster, error)
}

Client represents a kubernetes cluster provider

type Cluster Uses

type Cluster struct {
    Name     string
    Labels   map[string]string
    Status   string
    Location string
}

Cluster represents a cluster

func GetCluster Uses

func GetCluster(client Client, name string) (*Cluster, error)

GetCluster gets a cluster by listing the clusters

func ListFilter Uses

func ListFilter(client Client, labels map[string]string) ([]*Cluster, error)

ListFilter lists the clusters with a filter

func LockCluster Uses

func LockCluster(client Client, lockLabels map[string]string, filterLabels map[string]string) (*Cluster, error)

LockCluster tries to use the given label and value to lock the cluster. Return nil if there are no clusters available

Directories

PathSynopsis
factory
fake
gke

Package cluster imports 5 packages (graph) and is imported by 5 packages. Updated 2019-09-12. Refresh now. Tools for package owners.