-
Notifications
You must be signed in to change notification settings - Fork 84
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
Avoid conflicts when deployed by ArgoCD #147
Avoid conflicts when deployed by ArgoCD #147
Conversation
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.
Nice work. Remember to also add unit tests for this logic.
return V1ObjectMeta( | ||
name=name, | ||
namespace=namespace, | ||
annotations=_annotations, | ||
labels=_labels, | ||
annotations=dict(_annotations), |
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.
filter_dict
already returns a dict, no need for a typecast. Or?
annotations=dict(_annotations), | |
annotations=_annotations, |
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.
No, actually it returns a generator
object, which has to be unfolded into a dict
before passing to V1ObjectMeta
constructor. The type annotation of filter_dict
is wrong. Nice catch! I'll fix that!
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.
Yes, of course. Makes sense.
I see you corrected the logic.
Any chance you can add some u-tests as well?
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.
@mihaigalos working on it
d3831a6
to
1c5ce10
Compare
This change introduces a black list for labels like the one already existing for metadata. The list contains one entry for the prefix "app.kubernetes.io". The label "app.kubernetes.io/instance" is per default used by ArgoCD to track resources, which causes copied Secrets to be potentially deleted again by ArgoCD. Also labels with prefix "app.kubernetes.io" are in general very specific to the resources in their respective namespace and therefore shouldn't probably be automatically copied to resources in other namespaces anyway. In order to avoid code duplication the filtering is delegated to an embedded function filter_dict. Signed-off-by: Max Harmathy <[email protected]>
1c5ce10
to
60d5abc
Compare
This tests the create_secret_metadata function against some combinations of annotations and labels. Signed-off-by: Max Harmathy <[email protected]>
a22358e
to
2330b7d
Compare
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.
LGTM
This change introduces a black list for labels like the one already existing for metadata.
The list contains one entry for the prefix "app.kubernetes.io". The label "app.kubernetes.io/instance" is per default used by ArgoCD to track resources, which causes copied Secrets to be potentially deleted again by ArgoCD. Also labels with prefix "app.kubernetes.io" are in general very specific to the resources in their respective namespace and therefore shouldn't probably be automatically copied to resources in other namespaces anyway.
In order to avoid code duplication the filtering is delegated to an embedded function filter_dict.
closes #146