Documentation ¶
Overview ¶
Package inband contains common functions used for the in-band peer and unpeer commands.
Index ¶
- type Cluster
- func (c *Cluster) CheckForeignCluster(ctx context.Context, remoteIdentity *discoveryv1alpha1.ClusterIdentity) (err error)
- func (c *Cluster) DeleteForeignCluster(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity) error
- func (c *Cluster) DisablePeering(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity, ...) (err error)
- func (c *Cluster) EnforceForeignCluster(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity, ...) error
- func (c *Cluster) EnforceIncomingPeeringFlag(ctx context.Context, remoteID *discoveryv1alpha1.ClusterIdentity, enabled bool) error
- func (c *Cluster) EnforceOutgoingPeeringFlag(ctx context.Context, remoteID *discoveryv1alpha1.ClusterIdentity, enabled bool) error
- func (c *Cluster) ExchangeNetworkCfg(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity) error
- func (c *Cluster) GetAuthToken() string
- func (c *Cluster) GetAuthURL() string
- func (c *Cluster) GetClusterID() *discoveryv1alpha1.ClusterIdentity
- func (c *Cluster) GetLocTenantNS() string
- func (c *Cluster) GetProxyURL() string
- func (c *Cluster) Init(ctx context.Context) error
- func (c *Cluster) MapAuthIPForCluster(ctx context.Context, ipamClient ipam.IpamClient, ...) error
- func (c *Cluster) MapProxyIPForCluster(ctx context.Context, ipamClient ipam.IpamClient, ...) error
- func (c *Cluster) NewIPAMClient(ctx context.Context) (ipam.IpamClient, error)
- func (c *Cluster) PortForwardIPAM(ctx context.Context) error
- func (c *Cluster) SetRemTenantNS(remTenantNamespace string)
- func (c *Cluster) SetUpTenantNamespace(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity) error
- func (c *Cluster) StopPortForwardIPAM()
- func (c *Cluster) TearDownTenantNamespace(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity) error
- func (c *Cluster) UnmapAuthIPForCluster(ctx context.Context, ipamClient ipam.IpamClient, ...) error
- func (c *Cluster) UnmapProxyIPForCluster(ctx context.Context, ipamClient ipam.IpamClient, ...) error
- type DefaultPortForwarder
- type Endpoint
- type PortForwardOptions
- type PortForwarder
- type WireGuardConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { Waiter *wait.Waiter PortForwardOpts *PortForwardOptions // contains filtered or unexported fields }
Cluster struct that models a k8s cluster for connect and disconnect commands.
func NewCluster ¶
NewCluster returns a new cluster object. The cluster has to be initialized before being consumed.
func (*Cluster) CheckForeignCluster ¶
func (c *Cluster) CheckForeignCluster(ctx context.Context, remoteIdentity *discoveryv1alpha1.ClusterIdentity) (err error)
CheckForeignCluster retrieves the ForeignCluster resource associated with the remote cluster (if any), and stores it for later usage. Additionally, it performs the appropriate sanity checks, ensuring that the type of peering is not mutated.
func (*Cluster) DeleteForeignCluster ¶
func (c *Cluster) DeleteForeignCluster(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity) error
DeleteForeignCluster deletes the foreignclusters instance for the given remote cluster.
func (*Cluster) DisablePeering ¶
func (c *Cluster) DisablePeering(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity, incoming bool) (err error)
DisablePeering disables the peering for the remote cluster by patching the foreigncusters resource.
func (*Cluster) EnforceForeignCluster ¶
func (c *Cluster) EnforceForeignCluster(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity, token, authURL, proxyURL string) error
EnforceForeignCluster enforces the presence of the foreignclusters instance for a given remote cluster. This function must be executed after CheckForeignCluster, which retrieves the ForeignCluster and performs the appropriate sanity checks. The newly created foreigncluster has the following fields set to:
- ForeignAuthURL -> the remapped ip address for the local cluster of the auth service living in the remote cluster;
- ForeignProxyURL -> the remapped ip address for the local cluster of the proxy service living in the remote cluster;
- NetworkingEnabled -> No, we do not want the networking to be handled by the peering process. Networking is handled manually by the licoctl connect/disconnect commands.
func (*Cluster) EnforceIncomingPeeringFlag ¶ added in v0.10.2
func (c *Cluster) EnforceIncomingPeeringFlag(ctx context.Context, remoteID *discoveryv1alpha1.ClusterIdentity, enabled bool) error
EnforceIncomingPeeringFlag sets the incoming peering flag for a given foreign cluster.
func (*Cluster) EnforceOutgoingPeeringFlag ¶ added in v0.7.0
func (c *Cluster) EnforceOutgoingPeeringFlag(ctx context.Context, remoteID *discoveryv1alpha1.ClusterIdentity, enabled bool) error
EnforceOutgoingPeeringFlag sets the outgoing peering flag for a given foreign cluster.
func (*Cluster) ExchangeNetworkCfg ¶
func (c *Cluster) ExchangeNetworkCfg(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity) error
ExchangeNetworkCfg creates the local networkconfigs resource for the remote cluster, replicates it into the remote cluster, waits for the remote cluster to populate the status of the resource and then sets the remote status in the local networkconfigs resource.
func (*Cluster) GetAuthToken ¶
GetAuthToken returns the authentication token of the local cluster.
func (*Cluster) GetAuthURL ¶
GetAuthURL returns the authentication URL of the local cluster.
func (*Cluster) GetClusterID ¶
func (c *Cluster) GetClusterID() *discoveryv1alpha1.ClusterIdentity
GetClusterID returns the cluster identity.
func (*Cluster) GetLocTenantNS ¶
GetLocTenantNS returns the tenant namespace created for the remote cluster.
func (*Cluster) GetProxyURL ¶
GetProxyURL returns the proxy URL of the local cluster.
func (*Cluster) MapAuthIPForCluster ¶
func (c *Cluster) MapAuthIPForCluster(ctx context.Context, ipamClient ipam.IpamClient, remoteCluster *discoveryv1alpha1.ClusterIdentity) error
MapAuthIPForCluster maps the ClusterIP address of the local auth service on the local external CIDR as seen by the remote cluster.
func (*Cluster) MapProxyIPForCluster ¶
func (c *Cluster) MapProxyIPForCluster(ctx context.Context, ipamClient ipam.IpamClient, remoteCluster *discoveryv1alpha1.ClusterIdentity) error
MapProxyIPForCluster maps the ClusterIP address of the local proxy on the local external CIDR as seen by the remote cluster.
func (*Cluster) NewIPAMClient ¶
NewIPAMClient creates and returns a client to the IPAM service.
func (*Cluster) PortForwardIPAM ¶
PortForwardIPAM starts the port forwarding for the IPAM service.
func (*Cluster) SetRemTenantNS ¶
SetRemTenantNS sets the tenant namespace of the local cluster created by the remote cluster.
func (*Cluster) SetUpTenantNamespace ¶
func (c *Cluster) SetUpTenantNamespace(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity) error
SetUpTenantNamespace creates the tenant namespace in the local custer for the given remote cluster.
func (*Cluster) StopPortForwardIPAM ¶
func (c *Cluster) StopPortForwardIPAM()
StopPortForwardIPAM stops the port forwarding for the IPAM service.
func (*Cluster) TearDownTenantNamespace ¶
func (c *Cluster) TearDownTenantNamespace(ctx context.Context, remoteClusterID *discoveryv1alpha1.ClusterIdentity) error
TearDownTenantNamespace deletes the tenant namespace in the local cluster for the given remote cluster.
func (*Cluster) UnmapAuthIPForCluster ¶
func (c *Cluster) UnmapAuthIPForCluster(ctx context.Context, ipamClient ipam.IpamClient, remoteCluster *discoveryv1alpha1.ClusterIdentity) error
UnmapAuthIPForCluster unmaps the ClusterIP address of the local auth service on the local external CIDR as seen by the remote cluster.
func (*Cluster) UnmapProxyIPForCluster ¶
func (c *Cluster) UnmapProxyIPForCluster(ctx context.Context, ipamClient ipam.IpamClient, remoteCluster *discoveryv1alpha1.ClusterIdentity) error
UnmapProxyIPForCluster unmaps the ClusterIP address of the local proxy on the local external CIDR as seen by the remote cluster.
type DefaultPortForwarder ¶
type DefaultPortForwarder struct {
genericclioptions.IOStreams
}
DefaultPortForwarder default forwarder implementation used to forward ports.
func (*DefaultPortForwarder) ForwardPorts ¶
func (f *DefaultPortForwarder) ForwardPorts(method string, podURL *url.URL, opt *PortForwardOptions) error
ForwardPorts forwards the ports given in the options for the given pod url.
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint maps a service that has to be accessed by a remote cluster.
func (*Endpoint) GetHTTPSURL ¶
GetHTTPSURL return the https url for the endpoint.
func (*Endpoint) GetHTTPURL ¶
GetHTTPURL returns the http url for the endpoint.
func (*Endpoint) GetIP ¶
GetIP returns the ip address that has on the cluster where the endpoint lives.
func (*Endpoint) SetRemappedIP ¶
SetRemappedIP sets the ip address as seen by the remote cluster.
type PortForwardOptions ¶
type PortForwardOptions struct { Namespace string Selector *metav1.LabelSelector Config *restclient.Config Client client.Client PortForwarder PortForwarder RemotePort int LocalPort int Ports []string StopChannel chan struct{} ReadyChannel chan struct{} }
PortForwardOptions contains all the options in order to port-forward a pod's port.
func (*PortForwardOptions) RunPortForward ¶
func (o *PortForwardOptions) RunPortForward(ctx context.Context) error
RunPortForward starts the forwarding.
func (*PortForwardOptions) StopPortForward ¶
func (o *PortForwardOptions) StopPortForward()
StopPortForward stops the forwarding.
type PortForwarder ¶
type PortForwarder interface {
ForwardPorts(method string, podURL *url.URL, opts *PortForwardOptions) error
}
PortForwarder interface that a port forwarder needs to implement.