Documentation
¶
Index ¶
- func CNSToCRDSpec() (*nnc.NodeNetworkConfigSpec, error)
- func CRDStatusToNCRequest(crdStatus *nnc.NodeNetworkConfigStatus) (*cns.CreateNetworkContainerRequest, error)
- func GetKubeConfig() (*rest.Config, error)
- func NewCrdRequestController(restService *restserver.HTTPRestService, kubeconfig *rest.Config) (*crdRequestController, error)
- func SetupSignalHandler(exitChan chan<- bool) (stopCh <-chan struct{})
- type CrdReconciler
- type KubeClient
- type NodeNetworkConfigFilter
- type ObjectKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CNSToCRDSpec ¶
func CNSToCRDSpec() (*nnc.NodeNetworkConfigSpec, error)
CNSToCRDSpec translates CNS's list of Ips to be released and requested ip count into a CRD Spec
func CRDStatusToNCRequest ¶
func CRDStatusToNCRequest(crdStatus *nnc.NodeNetworkConfigStatus) (*cns.CreateNetworkContainerRequest, error)
CRDStatusToNCRequest translates a crd status to network container request
func GetKubeConfig ¶
GetKubeConfig precedence * --kubeconfig flag pointing at a file at this cmd line * KUBECONFIG environment variable pointing at a file * In-cluster config if running in cluster * $HOME/.kube/config if exists
func NewCrdRequestController ¶
func NewCrdRequestController(restService *restserver.HTTPRestService, kubeconfig *rest.Config) (*crdRequestController, error)
NewCrdRequestController given a reference to CNS's HTTPRestService state, returns a crdRequestController struct
func SetupSignalHandler ¶
func SetupSignalHandler(exitChan chan<- bool) (stopCh <-chan struct{})
SetupSignalHandler registers for SIGTERM and SIGINT. A stop channel is returned which is closed on one of these signals. If a second signal is caught, the program is terminated with exit code 1. exitChan is notified when a SIGINT or SIGTERM signal is received.
Types ¶
type CrdReconciler ¶
type CrdReconciler struct {
KubeClient KubeClient
NodeName string
CNSClient cnsclient.APIClient
}
CrdReconciler watches for CRD status changes
func (*CrdReconciler) SetupWithManager ¶
func (r *CrdReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager Sets up the reconciler with a new manager, filtering using NodeNetworkConfigFilter
type KubeClient ¶
type KubeClient interface {
Get(ctx context.Context, key client.ObjectKey, obj runtime.Object) error
Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error
}
KubeClient is an interface that talks to the API server
type NodeNetworkConfigFilter ¶
func (NodeNetworkConfigFilter) Create ¶
func (n NodeNetworkConfigFilter) Create(e event.CreateEvent) bool
Only process create events if CRD name equals this host's name
func (NodeNetworkConfigFilter) Delete ¶
func (n NodeNetworkConfigFilter) Delete(e event.DeleteEvent) bool
TODO: Decide what deleteing crd means with DNC Ignore all for now
func (NodeNetworkConfigFilter) Update ¶
func (n NodeNetworkConfigFilter) Update(e event.UpdateEvent) bool
Returns true if request is to be processed by Reconciler Checks that old generation equals new generation because status changes don't change generation number