Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Add PodControlInterface and PodControllerRefManager #73

Merged
merged 7 commits into from
Apr 20, 2020

Conversation

Jeffwan
Copy link
Member

@Jeffwan Jeffwan commented Apr 15, 2020

This PR aims to solve following issue and it also help to remove more direct dependency on Kubernetes. Resolve part of #48 #71

Background

Current implementation uses PodControlInterface and PodControllerRefManager from k8s.io/kubernetes/pkg/controller and self-implemented ServiceControlInterface and ServiceControllerRefManager which bring some problems.

  1. PodControlInterface/PodControllerRefManager may change along with k8s version upgrade, while we don't make changes to Service. It maybe out of sync.
  2. Half and half doesn't help us remove Kubernetes direct dependency.
  3. It’s not that straightforward for maintainers and contributors. The first time I look at the change, I notice we only have service_ref_manager which is kind of unclear until I find Remove the podControl and serviceControl interfaces #36

Solution

Consider the situation that Kubernetes upstream doesn't have implementation of ServiceControlInterface and ServiceControllerRefManager, I would suggest we just folk PodControlInterface and PodControllerRefManager locally.

This help remove dependency a lot and we can also make sure pods/service implementation can be updated at the same time.

In addition, I will make some efforts to this issue. kubernetes/client-go#332. I will try to submit a PR and see feedbacks. If change can be accepted, then we don't need to maintain these auxiliary codes on our side.

/cc @gaocegege @terrytangyuan

Need @gaocegege 's review on code folk since he originally worked on this.

Kubernetes pkg/controller/controller_utils.go doesn’t have this logic. This is from kubeflow/training-operator/pull/998. I think it’s safe to keep the logic here.
Use `KeyFunc` instead of k8s.io/kubernetes/pkg/controller.KeyFunc
Current implementation use PodControllerRefManager from `k8s.io/kubernetes/pkg/controller` and self-implemented `ServiceControllerRefManager` which brings some problems.

1. Pod impl may change along with k8s upgrade, service impl doesn’t
2. It’s not helping us remove Kubernetes direct dependency.
3. It’s not that straighforward for maintainers and contributors.

This change make sure we folk everything we need and remove ref_manager dependency.
Since this file contains both BaseControllerRefManager, PodControllerRefManager and ServiceControllerRefManager. It makes sense to rename it to controller_ref_manager.go
@kubeflow-bot
Copy link

This change is Reviewable

@@ -0,0 +1,377 @@
// Copyright 2019 The Kubeflow Authors
Copy link
Member Author

Choose a reason for hiding this comment

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

If we think it's fine to sync pod_ref_manager, it makes sense to rename to controller_ref_manager.go.

@Jeffwan
Copy link
Member Author

Jeffwan commented Apr 17, 2020

@gaocegege Address the feedbacks, please have another look

Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

LGTM but could you add some notes in the forked code so we can always look back what we did and where the code was forked from (with version/link).

@gaocegege
Copy link
Member

LGTM but could you add some notes in the forked code so we can always look back what we did and where the code was forked from (with version/link).

+1 for this suggestion.

@gaocegege
Copy link
Member

/lgtm

@Jeffwan
Copy link
Member Author

Jeffwan commented Apr 20, 2020

@gaocegege @terrytangyuan

Thanks for the review. That's great suggestion. I will file a follow up PR to add a CONTRIBUTING.md doc and include these technical details.

@gaocegege
Copy link
Member

OK, then I think we can merge this one.

@terrytangyuan
Copy link
Member

/approve

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: terrytangyuan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 5f6f32b into kubeflow:master Apr 20, 2020
@Jeffwan Jeffwan deleted the pod_control_interface branch April 20, 2020 03:29
@Jeffwan Jeffwan mentioned this pull request Apr 30, 2020
georgkaleido pushed a commit to georgkaleido/common that referenced this pull request Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants