Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithClusterName(ctx context.Context, clusterName string) context.Context
- func FormatProxyURL(clusterName, originalPath string) string
- func GetClusterGatewayService(ctx context.Context, c client.Client) (*apiregistrationv1.ServiceReference, error)
- func Initialize(restConfig *rest.Config) error
- func NewSecretModeMultiClusterRoundTripper(rt http.RoundTripper) http.RoundTripper
- func SetClusterName(obj *unstructured.Unstructured, clusterName string)
- func UpgradeExistingClusterSecret(ctx context.Context, c client.Client) error
- func WaitUntilClusterGatewayReady(ctx context.Context, c client.Client, maxRetry int, interval time.Duration) (svc *apiregistrationv1.ServiceReference, err error)
Constants ¶
const ( // ClusterContextKey is the name of cluster using in client http context ClusterContextKey = contextKey("ClusterName") // ClusterLabelKey specifies which cluster the target k8s object should locate ClusterLabelKey = "cluster.oam.dev/clusterName" // ClusterLocalName specifies the local cluster ClusterLocalName = "local" )
Variables ¶
var ( // ClusterGatewaySecretNamespace the namespace where cluster-gateway secret locates ClusterGatewaySecretNamespace string )
Functions ¶
func ContextWithClusterName ¶
ContextWithClusterName create context with multi-cluster by cluster name
func FormatProxyURL ¶
FormatProxyURL will format the request API path by the cluster gateway resources rule
func GetClusterGatewayService ¶
func GetClusterGatewayService(ctx context.Context, c client.Client) (*apiregistrationv1.ServiceReference, error)
GetClusterGatewayService get cluster gateway backend service reference if service is ready, service is returned and no error is returned if service exists but is not ready, both service and error are returned if service does not exist, only error is returned
func Initialize ¶
Initialize prepare multicluster environment by checking cluster gateway service in clusters and hack rest config to use cluster gateway if cluster gateway service is not ready, it will wait up to 5 minutes
func NewSecretModeMultiClusterRoundTripper ¶
func NewSecretModeMultiClusterRoundTripper(rt http.RoundTripper) http.RoundTripper
NewSecretModeMultiClusterRoundTripper will re-write the API path to one of the multi-cluster resource for a request if context has the value
func SetClusterName ¶
func SetClusterName(obj *unstructured.Unstructured, clusterName string)
SetClusterName set cluster name for object
func UpgradeExistingClusterSecret ¶ added in v1.1.4
UpgradeExistingClusterSecret upgrade outdated cluster secrets in v1.1.1 to latest
func WaitUntilClusterGatewayReady ¶
func WaitUntilClusterGatewayReady(ctx context.Context, c client.Client, maxRetry int, interval time.Duration) (svc *apiregistrationv1.ServiceReference, err error)
WaitUntilClusterGatewayReady wait cluster gateway service to be ready to serve
Types ¶
This section is empty.