feat(reconcile): added a flag to skip validation of the namespace#72
feat(reconcile): added a flag to skip validation of the namespace#72craicoverflow merged 2 commits intoaerogear:masterfrom
Conversation
|
Changes look good 👍 I haven't verified them though. |
davidffrench
left a comment
There was a problem hiding this comment.
Changes look good to me as well. Could you split the code specific to the bypass in a separate commit, this will make it easier to revert later on using just git.
7b103f4 to
a234f6e
Compare
| @@ -0,0 +1,118 @@ | |||
| package mobilesecurityservice | |||
There was a problem hiding this comment.
Should we merge the test here? I am fine with that since we are in the initial dev phase. Just to be sure.
There was a problem hiding this comment.
I plan to remove this before merge as it is incomplete. It is just to allow you to verify this PR more easily.
@davidffrench My editor automatically corrects formatting on save so I didn't really notice! Fixed now. |
There was a problem hiding this comment.
The code changes show fine for me. I'd just suggest for all places where you are passing the bool you add a comment with //FIXME: + small explanation over why it is used.
It also passed in the CI.
#!/bin/bash -eo pipefail
make test
Running tests:
ok github.com/aerogear/mobile-security-service-operator/pkg/controller/mobilesecurityservice 0.040s coverage: 36.8% of statements
Great job 🥇
4139fca to
ef948ae
Compare
Motivation
https://issues.jboss.org/browse/AEROGEAR-9170
What
Added an option to skip checking if the operator namespace is valid during the Reconcile loop.
Why
The Reconcile function recently to check if the namespace provided in a CR is valid.
To do this, the Operator SDK reads the file at
/var/run/secrets/kubernetes.io/serviceaccount/namespaceto see if the CR namespace matches the one at this location.This is fine when the operator is live, but
/var/run/secrets/kubernetes.io/serviceaccount/namespacewould not exist locally where unit tests are running in isolation, so this check will always fail.This flag can be passed in a CR to skip this validation. It is a workaround and will be removed in the future when the Operator SDK is updated. See operator-framework/operator-sdk#1388
How
Added a new property to each CR spec, and if this is set to
truethen the namespace validation is skipped.Verification Steps
Add the steps required to check this change. Following an example.
deploy/crds/mobile-security-service_v1alpha1_mobilesecurityservice_cr.yaml.spec:pkg/controller/mobilesecurityservice/controller.go.pkg/controller/mobilesecurityservice/controller_test.go.TestReconcileMobileSecurityService_Reconcile.pkg/controller/mobilesecurityservice/controller.goshould not be hit whenskipNamespaceValidationistrue.Checklist:
Progress