Documentation ¶
Overview ¶
Package netcfgcreator implements the logic to react to ForeignClusters status changes, in order to enforce/remove the related NetworkConfig resources for network establishment.
Index ¶
- func GetLocalNetworkConfig(ctx context.Context, c client.Client, clusterID, namespace string) (*netv1alpha1.NetworkConfig, error)
- func GetRemoteNetworkConfig(ctx context.Context, c client.Client, clusterID, namespace string) (*netv1alpha1.NetworkConfig, error)
- type NetworkConfigCreator
- func (ncc *NetworkConfigCreator) EnforceNetworkConfigAbsence(ctx context.Context, fc *discoveryv1alpha1.ForeignCluster) error
- func (ncc *NetworkConfigCreator) EnforceNetworkConfigPresence(ctx context.Context, fc *discoveryv1alpha1.ForeignCluster) error
- func (ncc *NetworkConfigCreator) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (ncc *NetworkConfigCreator) SetupWithManager(mgr ctrl.Manager) error
- type SecretWatcher
- type ServiceWatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalNetworkConfig ¶
func GetLocalNetworkConfig(ctx context.Context, c client.Client, clusterID, namespace string) (*netv1alpha1.NetworkConfig, error)
GetLocalNetworkConfig returns the local NetworkConfig associated with a given cluster ID. In case more than one NetworkConfig is found, all but the oldest are deleted.
func GetRemoteNetworkConfig ¶
func GetRemoteNetworkConfig(ctx context.Context, c client.Client, clusterID, namespace string) (*netv1alpha1.NetworkConfig, error)
GetRemoteNetworkConfig returns the remote NetworkConfig associated with a given cluster ID.
Types ¶
type NetworkConfigCreator ¶
type NetworkConfigCreator struct { client.Client Scheme *runtime.Scheme PodCIDR string ExternalCIDR string // contains filtered or unexported fields }
NetworkConfigCreator reconciles ForeignCluster objects to enforce the respective NetworkConfigs.
func (*NetworkConfigCreator) EnforceNetworkConfigAbsence ¶
func (ncc *NetworkConfigCreator) EnforceNetworkConfigAbsence(ctx context.Context, fc *discoveryv1alpha1.ForeignCluster) error
EnforceNetworkConfigAbsence ensures the absence of local NetworkConfigs associated with the given ForeignCluster.
func (*NetworkConfigCreator) EnforceNetworkConfigPresence ¶
func (ncc *NetworkConfigCreator) EnforceNetworkConfigPresence(ctx context.Context, fc *discoveryv1alpha1.ForeignCluster) error
EnforceNetworkConfigPresence ensures the presence of a local NetworkConfig associated with the given ForeignCluster.
func (*NetworkConfigCreator) Reconcile ¶
func (ncc *NetworkConfigCreator) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile reconciles the state of ForeignCluster resources to enforce the respective NetworkConfigs.
func (*NetworkConfigCreator) SetupWithManager ¶
func (ncc *NetworkConfigCreator) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers a new controller for ForeignCluster resources.
type SecretWatcher ¶
SecretWatcher reconciles Secret objects to retrieve the Wireguard public key.
func NewSecretWatcher ¶
func NewSecretWatcher(enqueuefn func(workqueue.RateLimitingInterface)) *SecretWatcher
NewSecretWatcher returns a new initialized SecretWatcher instance.
func (*SecretWatcher) Handlers ¶
func (sw *SecretWatcher) Handlers() handler.EventHandler
Handlers returns the set of handlers used for the Watch configuration.
func (*SecretWatcher) Predicates ¶
func (sw *SecretWatcher) Predicates() predicate.Predicate
Predicates returns the set of predicates used for the Watch configuration.
func (*SecretWatcher) WaitForConfigured ¶
func (sw *SecretWatcher) WaitForConfigured(ctx context.Context) bool
WaitForConfigured waits until a valid key is retrieved for the first time.
func (*SecretWatcher) WiregardPublicKey ¶
func (sw *SecretWatcher) WiregardPublicKey() string
WiregardPublicKey returns the retrieved Wireguard public key.
type ServiceWatcher ¶
ServiceWatcher reconciles Service objects to retrieve the Wireguard endpoint.
func NewServiceWatcher ¶
func NewServiceWatcher(enqueuefn func(workqueue.RateLimitingInterface)) *ServiceWatcher
NewServiceWatcher returns a new initialized ServiceWatcher instance.
func (*ServiceWatcher) Handlers ¶
func (sw *ServiceWatcher) Handlers() handler.EventHandler
Handlers returns the set of handlers used for the Watch configuration.
func (*ServiceWatcher) Predicates ¶
func (sw *ServiceWatcher) Predicates() predicate.Predicate
Predicates returns the set of predicates used for the Watch configuration.
func (*ServiceWatcher) WaitForConfigured ¶
func (sw *ServiceWatcher) WaitForConfigured(ctx context.Context) bool
WaitForConfigured waits until a valid key is retrieved for the first time.
func (*ServiceWatcher) WiregardEndpoint ¶
func (sw *ServiceWatcher) WiregardEndpoint() (ip, port string)
WiregardEndpoint returns the retrieved Wireguard endpoint information (IP/port).