Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IP ranges cleanup #118

Merged
merged 16 commits into from
Jul 22, 2021
Merged

Commits on Jul 21, 2021

  1. Extract the kubernetes connection related data to a struct

    To preserve the existing code base, we embed the new type within
    the KubernetesIPAM (old type).
    
    In a follow-up commit, this new struct will be used on a separate
    golang binary (which doesn't require the KubernetesIPAM
    configuration), to provide a simple connection to the Kubernetes
    backend (does not support etcd).
    
    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    ffdb682 View commit details
    Browse the repository at this point in the history
  2. ip-reconciler: add new binary

    Fow now, we only read the kubeconfig file, which is specified via
    the cmd line - as its only argument.
    
    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    ac7507e View commit details
    Browse the repository at this point in the history
  3. Generate the Kubernetes client object

    Introduce a dedicated constructor in the storage pkg to create the
    newly created `KubernetesClient` struct. The existing
    `KubernetesIPAM` struct will re-use this new constructor.
    
    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    7d70fb8 View commit details
    Browse the repository at this point in the history
  4. Have IPReservation implement the Stringer interface

    Follow-up commits will use this new method for debugging, which
    makes it simpler to track the IP to pod assignments.
    
    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    edf1bf5 View commit details
    Browse the repository at this point in the history
  5. Export find IPReservation matching ID to a func

    Currently, matching the owner of the IP when deallocating the
    address happens only based on the containerID.
    
    In follow-up commits we will require this behavior to happen based
    on the pod reference attribute.
    
    This commit prepares the code base for that, by enabling the caller
    to inject the criteria for identifying the owner of an IP into the
    IP address de-allocation function.
    
    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    34acf15 View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2021

  1. ip-reconciler: find and remove orphaned IP addresses

    This behavior will be encapsulated in a new struct named
    `ReconcileLooper`, which features methods for:
      - CancelContext; cancels the current execution context
      - FindOrphanedIPsPerPool; returns a list of the orphaned
        IP addresses, indexed by pool
      - ReconcileIPPool; receives a list of orphaned IP
        addresses, and cleans them up from the respective pools
        where they are currently allocated.
    
    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    4e0aa2e View commit details
    Browse the repository at this point in the history
  2. reconciler: add e2e tests

    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    8f73197 View commit details
    Browse the repository at this point in the history
  3. ip-reconciler: fire up cronjob every 5 mins

    The service account for whereabouts requires the ability of
    listing the pods on all namespaces, so it can check which ones
    feature orphaned IPs.
    
    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    94c6bd1 View commit details
    Browse the repository at this point in the history
  4. ip-reconciler: add unit tests

    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    2f3f64e View commit details
    Browse the repository at this point in the history
  5. ip-reconciler: add plumbers network status entity

    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    90c7617 View commit details
    Browse the repository at this point in the history
  6. ip-reconciler: also account for the pods IP addresses

    Only mark a pod as "alive" when the pod's annotations feature the
    IP being de-allocated.
    
    This makes the reconciler binary *dependent* on multus, which adds
    these `network-status` annotations into the pod.
    
    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    8fc04e4 View commit details
    Browse the repository at this point in the history
  7. ip-reconciler, docs: mention the reconciler in the README

    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    5ed98e5 View commit details
    Browse the repository at this point in the history
  8. ip-reconciler: simplify ip looper code

    By not returning an `IPReservation` entry - we now return an IP
    address instead - we simplify the code.
    
    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    66b75ad View commit details
    Browse the repository at this point in the history
  9. reconcile cluster wide IPs

    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    0154617 View commit details
    Browse the repository at this point in the history
  10. e2e test overlapping IPs

    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    5f160d8 View commit details
    Browse the repository at this point in the history
  11. ip-reconciler: improve efficiency

    This commit changes the reconciler logic to only parse the
    network-status annotations of whereabouts pods - e.g. pods whose
    pod referecences (<namespace>/<pod name>) feature in any of the
    whereabouts IPPools.
    
    Signed-off-by: Miguel Duarte Barroso <[email protected]>
    maiqueb committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    d1b0bf0 View commit details
    Browse the repository at this point in the history