-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
TEP-0142: Introduce StepResults in Steps, StepActions #7382
TEP-0142: Introduce StepResults in Steps, StepActions #7382
Conversation
/test check-pr-has-kind-label |
@chitrangpatel: The specified target(s) for
The following commands are available to trigger optional jobs:
Use In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
85df806
to
9fb20a4
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/retest |
/kind feature |
9fb20a4
to
75ddccd
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
75ddccd
to
6d86b30
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
} else { | ||
if len(s.Params) > 0 { | ||
errs = errs.Also(&apis.FieldError{ | ||
Message: "params cannot be used without Ref", | ||
Paths: []string{"params"}, | ||
}) | ||
} | ||
if len(s.Results) > 0 { | ||
if !config.FromContextOrDefaults(ctx).FeatureFlags.EnableStepActions { | ||
return apis.ErrGeneric("feature flag %s should be set to true in order to use Results in Steps.", config.EnableStepActions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only want to fail if it's a Create, or an Update where the field was originally empty. Otherwise you can cause an object to get stuck because reconcilers can't update the object to remove finalizers if the flag gets disabled mid-execution.
Knative has some helper funcs here to help you extract this data - i.e. https://pkg.go.dev/knative.dev/[email protected]/apis#GetBaseline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the original field can be non-empty.
i.e. if Users choose to use results for inlined steps.
They just need to enable-step-actions for this, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. I made use of IsInCreate
and IsInUpdate
for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The controller context has these both set to false
. But for web hook events, these are set appropriately. This means that during web hook validation, we can enforce this. In the controller logic, this does not really need to be validated since it made it past the web hook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly sgtm, but apis.IsInUpdate(ctx)
isn't sufficient, since it would still reject updates to unrelated fields / finalizers if the flag was disabled. :(
We also need to check if the field we want to check has changed - you can grab the old object via GetBaseline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I implemented the fix. If an update event, we compare with the baseline and check if the step results
have diverged. Only then we check if the feature flag is enabled.
6d86b30
to
06d4709
Compare
2f3843a
to
13f391d
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/hold cancel |
13f391d
to
485ff46
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
485ff46
to
6499d9b
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jerop, Yongxuanzhang 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 |
This PR introduces `StepResults` in Steps.
6499d9b
to
00ac630
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
This PR introduces
StepResult
in Steps. This will allow us to holdStepAction's
result declarations and use it later for replacements and other logic that happens later down the chain. It will be populated by the controller when it fetches StepActions in a followup PR.Mostly this is auto-generated and refactored code.
Changes
Refactoring:
StepActionResults
.StepResults
inStep
has the same struct, I moved all the supporting code fromv1alpha1/
tov1/
instead of duplicating it multiple times.Result: []v1.StepResult
.Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes
/kind feature