-
Notifications
You must be signed in to change notification settings - Fork 42
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
Comparison of elements is too strict #151
Comments
Well, it's a Vec because the spec says it's an array. It does have This should be the behavior of every client library. Eg both Python and C# also represent import kubernetes
c1 = kubernetes.client.V1Container(name='foo', env=[kubernetes.client.V1EnvVar('a', 'x'), kubernetes.client.V1EnvVar('b', 'y')])
c2 = kubernetes.client.V1Container(name='foo', env=[kubernetes.client.V1EnvVar('b', 'y'), kubernetes.client.V1EnvVar('a', 'x')])
print(c1 == c2) # False
c1.env = sorted(c1.env, key=lambda e: e.name)
c2.env = sorted(c2.env, key=lambda e: e.name)
print(c1 == c2) # True
We could have a custom It would be better for you who owns the |
Thanks for the info ! Makes sense. I will just sort the environmental variables then! |
Hello and thank you for the great project !
I have a use case that I want to compare some deployments and see if they are equal. Let`s take for example the below 2 deployments:
The only difference of these deployments is the order of the environmental variables.
When we compare them using the crate, the comparison returns false. Is that expected?
Is there a way of comparing and ignoring the order of the elements?
I am guessing this would also happen for other elements and Kinds
KR,
Vasileios
The text was updated successfully, but these errors were encountered: