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

pkg/maps/egressmap: refactor into a cell #24865

Merged
merged 2 commits into from May 4, 2023
Merged

Commits on May 3, 2023

  1. hivetest: add Lifecycle to make testing easier

    hive requires splitting up object lifecycle into New, Start, Stop.
    It does this by injecting a hive.Lifecycle into constructors. This
    in turn means that we need a lifecycle to create objects during testing.
    
    Implement a minimal hive.Lifecycle for use in testing, which doesn't
    distinguish between New and Start phases and instead immediately
    executes any start hooks. Stop hooks are invoked at test cleanup time.
    
    Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
    lmb committed May 3, 2023
    Configuration menu
    Copy the full SHA
    e5fd387 View commit details
    Browse the repository at this point in the history
  2. pkg/maps/egressmap: refactor policy map into a cell

    Rework the egressmap from a global variable into a Cell. The map still
    has singleton behaviour due to map pinning, but at least for unit tests
    we can opt out of pinning and isolate the map from global changes.
    
    Stop writing out EGRESS_POLICY_MAP_SIZE into node_config.h since
    the map definition in C is never actually used. The map size is
    configured via a command line parameter instead. Hardcode the previously
    used default value to avoid errors when running BPF unit tests.
    This is simpler than wiring the new PolicyConfig into HeaderfileWriter.
    
    Reuse the MapOut strategy from configmap and authmap to ensure that
    the egressmap is initialized by the agent before the loader is invoked.
    Otherwise map creation might use the (incorrect) MaxElems from the
    compiled C code.
    
    Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
    lmb committed May 3, 2023
    Configuration menu
    Copy the full SHA
    ae32e01 View commit details
    Browse the repository at this point in the history