-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add cluster hardening tests #759
base: main
Are you sure you want to change the base?
Conversation
e2352fd
to
1de322f
Compare
4933f79
to
fd8bf54
Compare
I started reviewing this PR some days ago and some tests are failing every time I try unfortunately. Even when I try different kind configurations.
I am not sure why, maybe a special cluster config is needed, at least they should work for you, so can you share your cluster configuration please? |
Hm, actually the kind config file is already there. So I am more confused why this is not working for me. |
Sorry for the confusion. I would say tests are working but these 3 are not passing due to the current KinD setup. If it is mandatory that all tests need to be passed against KinD then we need to adjust the config of the kind cluster.
|
Alright, I see, I will try to test again against a real K8s cluster. |
Tests/kaas/kaas-sonobuoy-tests/scs-conformance-sonobuoy-plugin.yaml
Outdated
Show resolved
Hide resolved
5c6bf51
to
25b5bcd
Compare
I was able to let all tests pass against a custom KubeAdm cluster but I needed to make some changes to the cluster, as well as to the code (see another comment).
|
Some implementation notes for things I needed to configure: For Test "Test_scs_0217_sonobuoy_PodSecurity_Standards_And_Admission_Controller_Enabled": Two things needed to be changed in the cluster: Enable PodSecurity admission controller:
Add enforce policy annotations to namespaces:
For system namespaces, restrict the following:
Enable Pod Security:
(See file content below)
For Test "Test_scs_0217_sonobuoy_Authentication_Methods", I needed to use another auth method.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall great work! Please address my comments and we can merge it soon!
Tests/kaas/kaas-sonobuoy-tests/scs_k8s_conformance_tests/scs_0217_cluster_hardening_test.go
Outdated
Show resolved
Hide resolved
Tests/kaas/kaas-sonobuoy-tests/scs_k8s_conformance_tests/scs_0217_cluster_hardening_test.go
Outdated
Show resolved
Hide resolved
Tests/kaas/kaas-sonobuoy-tests/scs_k8s_conformance_tests/scs_0217_cluster_hardening_test.go
Outdated
Show resolved
Hide resolved
Thanks for the review, I will try to address the comments as soon as possible. |
fe5ee7f
to
70c8cc9
Compare
kubeadmConfigPatches: | ||
- | | ||
apiVersion: kubeadm.k8s.io/v1beta3 | ||
kind: ClusterConfiguration | ||
metadata: | ||
name: config | ||
apiServer: | ||
extraArgs: | ||
enable-admission-plugins: "NodeRestriction,PodSecurity" | ||
oidc-issuer-url: https://localhost:8443 | ||
oidc-client-id: kubernetes | ||
oidc-username-claim: sub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately since kind and kubeadm are different things, we cannot leave the configuration here.
Imo this needs to be addressed in the implementation node section in another issue/PR. Please exclude it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I included these settings because they are necessary to ensure that certain tests pass against kind. However, if you'd prefer to address this configuration in the implementation node section in another PR/issue, I will remove it from this PR as you suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the last minor thing, after that LGTM.
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]> Fixup Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: michal.gubricky <[email protected]>
70c8cc9
to
b962d02
Compare
This PR adds tests for K8s cluster hardening
Fixes SovereignCloudStack/issues#670