-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
FLINK-20359 Added Owner Reference to Job Manager in native kubernetes #14512
Conversation
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 655b299 (Fri May 28 07:08:20 UTC 2021) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
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.
@blublinsky I really appreciate that you update the PR based on the discussion in the previous one. I left some comments and it will be great if you could integrate them before merging.
*/ | ||
public class KubernetesOwnerReference extends KubernetesResource<OwnerReference> { | ||
|
||
static final String API_VERSION = "apiversion"; |
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.
These variables could be private
.
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 had them private initially, but decided to make them public, so that they can be used for programmatic implementation.
When I am writing code that creates owner reference, its handy to have them available.
WDYT?
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.
IIUC, you mean to refer these variables in your own java program, not Flink source codes. Since KubernetesOwnerReference
is an internal class, which should not be directly used out of Flink. So I am afraid it does not make sense to set these variables public
.
public static KubernetesOwnerReference fromMap(Map<String, String> stringMap) { | ||
final OwnerReferenceBuilder ownerReferenceBuilder = new OwnerReferenceBuilder(); | ||
stringMap.forEach((k, v) -> { | ||
switch (k.toLowerCase()) { |
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 have a question here. Do we have to set all the fields to build an OwnerReference
?
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.
Here is the formal definition https://github.com/kubernetes/apimachinery/blob/21de1bffe600f61f4873ae774a60f7a7d37ac9bf/pkg/apis/meta/v1/types.go#L273-L275. According to it controller and BlockOwnerDeletion are optional. But for practical use, it is my understanding, that everything is required
...test/java/org/apache/flink/kubernetes/kubeclient/decorators/InitJobManagerDecoratorTest.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/apache/flink/kubernetes/kubeclient/decorators/InitJobManagerDecorator.java
Outdated
Show resolved
Hide resolved
This PR also needs to rebase the latest master branch to resolve conflicts. |
…eclient/decorators/InitJobManagerDecoratorTest.java Co-authored-by: Yang Wang <danrtsey.wy@gmail.com>
# Conflicts: # flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/decorators/InitJobManagerDecoratorTest.java
@blublinsky It seems that you have introduced too many unrelated changes in this PR. Could you rebase the latest master branch? I believe the conflicts is caused by huge refactor commit. |
Rebased this PR, it is now #14529 |
cc @blublinsky Actually you do not have to open a new PR every time after addressing the comments. |
The benefit of sticking to the same PR (by (force) pushing changes is that we keep track of the history of changes). I'm closing the other PR. Please push your changes here! |
Sorry guys, how do I force the same PR. Unfortunately not a GIT guru |
@blublinsky First, address the comments and update the source codes locally. Then refine the commit message via |
Oh, my problem is that I am working from the local fork, that I updated to get the latest version. So my previous fork is gone, thats why it created a new commit. So now from a new fork I can't push to the same PR, because it recognizes that my fork has changed |
@blublinsky Do you mean you have delete the fork repository manually? I just want to share how I develop the PRs.
|
THanks @wangyang0918, |
I think maybe you have delete the old forked repository of this PR. Currently it is on an unknown repository. I am not sure whether you could fix it[1]. If not, let's move the discussion to another PR. |
Sorry for that I missed the new PR for the replacement #14591. Let's move the review and discussion there. And then this PR could be closed. |
What is the purpose of the change
Flink implementation is often a part of the larger application. As a result a synchronized management - clean up of Flink resources, when a main application is deleted is important. In Kubernetes, a common approach for such clean up is usage of the owner's reference (https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/)
This PR allows adding owner reference support to Flink Job manager
Brief change log
Verifying this change
This change added tests and can be verified as follows:
Extended InitJobManagerDecoratorTest to validate owner reference support
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (yes / no) yesDocumentation