-
Notifications
You must be signed in to change notification settings - Fork 104
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
KEP-27: Detailed pod restart control by dependencies hash #1483
Conversation
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Reorganize code Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
@ANeumann82 I'll get this reviewed, sorry for the delay! |
Added unit test Moved kuttl test to e2e, deployments won't work with integration Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
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! 👏
I left a few comments, most of them are nits. I'd like to question the use of metav1.Object
and the resulting reflection in the form of reflect.TypeOf
. Aren't we better using the Unstructured
and the GetObjectKind()
method to build keys/cache/sort especially because the enhancer already converts all passed objects to unstructered?
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.
The hash dependency handling looks fine, I'm mostly worried about compatibility with older and newer API versions of Kubernetes objects. This is handled with Group/Version/Kind of runtime objects and we should do the same instead of using Go reflection. This will complicate functions like setTemplateHash
but will also ensure that operators don't break when using different API versions of resources.
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Adjusted e2e test Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
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.
Aside from a few nits, my only wish would be to have more unit test coverage. Lower test levels - higher development speed 😉
pkg/engine/renderer/enhancer_test.go
Outdated
assert.Equal(t, "929a2dffa86ad2460fdcf72977998bd0", hash, "Hashes are not the same") | ||
assert.True(t, ok, "Statefulset contains no dependency hash field") | ||
} | ||
} |
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'd like to see more test coverage on the unit test level. For example, could you add a test, where a parameter change leads to a hash change (where a hash is already set)? And could you also through in an independent object (e.g. a Deployment) and check that the hash is not set on it?
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.
Added unit tests, let me know if you have another idea for one.
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
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.
A few testing nits but this is great work! Definitely a release highlight (and needs some better PR description showcasing the greatness)! 👏
assert.Nil(t, hash, "Pod template spec annotations contains a dependency hash but no dependencies") | ||
} | ||
|
||
func TestEnhancerApply_dependencyHash_changes(t *testing.T) { |
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.
suggestion: for long tests like this, which go through multiple states ginkgo might offer a better structure (and closer to scalatest). Take a look at the instance_admission_integration_test.go
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
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!
Using Kubernetes's own typing mechanism instead of reflection makes this more abstract and, IMO, less readable but keeps us compatible with possible API changes.
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
What this PR does / why we need it:
last-plan-execution-uid
from the pod template specFixes #1424 #1036
Documention: kudobuilder/kudo.dev#238