Skip to content
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 #14591

Closed
wants to merge 2 commits into from

Conversation

blublinsky
Copy link

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

  • Add configuration for owner reference
  • Add Owner manager resource
  • Add Owner manager support to KubernetesJobManagerParameters
  • Updated Job Manager factory to process owner's reference
  • Updated Job Manager factory unit test

Verifying this change

This change added tests and can be verified as follows:
Running job manager factory unit test

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @public(Evolving): (yes / no) yes
  • The serializers: (yes / no / don't know) no
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know) no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / no / don't know) yes
  • The S3 file system connector: (yes / no / don't know)no

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented) java doc

@flinkbot
Copy link
Collaborator

flinkbot commented Jan 8, 2021

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 7100ec2 (Fri May 28 08:15:49 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

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 commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@blublinsky
Copy link
Author

This is replacement for #14512
Because the previous fork was removed, had to recreate a PR

@flinkbot
Copy link
Collaborator

flinkbot commented Jan 8, 2021

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

Copy link
Contributor

@wangyang0918 wangyang0918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blublinsky The changes now look really good to me. Could you please regenerate the config docs? Currently, the azure pipeline failed because of the doc tests.

mvn package -Dgenerate-config-docs -pl flink-docs -am -nsu -DskipTests

Please do not delete the remote repository and just force push again after updates so that we could keep all the changes in one PR.

@wangyang0918
Copy link
Contributor

I have run a Flink application on minikube with setting the owner reference of JobManager deployment to a new created service(e.g. my-test-svc). After the service is deleted, all the application K8s related resources, including JobManager deployment, could be deleted by GC. This PR works well.

@wangyang0918
Copy link
Contributor

ping @blublinsky Could you please address the comments before merging?

@blublinsky
Copy link
Author

Sorry about missing this. Done

Copy link
Contributor

@wangyang0918 wangyang0918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for merging.

cc @xintongsong Could you please have a final check and help with merging?

Copy link
Contributor

@xintongsong xintongsong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @blublinsky for preparing the PR, and @wangyang0918 for the review.
The feature looks really good to me. I have only minor comments about the documentation. Please take a look.

@blublinsky
Copy link
Author

Sorry @xintongsong, are we done now?

@xintongsong
Copy link
Contributor

xintongsong commented Jan 28, 2021

Sorry, closed the PR by mistake.

@blublinsky, you have not addressed my comment.

  • Why is the owner reference only set for JobManager. Are other resources guaranteed to be cleaned up? We might want to make it more explicit that "delete the actual cluster" means all resources are cleaned up.
  • How exactly to use the configuration option. I would suggest to add an example (with multiple owner references).

The above should be explained in the configuration option description.

@xintongsong xintongsong reopened this Jan 28, 2021
@blublinsky
Copy link
Author

"Why is the owner reference only set for JobManager. Are other resources guaranteed to be cleaned up? We might want to make it more explicit that "delete the actual cluster" means all resources are cleaned up."
Owner reference will ensure deletion of Job manager deployment. Deployment deletion will trigger all instances of Job manager. Job manager deletion will delete all of the Task managers that it controls. As a result deletion of the Job manager deployment leads to deletion of the cluster and setting owner reference on Job manager deployment is sufficient for controlled deletion of the cluster

How exactly to use the configuration option. I would suggest to add an example (with multiple owner references).
Example of setting owner reference looks like following:
-Dkubernetes.jobmanager.owner.reference="apiversion":"cloudflow.io/v1beta1",
"blockownerdeletion":"true","controller":"true","kind":"FlinkApplication","name:"testapp","uid":"e3c9aa3f-cc42-4178-814a-64aa15c82373"
Currently multiple owner reference is not supported. It can be added, but there is not real need for this. Usage of multiple owner reference is allowed, but rarely used

@xintongsong
Copy link
Contributor

@blublinsky

By explain in the configuration option description, I don't mean to explain as comments in this GitHub Pull Request.

In the file KubernetesConfigOptions.java, you added a ConfigOption<xxx> JOB_MANAGER_OWNER_REFERENCE. This is the configuration option. When building this configuration option, there is a withDescription(), that sets the description for this configuration option. This description will be used for generating documents to help users understand how to use this configuration option.

So what I meant is that we should explain the two questions in this description.

@blublinsky
Copy link
Author

@xintongsong , done

Copy link
Contributor

@xintongsong xintongsong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @blublinsky, taking over from here.

@wangyang0918
Copy link
Contributor

Thanks @xintongsong for refining the description and merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants