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-16600][k8s] Fix not respecting the RestOptions.BIND_PORT for the Kubernetes setup #11705

Closed
wants to merge 1 commit into from

Conversation

zhengcanbin
Copy link
Contributor

What is the purpose of the change

Our current logic only takes care of RestOptions.PORT but not RestOptions.BIND_PORT, which is a bug; for example, when one sets the RestOptions.BIND_PORT to a value different from RestOptions.PORT, jobs could not be submitted to the existing session cluster deployed via the kubernetes-session.sh.

This PR fixes the bug.

Brief change log

Set the RestOptions.BIND_PORT as the target port of the external Service.

Verifying this change

This change can be tested via the existing unit tests.

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

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

Documentation

  • Does this pull request introduce a new feature? (no)

@flinkbot
Copy link
Collaborator

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 005f751 (Sat Apr 11 02:56:04 UTC 2020)

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

@flinkbot
Copy link
Collaborator

flinkbot commented Apr 11, 2020

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

@zhengcanbin
Copy link
Contributor Author

@flinkbot run travis

@zhengcanbin
Copy link
Contributor Author

@flinkbot run azure

@zhengcanbin
Copy link
Contributor Author

@tisonkun @tillrohrmann @wangyang0918 Could you help take a look at this PR? Thanks a lot in advance!

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

I don't think such a change verified by "existing" tests. If the configuration isn't respect, you should point out/add a specific test failed without this change and pass with it.

@wangyang0918
Copy link
Contributor

The changes looks good to me. I agree with @tisonkun that we need to add a new test, which will fails before the changes and pass after it.
For the test, i think we could have the following assumption.

  • The port of rest service should be equal to rest.port.
  • The targetPort should be equal to rest.bind-port.

@zhengcanbin
Copy link
Contributor Author

zhengcanbin commented Apr 18, 2020

Hi, @tisonkun @wangyang0918 Thanks for your review and comments.

The test case of ExternalServiceDecoratorTest#testBuildAccompanyingKubernetesResources already covers the test branch; before this PR, Line 72 has checked that the service port equals to the rest.port; after this PR, Line 73 checked that the service target port equals to the rest.bind-port, and if we don't add this line, ExternalServiceDecoratorTest#testBuildAccompanyingKubernetesResources will definitely fail after this change.

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Could you add a new test and make sure we test with and without setting BIND_PORT.

As you change existing test, our test coverage has been downgraded.

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

With a quick offline discussion with @zhengcanbin I get the point that the existing test org.apache.flink.kubernetes.kubeclient.decorators.ExternalServiceDecoratorTest#testBuildAccompanyingKubernetesResources will fail with production code changes because we now always set targetPort which follows K8s best practice.

So the change of existing test is for respect this change and accidentally we configure BIND_PORT so that verify exactly the BIND_PORT is set. The fallback logic should be guarded by RestOption's tests themselves.

@wangyang0918 does this explanation make sense to you?

@wangyang0918
Copy link
Contributor

@tisonkun @zhengcanbin I have checked the test and changes again. If we set rest.bind-port explicitly, the test testBuildAccompanyingKubernetesResources should fail. So updating the test seems reasonable.

Now i give the pass, +1 for merging.

@tisonkun tisonkun closed this in 7a7aaec Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants