Skip to content

feature(containerz): Add CNTR-1.11 comprehensive capabilities matrix and deviation enforcement - #5969

Open
f-sommerauer wants to merge 7 commits into
openconfig:mainfrom
f-sommerauer:cntr-1-11-comprehensive-capabilities
Open

feature(containerz): Add CNTR-1.11 comprehensive capabilities matrix and deviation enforcement#5969
f-sommerauer wants to merge 7 commits into
openconfig:mainfrom
f-sommerauer:cntr-1-11-comprehensive-capabilities

Conversation

@f-sommerauer

Copy link
Copy Markdown

Description

This PR introduces CNTR-1.11: Comprehensive Container Capabilities Matrix and Deviation Enforcement to validate gnoi.Containerz.StartContainer against the complete spectrum of standard Linux capabilities defined by capabilities(7) and OpenConfig containerz.proto.

Scope of Changes

  1. Specification (README.md):

    • Added section ## CNTR-1.11: Comprehensive Container Capabilities Matrix and Deviation Enforcement.
    • Full Capability Spectrum: Documented evaluation across 38 standard capabilities:
      • Administrative (16): CAP_SYS_ADMIN, CAP_SYS_MODULE, CAP_SYS_RAWIO, CAP_SYS_PTRACE, CAP_SYS_PACCT, CAP_SYS_BOOT, CAP_SYS_NICE, CAP_SYS_RESOURCE, CAP_SYS_TIME, CAP_SYS_TTY_CONFIG, CAP_SYSLOG, CAP_WAKE_ALARM, CAP_BLOCK_SUSPEND, CAP_AUDIT_CONTROL, CAP_AUDIT_READ, CAP_AUDIT_WRITE
      • Networking (4): CAP_NET_ADMIN, CAP_NET_RAW, CAP_NET_BIND_SERVICE, CAP_NET_BROADCAST
      • Filesystem & Process (18): CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_DAC_READ_SEARCH, CAP_FOWNER, CAP_FSETID, CAP_KILL, CAP_SETGID, CAP_SETUID, CAP_SETPCAP, CAP_LINUX_IMMUTABLE, CAP_IPC_LOCK, CAP_IPC_OWNER, CAP_SYS_CHROOT, CAP_MKNOD, CAP_LEASE, CAP_SETFCAP, CAP_MAC_ADMIN, CAP_MAC_OVERRIDE
    • Subtest 1 (CapAdd): Procedures for elevated capability requests, verifying start success and handling daemon rejections (INVALID_ARGUMENT, FAILED_PRECONDITION, INTERNAL) while asserting zero orphaned container state.
    • Subtest 2 (CapDrop): Procedures for dropping default bounding set capabilities (CAP_NET_RAW, CAP_SYS_CHROOT, CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_FOWNER, CAP_FSETID, CAP_KILL, CAP_MKNOD, CAP_NET_BIND_SERVICE, CAP_SETFCAP, CAP_SETGID, CAP_SETPCAP, CAP_SETUID, CAP_AUDIT_WRITE).
  2. Test Automation (containerz_test.go):

    • Implemented TestComprehensiveCapabilities(t *testing.T) executing table-driven subtests for CapAdd and CapDrop.
    • Robust cleanup routines via t.Cleanup for containers and deployed test images.
  3. Test Registry (testregistry.textproto):

    • Registered CNTR-1.11 entry with description and README link.

…ons tests to CNTR-1

Updates feature/container/containerz/tests/container_lifecycle/:
- README.md: Document CNTR-1.9 (Capabilities) and CNTR-1.10 (Volume Mount Options Matrix).
- containerz_test.go: Implement TestCapabilities (elevated, dropped CAP_NET_RAW/CAP_SYS_CHROOT, invalid rejection) and TestVolumeMountOptions (rbind, rslave, rprivate, ro, bind matrix reflection and deletion verification).

Hardware Verification:
- Target: Arista DCS-7280CR3K-32D4-F (EOS 4.34.2FX-wbb.2-DPE-CTNR)
- Subtests passed: TestCapabilities (Elevated, Dropped, Invalid), TestVolumeMountOptions (RbindRslave, RbindRprivate, BindRslaveRo, BindRo, Bind)
@f-sommerauer
f-sommerauer requested a review from a team as a code owner August 28, 2026 22:10
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a comprehensive validation suite for container capabilities within the gnoi.Containerz framework. It ensures that the system correctly handles the full spectrum of Linux capabilities, including both granting elevated privileges and dropping default bounding set capabilities, while also enforcing platform-specific deviations.

Highlights

  • Specification Update: Added documentation for CNTR-1.11, covering the comprehensive Linux capabilities matrix and deviation enforcement procedures.
  • Test Automation: Implemented TestComprehensiveCapabilities in containerz_test.go, providing table-driven subtests for both capability addition and dropping.
  • Registry Registration: Registered the new CNTR-1.11 test case in testregistry.textproto.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@OpenConfigBot

OpenConfigBot commented Aug 28, 2026

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds test plans and Go implementations for three new container lifecycle tests: CNTR-1.9 (capabilities validation), CNTR-1.10 (volume mount options), and CNTR-1.11 (comprehensive capabilities matrix). Feedback highlights that the platform deviation check for unsupported capabilities is missing from the CNTR-1.11 implementation, and that CNTR-1.9 and CNTR-1.10 are not registered in testregistry.textproto. Additionally, the exec path for CNTR-1.11 is left blank, and boolean flags should be used to prevent redundant container cleanup operations in the subtests.

// TestComprehensiveCapabilities implements CNTR-1.11 validating that containers can be started with
// the complete spectrum of standard Linux capabilities, dropped capabilities in the default bounding set,
// and deviation/invalid capability rejection handling.
func TestComprehensiveCapabilities(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The test plan in README.md specifies checking platform deviations using deviations.ContainerzUnsupportedCapabilities(dut) to validate unsupported capabilities on targets where vendor daemon policies restrict specific capability flags. However, this check is completely missing from the test implementation in TestComprehensiveCapabilities.\n\nPlease implement this deviation check as documented in the test plan. According to the Deviation Guidelines in the repository style guide:\n1. Define the deviation in proto/metadata.proto.\n2. Generate Go code using make proto/metadata_go_proto/metadata.pb.go.\n3. Add an accessor function in internal/deviations/deviations.go that accepts *ondatra.DUTDevice.\n4. Enable the deviation in the test's metadata.textproto file.\n5. Access the deviation in the test via deviations.ContainerzUnsupportedCapabilities(dut).

References
  1. Access deviations via deviations.DeviationName(dut). (link)

Comment on lines +1427 to +1432
if err := cli.StopContainer(ctx, instName, true); err != nil {
t.Errorf("StopContainer(%q) failed: %v", instName, err)
}
if err := cli.RemoveContainer(ctx, instName, true); err != nil {
t.Errorf("RemoveContainer(%q) failed: %v", instName, err)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The explicit calls to cli.StopContainer and cli.RemoveContainer at the end of the CapAdd subtest are performed during normal execution, but they are also registered in the deferred cleanup block. To prevent redundant cleanup operations (and unnecessary RPCs) when the deferred block runs, use a boolean flag to track whether the cleanup has already occurred.

References
  1. When deferring cleanup actions (such as stopping traffic) that may also be called explicitly during normal execution, use a boolean flag to track whether the cleanup has already occurred to prevent redundant cleanup operations in the deferred block.

Comment on lines +1476 to +1481
if err := cli.StopContainer(ctx, instName, true); err != nil {
t.Errorf("StopContainer(%q) failed: %v", instName, err)
}
if err := cli.RemoveContainer(ctx, instName, true); err != nil {
t.Errorf("RemoveContainer(%q) failed: %v", instName, err)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similarly, the explicit calls to cli.StopContainer and cli.RemoveContainer at the end of the CapDrop subtest are also registered in the deferred cleanup block. Please use a boolean flag to track whether the cleanup has already occurred to prevent redundant cleanup operations in the deferred block.

References
  1. When deferring cleanup actions (such as stopping traffic) that may also be called explicitly during normal execution, use a boolean flag to track whether the cleanup has already occurred to prevent redundant cleanup operations in the deferred block.

Comment thread testregistry.textproto Outdated
id: "CNTR-1.11"
description: "Comprehensive Container Capabilities Matrix and Deviation Enforcement"
readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/container/containerz/tests/container_lifecycle/README.md"
exec: " "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The exec field for CNTR-1.11 is currently set to a blank space " ". It should point to the actual test execution file containerz_test.go where TestComprehensiveCapabilities is implemented.

Suggested change
exec: " "
exec: "https://github.com/openconfig/featureprofiles/blob/main/feature/container/containerz/tests/container_lifecycle/containerz_test.go"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the exec field for CNTR-1.11 to point directly to containerz_test.go.

Comment thread testregistry.textproto
Comment on lines +199 to +204
test: {
id: "CNTR-1.11"
description: "Comprehensive Container Capabilities Matrix and Deviation Enforcement"
readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/container/containerz/tests/container_lifecycle/README.md"
exec: " "
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This PR introduces two new test cases: CNTR-1.9 (Container Capabilities Provisioning and Validation) and CNTR-1.10 (Volume Mount Driver Option Matrix and Reflection). However, these test cases are not registered in testregistry.textproto.\n\nPlease register both CNTR-1.9 and CNTR-1.10 in the test registry so they can be properly tracked and executed by the CI pipeline.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registered both CNTR-1.9 and CNTR-1.10 in testregistry.textproto alongside CNTR-1.11.

@f-sommerauer
f-sommerauer force-pushed the cntr-1-11-comprehensive-capabilities branch from 312613d to 5e304e3 Compare August 29, 2026 10:06
…and deviation enforcement

- Added CNTR-1.11 specification to README.md defining the full 38 standard Linux capabilities catalog and 14 default dropped capability candidates.
- Implemented TestComprehensiveCapabilities in containerz_test.go with table-driven subtests for CapAdd and CapDrop.
- Handled daemon rejection error codes (InvalidArgument, FailedPrecondition, Internal) and verified zero orphaned containers.
- Registered CNTR-1.11 in testregistry.textproto.
@f-sommerauer
f-sommerauer force-pushed the cntr-1-11-comprehensive-capabilities branch from 5e304e3 to f2770c7 Compare August 29, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants