cluster

package
v0.0.0-...-82d4bb3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 6 Imported by: 30

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster interface {
	fmt.Stringer
	kube.CLIClient

	// Name of this cluster. Use for interacting with the cluster or validation against clusters.
	// Use StableName instead of Name when creating subtests.
	Name() string

	// StableName gives a deterministic name for the cluster. Use this for test/subtest names to
	// allow test grid to compare runs, even when the underlying cluster names are dynamic.
	// Use Name for validation/interaction with the actual cluster.
	StableName() string

	// NetworkName the cluster is on
	NetworkName() string

	// MinKubeVersion returns true if the cluster is at least the version specified,
	// false otherwise
	MinKubeVersion(minor uint) bool

	// MaxKubeVersion returns true if the cluster is at most the version specified,
	// false otherwise
	MaxKubeVersion(minor uint) bool

	// IsPrimary returns true if this is a primary cluster, containing an instance
	// of the Istio control plane.
	IsPrimary() bool

	// IsConfig returns true if this is a config cluster, used as the source of
	// Istio config for one or more control planes.
	IsConfig() bool

	// IsRemote returns true if this is a remote cluster, which uses a control plane
	// residing in another cluster.
	IsRemote() bool

	// IsExternalControlPlane returns true if this is a cluster containing an instance
	// of the Istio control plane but with its source of config in another cluster.
	IsExternalControlPlane() bool

	// Primary returns the primary cluster for this cluster. Will return itself if
	// IsPrimary.
	Primary() Cluster

	// PrimaryName returns the name of the primary cluster for this cluster.
	PrimaryName() string

	// Config returns the config cluster for this cluster. Will return itself if
	// IsConfig.
	Config() Cluster

	// ConfigName returns the name of the config cluster for this cluster.
	ConfigName() string

	// HTTPProxy returns the HTTP proxy config to connect to the cluster
	HTTPProxy() string

	// Metadata returns the value for a given metadata key for the cluster.
	// If the key is not found in the cluster metadata, an empty string is returned.
	MetadataValue(key string) string

	// ProxyKubectlOnly returns a boolean value to indicate whether all traffic
	// should route through the HTTP proxy or only Kubectl traffic. (Useful
	// in topologies where the API server is private but the ingress is public).
	ProxyKubectlOnly() bool
}

Cluster in a multicluster environment.

type Clusters

type Clusters []Cluster

Clusters is an ordered list of Cluster instances.

func (Clusters) ByNetwork

func (c Clusters) ByNetwork() ClustersByNetwork

ByNetwork returns a map of network name to a subset of clusters

func (Clusters) Configs

func (c Clusters) Configs(excluded ...Cluster) Clusters

Configs returns the subset that are config clusters.

func (Clusters) Contains

func (c Clusters) Contains(cc Cluster) bool

Contains returns true if a cluster with the given name is found in the list.

func (Clusters) Default

func (c Clusters) Default() Cluster

Default returns the first cluster in the list.

func (Clusters) Exclude

func (c Clusters) Exclude(excluded ...Cluster) Clusters

Exclude returns all clusters not given as input.

func (Clusters) ForNetworks

func (c Clusters) ForNetworks(networks ...string) Clusters

ForNetworks returns the list of clusters in the given networks.

func (Clusters) GetByName

func (c Clusters) GetByName(name string) Cluster

GetByName returns the Cluster with the given name or nil if it is not in the list.

func (Clusters) GetOrDefault

func (c Clusters) GetOrDefault(cluster Cluster) Cluster

GetOrDefault returns the given cluster if non-nil. Otherwise returns the first Cluster in the list.

func (Clusters) IsExternalControlPlane

func (c Clusters) IsExternalControlPlane() bool

IsExternalControlPlane indicates whether the clusters are set up in an enternal control plane configuration. An external control plane is a primary cluster that gets its Istio configuration from a different cluster.

func (Clusters) IsMulticluster

func (c Clusters) IsMulticluster() bool

IsMulticluster is a utility method that indicates whether there are multiple Clusters available.

func (Clusters) Len

func (c Clusters) Len() int

func (Clusters) MeshClusters

func (c Clusters) MeshClusters(excluded ...Cluster) Clusters

MeshClusters returns the subset that are not external control plane clusters.

func (Clusters) Names

func (c Clusters) Names() []string

Names returns the deduped list of names of the clusters.

func (Clusters) Networks

func (c Clusters) Networks() []string

Networks returns the list of network names for the clusters.

func (Clusters) Primaries

func (c Clusters) Primaries(excluded ...Cluster) Clusters

Primaries returns the subset that are primary clusters.

func (Clusters) Remotes

func (c Clusters) Remotes(excluded ...Cluster) Clusters

Remotes returns the subset that are remote clusters.

func (Clusters) String

func (c Clusters) String() string

type ClustersByNetwork

type ClustersByNetwork map[string]Clusters

func (ClustersByNetwork) Networks

func (c ClustersByNetwork) Networks() []string

type Config

type Config struct {
	Name               string     `json:"clusterName,omitempty"`
	Network            string     `json:"network,omitempty"`
	HTTPProxy          string     `json:"httpProxy,omitempty"`
	ProxyKubectlOnly   bool       `json:"proxyKubectlOnly,omitempty"`
	PrimaryClusterName string     `json:"primaryClusterName,omitempty"`
	ConfigClusterName  string     `json:"configClusterName,omitempty"`
	Meta               config.Map `json:"meta,omitempty"`
}

type Map

type Map = map[string]Cluster

Map can be given as a shared reference to multiple Topology/Cluster implementations. allowing clusters to find each other for lookups of Primary, ConfigCluster, etc.

type Topology

type Topology struct {
	ClusterName             string
	Network                 string
	ClusterHTTPProxy        string
	PrimaryClusterName      string
	ConfigClusterName       string
	ClusterProxyKubectlOnly bool
	Index                   int
	// AllClusters should contain all AllClusters in the context
	AllClusters    Map
	ConfigMetadata config.Map
}

Topology gives information about the relationship between clusters. Cluster implementations can embed this struct to include common functionality.

func NewTopology

func NewTopology(config Config, allClusters Map) Topology

func (Topology) Config

func (c Topology) Config() Cluster

func (Topology) ConfigName

func (c Topology) ConfigName() string

func (Topology) HTTPProxy

func (c Topology) HTTPProxy() string

HTTPProxy to connect to the cluster

func (Topology) IsConfig

func (c Topology) IsConfig() bool

func (Topology) IsExternalControlPlane

func (c Topology) IsExternalControlPlane() bool

func (Topology) IsPrimary

func (c Topology) IsPrimary() bool

func (Topology) IsRemote

func (c Topology) IsRemote() bool

func (Topology) MaxKubeVersion

func (c Topology) MaxKubeVersion(minor uint) bool

func (Topology) MetadataValue

func (c Topology) MetadataValue(key string) string

MetadataValue provides the configured value for a metadata key in the cluster configuration.

func (Topology) MinKubeVersion

func (c Topology) MinKubeVersion(minor uint) bool

func (Topology) Name

func (c Topology) Name() string

Name provides the ClusterName this cluster used by Istio.

func (Topology) NetworkName

func (c Topology) NetworkName() string

NetworkName the cluster is on

func (Topology) Primary

func (c Topology) Primary() Cluster

func (Topology) PrimaryName

func (c Topology) PrimaryName() string

func (Topology) ProxyKubectlOnly

func (c Topology) ProxyKubectlOnly() bool

func (Topology) StableName

func (c Topology) StableName() string

StableName provides a name used for testcase names. Deterministic, so testgrid can be consistent when the underlying cluster names are dynamic.

func (Topology) String

func (c Topology) String() string

func (Topology) WithConfig

func (c Topology) WithConfig(configClusterName string) Topology

func (Topology) WithPrimary

func (c Topology) WithPrimary(primaryClusterName string) Topology

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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