-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Facilitate API orchestration #34363
Comments
cc: @mfojtik |
Better Ansible integration (and other config mgmt) is a part of this. Supporting apply as well as things like create * safety and versionably is important for solving hard problems. I have some proposals pending for this. I think the hooks and perm failed deployments and custom strategies proposals made me start thinking we're missing a DeploymentJob object - a Job that runs to completion and can be declaratively tracked. Essentially a level driven Job that can be updated directly. Custom strategies could also leverage a job template and manage the job themselves. Ultimately there is probably a separation between declarative state and level driven config workflows - the goal I think should be to have the necessary flexibility to declare workflows that allow people to walk away from a cluster and have it keep ticking over with security updates and key rotation as well as periodic development workflows in tools like Jenkins. |
cc: @soltysh you were asking for this I think |
I like the idea of a Job driving the custom deployment. |
@soltysh with the custom deployment strategy controller you can facilitate jobs or any other resources. |
From a Google SRE's perspective, what Kubernetes most clearly lacks is the concept of an operation. An operation must support the following functions:
Deployment is by far not the only API object that needs operation support. For example, services and ingresses need operations that block until they have acquired IP addresses. For us, the lack of API support for operations is the single most significant shortcoming of Kubernetes, because it makes any management of K8s unreliable. |
@steve-wolter deployments currently have perma-failed and conditions that reports the progress of the rollout operation. |
s/perma-failed/progressDeadlineSeconds/ |
@steve-wolter It seems that the spec/status model supports what you want when creating resources: user creates the object (filling in the spec) and then polls or watches the object's status indicating progress of the "operation." For example, create a ReplicaSet, and then watch the status to see how many replicas have been created so far. Updates are a little less obvious since the modification is done to the spec in-place (as opposed to creating a separate "request to update object X" object), but Deployment does track this stuff under the covers, which is what allows for example this part of the flow (copied from the documentation): $ kubectl rollout status deployment/nginx-deployment
Waiting for rollout to finish: 2 out of 3 new replicas have been updated...
deployment nginx-deployment successfully rolled out |
There are two problems with the approach you're suggesting:
I know that kubectl has all kinds of code for validating inputs, tracking progress and checking status. However, the long-term goal for Google is to run Kubernetes as cattle infrastructure. In the cloud, we want to run thousands of services with a single SRE team, and if this is to succeed, we can't keep caring about individual clusters and shell scripts that launch kubectl and grep its output. Kubernetes should be offering a good API. |
@steve-wolter Sorry for slow response. I think "Kubernetes lacks the concept of an operation" is correct. The system does not expose operation-level constructs because the system does not really have operation level constructs. (trivia: we had "operations" in apiserver at one point, but removed them!) Due to the declarative nature of the API, "operation" isn't really a thing that actually makes sense. I think there are several concepts that we could actually present, but unfortunately they wouldn't provide the semantics that you really want.
The problem with treating 1 as an operation is that it's not very useful, it doesn't tell you much about the state of the cluster (as opposed to the configuration of the cluster). The problem with treating 2 as an operation is that it's a control loop. That is, reality and desired state will usually stay together but it is a dynamic process and just because they match at T=1 doesn't necessarily mean they will match at T=2 (think dynamically scaled replica counts). The first thing that comes to my mind that could actually be helpful, is to make a concrete list of things you want to know, and maybe we can see if some API pattern can be used to simply represent all of these questions. Like, maybe we could use conditions (IP_ASSIGNMENT: ASSIGNED) to let you see the bits that you need to make decisions based on. I don't think we can really make a "I'm all done!" flag, because e.g. before taking the next step, sometimes you just care that the service has an IP assigned, and sometimes you also want it to have functioning endpoints. TL;DR: there is an impedance mismatch between operations (imperative API) and Kubernetes's declarative API. Some form of adaptor is going to be necessary. It's not possible to look at spec and status and say "ready" or "not ready" because "ready" means different things to different people. |
(Note: @lavalamp and I will take this discussion into a VC after Thanksgiving to gain mutual understanding.) |
It occurred to me that observedGeneration is vaguely related, if you think of each generation as a request/operation. |
This has already manifested in 20 or 30 places in Kubernetes with adhoc As Dan notes the pattern of "intent" and "intent realized" is imperfectly ObservedGeneration is good, but doesn't actually address the real problem The Scale resource has been discussed as one possible example of providing Cataloging the list of active wait conditions in use today would be a good We've spent a lot of time building smart client logic to implement these On Nov 19, 2016, at 10:06 PM, David Oppenheimer notifications@github.com It occurred to me that observedGeneration is vaguely related, if you think — |
@davidopp @smarterclayton observedGeneration is intended as a way for an observer to determine how up to date the status reported by the primary controller for the resource is. No more, no less. That needs to be combined with the usual resourceVersion-based optimistic concurrency mechanism to ensure that controllers don't act upon stale data, and with leader-election sequence numbers in the case of HA (#22007). As @lavalamp pointed out, the K8s API is optimized for continuous, single-purpose, choreography-style control loops rather than discrete, generic, workflow-style orchestrators, hence this issue. @steve-wolter Any solution we develop needs to maintain several properties of the current API:
|
Example of an orchestrator: https://github.com/Mirantis/k8s-AppController |
My point on observedGeneration was that something like "activeGeneration"
or "realizedGeneration" is something that most controllers actually know,
but users have to create their own logic. In a sense - a deployment being
"at" a certain state is the level driven behavior that clients are
attempting to achieve. observedGeneration is useful, but not sufficient.
…On Mon, Nov 28, 2016 at 1:10 PM, Brian Grant ***@***.***> wrote:
Example of an orchestrator: https://github.com/Mirantis/k8s-AppController
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#34363 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p2lg1vsdCxI_yE-CeKsWcspDIgOCks5rCxkmgaJpZM4KRgl7>
.
|
And another one: https://github.com/atlassian/smith |
Note: saw stackoverflow user asking how to wait for a job to be done. This has come up several times. |
Closing as per discussion in #25067 (comment) |
@Kargakis I actually want this one open. It's about a general API use case (clients that can't deal with eventual consistency) rather than for deployment specifically. |
Example from our e2e tests: |
@bgrant0607 isn't this case covered already by #1899? |
I wrote something on determining success/failure (which is a subset of this issue) here: |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
/lifecycle frozen |
/remove-lifecycle stale |
Currently, building a general-purpose orchestrator for our API is more challenging than it should be.
Some problems (probably not exhaustive):
See also:
#29453
#1899
#5164
kubernetes/website#41954
#4630
#15203
#29891
#14961
#14181
#1503
#32157
#38216
cc @lavalamp @pwittrock @smarterclayton
The text was updated successfully, but these errors were encountered: