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

Runnable Status is Ready even when stamped object has never been successful #486

Open
2 tasks
waciumawanjohi opened this issue Dec 15, 2021 · 6 comments
Open
2 tasks
Assignees
Labels
bug Something isn't working
Milestone

Comments

@waciumawanjohi
Copy link
Contributor

waciumawanjohi commented Dec 15, 2021

Bug description:

When a Runnable is submitted, it will not display output until the created object has a condition Ready with a status True. But while waiting for a healthy child object, the Runnable itself will still have a status Ready with status True.

Steps to reproduce:

Submit these objects:

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: super-service-account

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: super-role-binding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: super-role
subjects:
  - kind: ServiceAccount
    name: super-service-account

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: super-role
rules:
  - apiGroups: ["*"]
    resources: ["*"]
    verbs: ["*"]

---

apiVersion: carto.run/v1alpha1
kind: ClusterRunTemplate
metadata:
  name: cm
spec:
  outputs:
    val: data.val
  template:
    apiVersion: v1
    kind: ConfigMap
    metadata:
     generateName: cm-
    data:
      val: $(runnable.spec.inputs.some)$

---
apiVersion: carto.run/v1alpha1
kind: Runnable
metadata:
  name: cm
spec:
  serviceAccountName: super-service-account

  runTemplateRef:
    name: cm

  inputs:
    some: string

Expected behavior:

k get -o yaml runnable cm
returns a Runnable with condition Ready == False

Actual behavior:

k get -o yaml runnable cm
returns a Runnable with condition Ready == True

Additional context:

See branch runnable-status-bug for a test that exercises this.

TODO

  • fix the issue
  • document the status behavior
@martyspiewak
Copy link
Contributor

Just to +1 this, this causes some unexpected behavior at the workload level too if a supplychain is stamping out a runnable because the workload will report that it is Ready before the runnable tasks have run because the runnable itself is reporting that it is Ready.

@jwntrs jwntrs added this to the 0.4.0 milestone May 11, 2022
@jwntrs jwntrs added the bug Something isn't working label May 11, 2022
@jwntrs jwntrs moved this to Pre-IPM in Cartographer OSS May 11, 2022
@jwntrs
Copy link
Contributor

jwntrs commented May 11, 2022

Just to clarify, the desired behaviour for the Ready condition on Runnable would be as follows:
Ready: True -> Latest thing passed
Ready: False -> Latest thing failed
Ready: Unknown -> Something Running

@jwntrs jwntrs moved this from Pre-IPM to IPM in Cartographer OSS May 11, 2022
@jwntrs jwntrs moved this from IPM to Todo in Cartographer OSS May 13, 2022
@squeedee squeedee moved this from Todo to Doing in Cartographer OSS May 19, 2022
@squeedee squeedee self-assigned this May 19, 2022
@squeedee
Copy link
Member

squeedee commented May 24, 2022

Current state of the code:

  1. There is code for success checks, and it copies forward the latest "success=true" stamped object's outputs to Runnable's Outputs.
  2. Unfortunately, it also treats the absence of a success condition on the stamped object as "success=true". This much is clearly a bug
  3. The only code which causes our Runnable status Ready: False is if there are no outputs to copy forward - this is probably a bug as well.

Based on the current behavior, Outputs should be read as "LatestSuccessfulOutputs" -

@squeedee
Copy link
Member

squeedee commented May 24, 2022

We can absolutely implement @jwntrs spec, I'll use this policy:

  • Output is from the most recent StampedObject where:
    • Success exists
    • Success: True
    • All output paths from the runTemplate can be found
      • note: Update docs to explain that Outputs is "lastSuccessfulOutput" and that GC can eventually cause these to go away
  • Runnable Condition: StampedObjectReady(see open questions)
    • Unknown: StampedObject Success does not exist
    • False: stampedObjects Output path doesn't resolve (regardless of success/fail)
    • False when the stampedObject's Success==False
    • True when the stampedObject's Success==True (and output path resolves)

Open questions about Runnable Status:

  1. There is one second level status "RunTemplateReady" - this refers to the RunTemplate, not the StampedObject. Are we ok introducing a "StampedObject" status to reflect where we're drawing our current top level from?
  2. What's a satisfactory pattern for the top-level Ready status? perhaps:
    TemplateReady False: Ready False (always)
    TemplateReady True: Ready = StampedObject . (true/false/unkown)

@squeedee
Copy link
Member

Additional:

  • OutputPathNotSatisfiedCondition becomes a StampedObjectReady Condition
  • Yes we introduce StampedObjectReady
  • Yes that's a good top-level strategy. but implementing it in ConditionManager might change workload/deliverable behavior --- be careful

squeedee added a commit that referenced this issue Jun 16, 2022
Currently we assume it's a tekton TaskRun so we only
concern ourselves with the "Succeeded" condition

[finishes #486]

Co-authored-by: Sam Coward <scoward@vmware.com>
squeedee added a commit that referenced this issue Jun 16, 2022
Currently we assume it's a tekton TaskRun so we only
concern ourselves with the "Succeeded" condition

[finishes #486]

Co-authored-by: Sam Coward <scoward@vmware.com>
squeedee added a commit that referenced this issue Jun 16, 2022
Currently we assume it's a tekton TaskRun so we only
concern ourselves with the "Succeeded" condition

[finishes #486]

Co-authored-by: Sam Coward <scoward@vmware.com>
squeedee added a commit that referenced this issue Jun 23, 2022
…900)

* Introduce a status that tracks the runnable's stamped object

Currently we assume it's a tekton TaskRun so we only
concern ourselves with the "Succeeded" condition

[finishes #486]

Co-authored-by: Sam Coward <scoward@vmware.com>

* Pull "ExtractConditions" out as a utility

Co-authored-by: Sam Coward <scoward@vmware.com>
cirocosta pushed a commit that referenced this issue Jun 28, 2022
…900)

* Introduce a status that tracks the runnable's stamped object

Currently we assume it's a tekton TaskRun so we only
concern ourselves with the "Succeeded" condition

[finishes #486]

Co-authored-by: Sam Coward <scoward@vmware.com>

* Pull "ExtractConditions" out as a utility

Co-authored-by: Sam Coward <scoward@vmware.com>
@squeedee
Copy link
Member

Did #876 and #900 fix this? Check and resolve @squeedee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Doing
Development

When branches are created from issues, their pull requests are automatically linked.

4 participants