foreigncluster

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: Apache-2.0 Imports: 21 Imported by: 4

Documentation

Overview

Package foreigncluster contains shared utility methods to handle the ForeignCluster resources.

Index

Constants

This section is empty.

Variables

View Source
var (
	// UnpeerChecker checks if the two clusters are unpeered.
	UnpeerChecker fcEventChecker = func(fc *discoveryv1alpha1.ForeignCluster) bool {
		return IsIncomingPeeringNone(fc) && IsOutgoingPeeringNone(fc)
	}
)

Functions

func AllowIncomingPeering

func AllowIncomingPeering(foreignCluster *discoveryv1alpha1.ForeignCluster, defaultEnableIncomingPeering bool) bool

AllowIncomingPeering returns the value set in the ForeignCluster spec if it has been set, it returns the value set through the command line flag if it is automatic.

func GetDiscoveryType

func GetDiscoveryType(foreignCluster *discoveryv1alpha1.ForeignCluster) discovery.Type

GetDiscoveryType returns the discovery type for the given ForeignCluster.

func GetForeignClusterByID

func GetForeignClusterByID(ctx context.Context, cl client.Client, clusterID string) (*discoveryv1alpha1.ForeignCluster, error)

GetForeignClusterByID returns a ForeignCluster CR retrieving it by its clusterID.

func GetHomeAuthURL

func GetHomeAuthURL(ctx context.Context, cl client.Client, authServiceAddress,
	authServicePort, liqoNamespace string) (string, error)

GetHomeAuthURL retrieves the auth service endpoint by inspecting the cluster. It returns an empty string and an error if it does not succeed.

func GetLocalTenantNamespaceName

func GetLocalTenantNamespaceName(ctx context.Context, cl client.Client, remoteCluster discoveryv1alpha1.ClusterIdentity) (string, error)

GetLocalTenantNamespaceName gets the name of the local tenant namespace associated with a specific peering (remoteClusterID).

func GetNetworkingState added in v0.4.0

func GetNetworkingState(foreignCluster *discoveryv1alpha1.ForeignCluster) discoveryv1alpha1.NetworkingEnabledType

GetNetworkingState returns the state of the networking. Networking can be enabled or disabled.

func GetOlderForeignCluster

func GetOlderForeignCluster(
	foreignClusterList *discoveryv1alpha1.ForeignClusterList) (foreignCluster *discoveryv1alpha1.ForeignCluster)

GetOlderForeignCluster returns the ForeignCluster from the list with the older creationTimestamp.

func GetPeeringPhase

GetPeeringPhase returns the peering phase of a given ForignCluster CR.

func GetRemoteTenantNamespaceName

func GetRemoteTenantNamespaceName(ctx context.Context, cl client.Client, remoteClusterID string) (string, error)

GetRemoteTenantNamespaceName gets the name of the remote tenant namespace associated with a specific peering (remoteClusterID).

func HasHigherPriority

func HasHigherPriority(fc *discoveryv1alpha1.ForeignCluster, discoveryType discovery.Type) bool

HasHigherPriority upgrades the discovery type. If we discovered a cluster with IncomingPeering, we can upgrade this discovery when we found it also in other way, for example adding it manually.

func HasToBeRemoved

func HasToBeRemoved(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

HasToBeRemoved indicates if a ForeignCluster CR has to be removed.

func InsecureSkipTLSVerify

func InsecureSkipTLSVerify(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

InsecureSkipTLSVerify returns true if the ForeignCluster has to be contacted without the TLS verification.

func IsAuthenticated

func IsAuthenticated(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

IsAuthenticated checks if the identity has been accepted by the remote cluster.

func IsExpired

func IsExpired(fc *discoveryv1alpha1.ForeignCluster) bool

IsExpired checks if this foreign cluster has been updated before the end of its TimeToLive.

func IsIncomingEnabled

func IsIncomingEnabled(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

IsIncomingEnabled checks if the incoming peering is enabled (i.e. Pending, Established or Deleting).

func IsIncomingJoined

func IsIncomingJoined(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

IsIncomingJoined checks if the incoming peering has been completely established.

func IsIncomingPeeringNone added in v0.4.0

func IsIncomingPeeringNone(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

IsIncomingPeeringNone checks if the incoming peering is set to none.

func IsNetworkingEnabled added in v0.4.0

func IsNetworkingEnabled(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

IsNetworkingEnabled checks if the networking is enabled (i.e. set to "Yes").

func IsNetworkingEstablished added in v0.5.0

func IsNetworkingEstablished(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

IsNetworkingEstablished checks if the networking has be established.

func IsOutgoingEnabled

func IsOutgoingEnabled(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

IsOutgoingEnabled checks if the outgoing peering is enabled (i.e. Pending, Established or Deleting).

func IsOutgoingJoined

func IsOutgoingJoined(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

IsOutgoingJoined checks if the outgoing peering has been completely established.

func IsOutgoingPeeringNone added in v0.4.0

func IsOutgoingPeeringNone(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

IsOutgoingPeeringNone checks if the outgoing peering is set to none.

func IsUnpeered added in v0.5.0

func IsUnpeered(foreignCluster *discoveryv1alpha1.ForeignCluster) bool

IsUnpeered returns whether the no peering is currently active towards the remote cluster.

func LastUpdateNow

func LastUpdateNow(fc *discoveryv1alpha1.ForeignCluster)

LastUpdateNow sets lastUpdate annotation to current time.

func PollForEvent added in v0.5.0

func PollForEvent(ctx context.Context, cl client.Client, identity *discoveryv1alpha1.ClusterIdentity,
	checker fcEventChecker, interval time.Duration) error

PollForEvent polls until the given events occurs on the foreign cluster corresponding to the identity.

func SetDiscoveryType

func SetDiscoveryType(foreignCluster *discoveryv1alpha1.ForeignCluster, discoveryType discovery.Type)

SetDiscoveryType sets the discovery type to the given ForeignCluster.

func UniqueName added in v0.4.0

func UniqueName(cluster *discoveryv1alpha1.ClusterIdentity) string

UniqueName returns a user-friendly name that is unique *in the context of the current cluster*. It depends on ClusterName, so the same cluster may have different UniqueNames in different clusters.

Use it when reflecting resources on a remote cluster (see issue #966).

Types

This section is empty.

Jump to

Keyboard shortcuts

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