cnti-testcatalog / testsuite

πŸ“žπŸ“±β˜ŽοΈπŸ“‘πŸŒ Cloud Native Telecom Initiative (CNTI) Test Catalog is a tool to check for and provide feedback on the use of K8s + cloud native best practices in networking applications and platforms
https://wiki.lfnetworking.org/display/LN/Test+Catalog
Apache License 2.0
173 stars 71 forks source link

sonobuoy-serviceaccount makes the cluster_admin platform test fail #2151

Open sysarch-repo opened 1 day ago

sysarch-repo commented 1 day ago

Describe the bug The platform test cluster_admin fails with reference to the sonobuoy facility that is part of the testing framework.

To Reproduce Steps to reproduce the behavior:

  1. Install and set up 1.3.3
  2. Run the cluster_admin platform test
  3. See the failed test referring to sonobuoy-serviceaccount:
    🎬 Testing: [cluster_admin]
    Failed resource: ServiceAccount sonobuoy-serviceaccount
    Remediation: You should apply least privilege principle. Make sure cluster admin permissions are granted only when it is absolutely necessary. Don't use subjects with such high permissions for daily operations.

Expected behavior The testing framework shall not interfere with the AUT/cluster.

Device (please complete the following information):

[ec2-user@ip-10-0-110-88 ~]$ uname -a
Linux ip-10-0-110-88.ec2.internal 5.10.223-212.873.amzn2.x86_64 #1 SMP Wed Aug 7 16:53:32 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

How will this be tested? aka Acceptance Criteria (optional)

Additional context

martin-mat commented 1 day ago

I don't understand why this should be a bug. The test detects service account with cluster admin permissions so it reports it and fails, as per test description https://github.com/cnti-testcatalog/testsuite/blob/main/docs/TEST_DOCUMENTATION.md#cluster-admin

sysarch-repo commented 1 day ago

@martin-mat Thanks for your comment. The use of Sonobuoy is the decision of the CNF testsuite creator, not the user. Therefore, the tools selected for the execution of tests (Sonobuoy for the k8s_conformance test) should not fail any tests that should solely target the AUT of the user. The user cannot fix the Sonobuoy deployment to make the platform test pass for his/her AUT.

martin-mat commented 23 hours ago

I cannot get it reproduced. Can you check and give exact reporoduction steps?

sysarch-repo commented 22 hours ago

@martin-mat, it looks like the issue is with an orphaned Sonobuoy serviceaccount resource. With this, you must run the entire platform test group (the k8s_conformance test before the cluster_admin test) to run into the issue. Just running the platform:cluster_admin test in isolation will not be enough for providing evidence.

Isolated cluster_admin test (no issue as there is no Sonobuoy serviceaccount resource deployed yet):

All platform tests (issue due to orphaned Sonobuoy serviceaccount resource after the k8s_conformance test):