istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/test/framework/components/cluster/cluster.go (about)

     1  //  Copyright Istio Authors
     2  //
     3  //  Licensed under the Apache License, Version 2.0 (the "License");
     4  //  you may not use this file except in compliance with the License.
     5  //  You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  //  Unless required by applicable law or agreed to in writing, software
    10  //  distributed under the License is distributed on an "AS IS" BASIS,
    11  //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  //  See the License for the specific language governing permissions and
    13  //  limitations under the License.
    14  
    15  package cluster
    16  
    17  import (
    18  	"fmt"
    19  
    20  	"istio.io/istio/pkg/kube"
    21  )
    22  
    23  // Cluster in a multicluster environment.
    24  type Cluster interface {
    25  	fmt.Stringer
    26  	kube.CLIClient
    27  
    28  	// Name of this cluster. Use for interacting with the cluster or validation against clusters.
    29  	// Use StableName instead of Name when creating subtests.
    30  	Name() string
    31  
    32  	// StableName gives a deterministic name for the cluster. Use this for test/subtest names to
    33  	// allow test grid to compare runs, even when the underlying cluster names are dynamic.
    34  	// Use Name for validation/interaction with the actual cluster.
    35  	StableName() string
    36  
    37  	// Kind of cluster
    38  	Kind() Kind
    39  
    40  	// NetworkName the cluster is on
    41  	NetworkName() string
    42  
    43  	// MinKubeVersion returns true if the cluster is at least the version specified,
    44  	// false otherwise
    45  	MinKubeVersion(minor uint) bool
    46  
    47  	// MaxKubeVersion returns true if the cluster is at most the version specified,
    48  	// false otherwise
    49  	MaxKubeVersion(minor uint) bool
    50  
    51  	// IsPrimary returns true if this is a primary cluster, containing an instance
    52  	// of the Istio control plane.
    53  	IsPrimary() bool
    54  
    55  	// IsConfig returns true if this is a config cluster, used as the source of
    56  	// Istio config for one or more control planes.
    57  	IsConfig() bool
    58  
    59  	// IsRemote returns true if this is a remote cluster, which uses a control plane
    60  	// residing in another cluster.
    61  	IsRemote() bool
    62  
    63  	// IsExternalControlPlane returns true if this is a cluster containing an instance
    64  	// of the Istio control plane but with its source of config in another cluster.
    65  	IsExternalControlPlane() bool
    66  
    67  	// Primary returns the primary cluster for this cluster. Will return itself if
    68  	// IsPrimary.
    69  	Primary() Cluster
    70  
    71  	// PrimaryName returns the name of the primary cluster for this cluster.
    72  	PrimaryName() string
    73  
    74  	// Config returns the config cluster for this cluster. Will return itself if
    75  	// IsConfig.
    76  	Config() Cluster
    77  
    78  	// ConfigName returns the name of the config cluster for this cluster.
    79  	ConfigName() string
    80  
    81  	// HTTPProxy returns the HTTP proxy config to connect to the cluster
    82  	HTTPProxy() string
    83  
    84  	// Metadata returns the value for a given metadata key for the cluster.
    85  	// If the key is not found in the cluster metadata, an empty string is returned.
    86  	MetadataValue(key string) string
    87  
    88  	// ProxyKubectlOnly returns a boolean value to indicate whether all traffic
    89  	// should route through the HTTP proxy or only Kubectl traffic. (Useful
    90  	// in topologies where the API server is private but the ingress is public).
    91  	ProxyKubectlOnly() bool
    92  }