[FLINK-28829][k8s] Support prepreparing K8S resources before JM creation#20498
[FLINK-28829][k8s] Support prepreparing K8S resources before JM creation#20498bzhaoopenstack wants to merge 1 commit intoapache:masterfrom
Conversation
e6e33f8 to
5d9c834
Compare
5d9c834 to
211d0ef
Compare
|
|
||
| private List<HasMetadata> accompanyingResources; | ||
|
|
||
| private List<HasMetadata> prePreparedResources; |
There was a problem hiding this comment.
| private List<HasMetadata> prePreparedResources; | |
| private final List<HasMetadata> prePreparedResources; |
There was a problem hiding this comment.
hmm, how about just follow the style of accompanyingResources? If we change this, we should also keep the same with accompanyingResources. And that was not related with this PR.
...ernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/Fabric8FlinkKubeClientTest.java
Outdated
Show resolved
Hide resolved
...est/java/org/apache/flink/kubernetes/kubeclient/factory/KubernetesJobManagerFactoryTest.java
Outdated
Show resolved
Hide resolved
|
|
||
| // check the preprepared resources had been created. | ||
| final List<Pod> resultPods = kubeClient.pods().inNamespace(NAMESPACE).list().getItems(); | ||
| assertThat(resultPods).hasSize(3); |
There was a problem hiding this comment.
Shouldn't this be at least 4 pods ?
1 pod for the JM itself and 3 mock-pod-preprepared-resource-**.
There was a problem hiding this comment.
This is UT, it won't create any real Pods, just a k8s models objects. Actually, JM will be created by K8S deployment, In the real env, that's true it should be 4 pods.
In this PR, we introduces several things below: 1. We introduce a new interface func for all decorators to support create pre-prepared k8s resources. 2. We extend a attribute for JM spec for storing the resources list. 3. Extending the ability for supporting refresh the preprepared resource's ownerreference based on original code logic. 4. Add the ability for creating K8S resource before JM deployment creation in Fabric client.
211d0ef to
e9939ec
Compare
|
@flinkbot run azure |
wangyang0918
left a comment
There was a problem hiding this comment.
Thanks for creating this PR. After more consideration, I have one concern about whether we really need the pre-prepared resources. If the accompanyingResources are created before the JobManager deployment, then it could satisfy our requirement. Right?
FYI: accompanyingResources is designed for being created before deployment. The current implementation is just to avoid resource leak and save one K8s apiserver request.
| final List<HasMetadata> prePreparedResources = kubernetesJMSpec.getPrePreparedResources(); | ||
|
|
||
| // before create Deployment | ||
| this.internalClient.resourceList(prePreparedResources).createOrReplace(); |
There was a problem hiding this comment.
We might have resources leak here if the flink client crashed exactly after the pre-prepared resources created.
| } | ||
|
|
||
| @Test | ||
| void testMockPrePreparedResources() throws Exception { |
There was a problem hiding this comment.
The throws Exception is useless.
|
Hi! As you probably know, this PR is introducing some breaking changes. Our academic tool BreakBot helps developers to better assess the impact that these BCs may have on client projects. While this can be on purpose, we found out that some clients among the most popular on GitHub may be faced with broken code. We hope this information is valuable to you, and apologize otherwise. |
|
This PR is being marked as stale since it has not had any activity in the last 180 days. If you are having difficulty finding a reviewer, please reach out to the [community](https://flink.apache.org/what-is-flink/community/). If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 90 days, it will be automatically closed. |
|
This PR has been closed since it has not had any activity in 120 days. |
In this PR, we introduces several things for supporting create another k8s resources before JM deploy creation
What is the purpose of the change
(For example: This pull request makes task deployment go through the blob server, rather than through RPC. That way we avoid re-transferring them on each deployment (during recovery).)
For supporting customized k8s scheduler, we need to extend the ability of current code tree to support the cases of all customized k8s scheduler during they schedule the real pods. So we'd better to extend all cases during k8s scheduling, such as before/during/after our target resources creation. In this PR, we add the
beforecase. And current code tree had covered during/after cases.Brief change log
create pre-prepared k8s resources.
resource's ownerreference based on original code logic.
creation in Fabric client.
Verifying this change
We can not verify this change at this moment, as this is a internal process in flink-kubernetes now. It doesn't affect the user interface now. The only way we can test it is mocking a JM spec with another k8s resources which is not contained by Flink. And check whether the resources can be created before the JM and refresh the correct ower reference(Flink cluster id-- deployment id).
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation