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

Implement External strategy for workload controllers #39337

Closed
0xmichalis opened this issue Jan 1, 2017 · 16 comments
Closed

Implement External strategy for workload controllers #39337

0xmichalis opened this issue Jan 1, 2017 · 16 comments
Labels
area/workload-api/daemonset area/workload-api/deployment sig/apps Categorizes an issue or PR as relevant to SIG Apps.

Comments

@0xmichalis
Copy link
Contributor

0xmichalis commented Jan 1, 2017

Using a External strategy in workload controllers is probably an acceptable way for users to specify which controllers they want to orchestrate externally via operators or any kind of external controller. Think of External as "the Kubernetes core will do nothing with a particular controller" or actually everything other than the orchestration part (status updates, overlap resolution, pod creation/deletion failure detection are some common actions across any kind of strategy and we should have those baked in the controller manager - already in for Deployments). DaemonSets and StatefulSets will need External to maintain backwards compatibility too.

@kubernetes/sig-apps-misc

@0xmichalis 0xmichalis added area/workload-api/daemonset area/workload-api/deployment sig/apps Categorizes an issue or PR as relevant to SIG Apps. labels Jan 1, 2017
@smarterclayton
Copy link
Contributor

This makes sense to me - what's the minimal possible solution? Can you pull together a proposal?

@hongchaodeng
Copy link
Contributor

@Kargakis
Can you clarify more what's Noop strategy? Any particular example?

@mfojtik
Copy link
Contributor

mfojtik commented Jan 1, 2017

@Kargakis makes sense to me. does it need to be a strategy, can't it be just an annotation to specify what manage the object? If the annotation is set, the workload controllers will ignore that objects.

@hongchaodeng for example, this will help to build "external" controllers to handle deployment process in a "custom" way.

@0xmichalis
Copy link
Contributor Author

0xmichalis commented Jan 2, 2017

@Kargakis makes sense to me. does it need to be a strategy, can't it be just an annotation to specify what manage the object? If the annotation is set, the workload controllers will ignore that objects.

I think the strategy type makes more sense since it's just the strategy code that we don't want to execute. We shouldn't require from authors of external controllers to implement updates to the status of the deployment or resolve overlapping selectors or do their own failure detection for core api failures since these things should be common across all types of deployments. Also the new type will be needed for DS / SS backwards-compatibilty once upgrades are supported for them.

@smarterclayton this is a simple addition in the deployment strategy types and a change in the deployment controller to ignore deployments with the new type, can't this issue serve as the proposal (not sure if I need to make a full-blown proposal for such a simple addition @bgrant0607 ?)

@0xmichalis
Copy link
Contributor Author

0xmichalis commented Jan 2, 2017

Opened #39352 to illustrate the changes needed for Deployments.

@davidopp
Copy link
Member

davidopp commented Jan 4, 2017

I'm wondering if the objective here can be factored into two parts for implementation:
(1) no-op strategy only for Deployment
(2) library for building controllers, that makes it easy for people to build new controllers by taking care of all the things you mentioned ("status updates, overlap resolution, pod creation/deletion failure detection").

Deployment is the only controller that has a "strategy" concept AFIAK.

@0xmichalis
Copy link
Contributor Author

@davidopp a library for building controllers would certainly be a nice thing, we have discussed it already with @mfojtik and we will most probably end up doing it for the Deployment controller, I am just not sure when.

Deployment is the only controller that has a strategy currently. In order to implement upgrades for DaemonSets and StatefulSets, we will end up adding a strategy field in those controllers too because 1. we need to maintain backwards compatibility (so the default strategy for them will be Noop and the additional strategy for the actual upgrade) and 2. we may end up supporting different types of strategies for DS/SS in the future apart from the initial one.

@smarterclayton
Copy link
Contributor

smarterclayton commented Jan 5, 2017 via email

@davidopp
Copy link
Member

davidopp commented Jan 5, 2017

I think there's a reasonable philosophical question of when the pattern you're using here (delegate some behavior of a controller to specialized external logic) is appropriate vs. telling people to write their own controller that contains the specialized logic plus the base logic of the controller. My suggestion about a library was trying to get at how to do this without a lot of code duplication. But probably this would be a bad use experience since it would lead to a proliferation of very similar controllers.

So never mind my comment.

@foxish
Copy link
Contributor

foxish commented Jan 5, 2017

If I understand correctly, this proposal is talking about top-level objects that simply update status and cannot directly control the underlying pods. So far, there was some discussion on implementing this sort of functionality in TPRs. For example, there is already a need to implement status reporting in TPRs such that kubernetes can interpret and monitor these resources, so as to gain visibility into externally managed pod-creating abstractions.

@0xmichalis
Copy link
Contributor Author

If I understand correctly, this proposal is talking about top-level objects that simply update status and cannot directly control the underlying pods. So far, there was some discussion on implementing this sort of functionality in TPRs. For example, there is already a need to implement status reporting in TPRs such that kubernetes can interpret and monitor these resources, so as to gain visibility into externally managed pod-creating abstractions.

I love the idea of TPR in general but I am not convinced about structuring it to fit the needs of a workload controller api-wise and I don't believe it will prevail our core controllers for running workloads in the future although I believe operators will be used for running many things. One thing worth considering is how easy it can be for a user to run custom logic by using TPRs vs an external Deployment. I still haven't got to build anything with TPRs yet but I would expect that I need to 1. know Go, 2. be familiar with the Kubernetes APIs, whereas I can provide a simple bash script with kubectl commands, feed it to a controller framework, and be done with it.

@foxish
Copy link
Contributor

foxish commented Jan 6, 2017

I would expect that I need to 1. know Go, 2. be familiar with the Kubernetes APIs, whereas I can provide a simple bash script with kubectl commands, feed it to a controller framework, and be done with it.

The plan with TPRs is to allow kubectl to interact with them approximately the same way as any first class kubernetes object, letting TPRs "implement" common patterns like scale and status. I think it wouldn't be a big leap to allow a TPR to implement a 'workload controller' pattern that lets a given object watch and report changes to pods that it manages. Even if we don't use TPRs for this, it seems like it should be a completely separate entity from existing workload controllers for the following reasons:

  • The type of "status" that we get from deployments may not be sufficient for all applications, especially as we build higher level objects. For example, in case of a SparkJob, it contains several "types" of pods which it manages, drivers and executors and aggregating them into one single notion of "available/desired pods" when reporting status does not make much sense.
  • Traditional and external deployments under this model would be fundamentally different in nature: we're overloading the update strategy to change the basic behavior (orchestration), at that point, I think we might as well make a separate ExternalController type.
  • The same no-op strategy in other controllers (StatefulSet for example), wouldn't provide anything over that in Deployments as far as I can tell, unless I misunderstand the proposal somehow.

@0xmichalis
Copy link
Contributor Author

0xmichalis commented Jan 7, 2017 via email

@0xmichalis
Copy link
Contributor Author

Related issue: #31571

@0xmichalis 0xmichalis changed the title Implement Noop strategy for workload controllers Implement External strategy for workload controllers Jan 9, 2017
@0xmichalis 0xmichalis removed their assignment Jan 9, 2017
@bgrant0607
Copy link
Member

I believe this to be a dupe, or special case, of #31571.

Let's keep the TPR-related discussion in #38113.

@0xmichalis
Copy link
Contributor Author

#31571 is more of an umbrella issue. Closing as a dupe of #14510

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/workload-api/daemonset area/workload-api/deployment sig/apps Categorizes an issue or PR as relevant to SIG Apps.
Projects
None yet
Development

No branches or pull requests

7 participants