Add "--allow-empty-values" flag #250
Merged
+222
−41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✨ Summary
Operator versions
<= 1.9.xignored fields with empty values and didn't include them in k8s secrets. In case if an item doesn't have default values set (aka password, username notes), it ignored them and k8 secret contained only field that had values set. For example:v1.10.0 (PR) introduced a feature that allows to create k8s secret with empty values from the fields that has not value set.
That results in k8 secrets looks like this
There are some use cases when it's required to create k8s secret with empty value (like this). And for some users it breaks existing workflows as in #246, the operator should support both use cases.
To enable the support for both cases a new
allow-empty-valuesflag is introduced.By default the flag is set to
false. That will support backward compatibility and for the users that used versions<= v1.9xand will upgrade to the latest, nothing will change. Though, the users that relies onv1.10.xbehavior (want's empty values) will need to redeploy their operator with--allow-empty-values=true.🔗 Resolves: #246
✅ Checklist
🕵️ Review Notes &⚠️ Risks
Should be tested with Connect, as the issue can be reproduced only with Connect.
SDK(when using with service account) and Connect have a mismatch in returned response.
SDK doesn't return fields with empty values at all. In a contrast Connect does return all the fields.
Future SDK releases should have a fix for that, and SDK version used by the operator should be upgraded. Issue to track this #249
How to test steps:
Create an item in 1password that have no default fields set (username, password, notes) but having only custom field with any value.
vzt/allow-empty-values-flagbranchminikube starteval $(minikube docker-env)export OP_CONNECT_TOKEN=your_tokenmake docker-buildtrueinconfig/manager/manager.yamlmake deploykubectl apply secret.yaml-> create you CRkubectl get secret secret_name -o yamldatawithin the secret contains only the field that is populated in 1password item. Password, username, note fields are not in k8s secret.config/manager/manager.yaml, and pass--allow-empty-values=trueflag. (add it below this line).kubectl get secret secret_name -o yamldatawithin the secret contains all the field, including empty password, username, notes.