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

Document status of Job readiness check #723

Merged
merged 1 commit into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 25 additions & 18 deletions pkg/gen/awaitComments.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ func timeoutComment(kind kinds.Kind) string {
This approach will be deprecated in favor of customTimeouts. See
https://github.com/pulumi/pulumi-kubernetes/issues/672 for details.`

timeout := func(kind kinds.Kind) int {
switch kind {
case kinds.Deployment:
return await.DefaultDeploymentTimeoutMins
case kinds.Ingress:
return await.DefaultIngressTimeoutMins
case kinds.Pod:
return await.DefaultPodTimeoutMins
case kinds.Service:
return await.DefaultServiceTimeoutMins
case kinds.StatefulSet:
return await.DefaultStatefulSetTimeoutMins
default:
panic("unhandled kind: timeoutValues")
}
var v int
switch kind {
case kinds.Deployment:
v = await.DefaultDeploymentTimeoutMins
case kinds.Ingress:
v = await.DefaultIngressTimeoutMins
case kinds.Pod:
v = await.DefaultPodTimeoutMins
case kinds.Service:
v = await.DefaultServiceTimeoutMins
case kinds.StatefulSet:
v = await.DefaultStatefulSetTimeoutMins
default:
// No timeout defined for other resource Kinds.
return ""
}
timeoutStr := strconv.Itoa(timeout(kind)) + " minutes"
timeoutStr := strconv.Itoa(v) + " minutes"

return fmt.Sprintf(`
If the %s has not reached a Ready state after %s, it will
Expand Down Expand Up @@ -80,6 +80,13 @@ succeeded or failed:`
2. Endpoint objects exist with matching names for each Ingress path (except when Service
type is ExternalName).
3. Ingress entry exists for '.status.loadBalancer.ingress'.
`
case kinds.Job:
comment = `This resource currently does not wait until it is ready before registering
success for create/update and populating output properties from the current
state of the resource. Work to add readiness checks is in progress [1].

[1] https://github.com/pulumi/pulumi-kubernetes/pull/633
`
case kinds.Pod:
comment += `
Expand Down Expand Up @@ -107,7 +114,7 @@ Or (for Jobs): The Pod succeeded ('.status.phase' set to "Succeeded").
2. The value of '.status.updateRevision' matches '.status.currentRevision'.
`
default:
panic("unhandled kind: timeoutValues")
panic("comments: unhandled kind")
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure we want to panic here? It seems like an error is a better approach.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's just the generator code that runs at build time, so panic is fine here.

}

comment += timeoutComment(kind)
Expand All @@ -119,7 +126,7 @@ func AwaitComment(kind string) string {

k := kinds.Kind(kind)
switch k {
case kinds.Deployment, kinds.Ingress, kinds.Pod, kinds.Service, kinds.StatefulSet:
case kinds.Deployment, kinds.Ingress, kinds.Job, kinds.Pod, kinds.Service, kinds.StatefulSet:
return prefix + comments(k)
default:
return ""
Expand Down
7 changes: 7 additions & 0 deletions sdk/nodejs/batch/v1/Job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import { getVersion } from "../../version";

/**
* Job represents the configuration of a single job.
*
* This resource currently does not wait until it is ready before registering
* success for create/update and populating output properties from the current
* state of the resource. Work to add readiness checks is in progress [1].
*
* [1] https://github.com/pulumi/pulumi-kubernetes/pull/633
*
*/
export class Job extends pulumi.CustomResource {
/**
Expand Down
7 changes: 7 additions & 0 deletions sdk/python/pulumi_kubernetes/batch/v1/Job.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
class Job(pulumi.CustomResource):
"""
Job represents the configuration of a single job.

This resource currently does not wait until it is ready before registering
success for create/update and populating output properties from the current
state of the resource. Work to add readiness checks is in progress [1].

[1] https://github.com/pulumi/pulumi-kubernetes/pull/633

"""

def __init__(self, resource_name, opts=None, metadata=None, spec=None, status=None, __name__=None, __opts__=None):
Expand Down