Skip to content

Commit

Permalink
Switch to minimal embedded-status
Browse files Browse the repository at this point in the history
This commit changes the default of embedded-status to minimal status.

Prior to this PR, the `DefaultEmbeddedStatus` is `full`, the pipelineRun reconciler
will populate both `taskruns` and `runs` for `pipelineRunStatus`. With the change
to `minimal`, the reconciler populates `childReferences` instead.
  • Loading branch information
JeromeJu committed Jan 19, 2023
1 parent 30b5e96 commit 7501be5
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 117 deletions.
2 changes: 1 addition & 1 deletion config/config-feature-flags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ data:
# `PipelineRun` status. Set it to "minimal" to populate the `ChildReferences` field in the
# `PipelineRun` status with name, kind, and API version information for each `TaskRun` and
# `Run` in the `PipelineRun` instead. Set it to "both" to do both.
embedded-status: "full"
embedded-status: "minimal"
# Setting this flag will determine the version for custom tasks created by PipelineRuns.
# Acceptable values are "v1beta1" and "v1alpha1".
# The default is "v1beta1".
Expand Down
11 changes: 6 additions & 5 deletions docs/pipelineruns.md
Original file line number Diff line number Diff line change
Expand Up @@ -1392,17 +1392,18 @@ Your `PipelineRun`'s `status` field can contain the following fields:

### Configuring usage of `TaskRun` and `Run` embedded statuses

Currently, the default behavior is for the statuses of `TaskRun`s and `Run`s within this `PipelineRun`
to be embedded in the `status.taskRuns` and `status.runs` fields. This will change in the future to
instead default to `status.childReferences` being populated with references to the `TaskRun`s and
Currently, the default behavior is default to `status.childReferences` being populated with references to the `TaskRun`s and
`Run`s, which can be used to look up their statuses.

This behavior can be controlled by changing the `embedded-status` feature flag in the `feature-flags`
config map. See [`install.md`](./install.md#customizing-the-pipelines-controller-behavior) for more
information on feature flags. The possible values for `embedded-status` are:
- `full` - The current default behavior of populating `status.taskRuns` and `status.runs`, without populating `status.childReferences`.
- `minimal` - Just populate `status.childReferences`, not `status.taskRuns` or `status.runs`.
- `minimal` - The current default behavior, populate `status.childReferences`, not `status.taskRuns` or `status.runs`.
- `both` - Populate `status.childReferences` as well as `status.taskRuns` and `status.runs`.
- `full` - Populating `status.taskRuns` and `status.runs`, without populating `status.childReferences`.

*Note that after the PipelineRunStatus migration as planned in [TEP-100](https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md),
the `full` and `both` `embedded-status` options will be removed.

### Monitoring execution status

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/config/feature_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const (
// DefaultSendCloudEventsForRuns is the default value for "send-cloudevents-for-runs".
DefaultSendCloudEventsForRuns = false
// DefaultEmbeddedStatus is the default value for "embedded-status".
DefaultEmbeddedStatus = FullEmbeddedStatus
DefaultEmbeddedStatus = MinimalEmbeddedStatus
// DefaultEnableSpire is the default value for "enable-spire".
DefaultEnableSpire = false
// DefaultResourceVerificationMode is the default value for "resource-verification-mode".
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/config/feature_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) {
{
expectedConfig: &config.FeatureFlags{
EnableAPIFields: "stable",
EmbeddedStatus: "full",
EmbeddedStatus: config.DefaultEmbeddedStatus,
EnableSpire: true,
ResourceVerificationMode: config.DefaultResourceVerificationMode,
RunningInEnvWithInjectedSidecars: config.DefaultRunningInEnvWithInjectedSidecars,
Expand All @@ -152,7 +152,7 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) {
{
expectedConfig: &config.FeatureFlags{
EnableAPIFields: "stable",
EmbeddedStatus: "full",
EmbeddedStatus: config.DefaultEmbeddedStatus,
ResourceVerificationMode: config.DefaultResourceVerificationMode,
RunningInEnvWithInjectedSidecars: config.DefaultRunningInEnvWithInjectedSidecars,
AwaitSidecarReadiness: config.DefaultAwaitSidecarReadiness,
Expand Down
46 changes: 23 additions & 23 deletions pkg/reconciler/pipelinerun/cancel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ func TestCancelPipelineRun(t *testing.T) {
customRuns []*v1beta1.CustomRun
wantErr bool
}{{
name: "no-resolved-taskrun",
embeddedStatus: config.DefaultEmbeddedStatus,
name: "no-resolved-taskrun-with-full",
embeddedStatus: config.FullEmbeddedStatus,
pipelineRun: &v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{Name: "test-pipeline-run-cancelled"},
Spec: v1beta1.PipelineRunSpec{
Status: v1beta1.PipelineRunSpecStatusCancelled,
},
},
}, {
name: "one-taskrun",
embeddedStatus: config.DefaultEmbeddedStatus,
name: "one-taskrun-with-full",
embeddedStatus: config.FullEmbeddedStatus,
pipelineRun: &v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{Name: "test-pipeline-run-cancelled"},
Spec: v1beta1.PipelineRunSpec{
Expand All @@ -72,8 +72,8 @@ func TestCancelPipelineRun(t *testing.T) {
{ObjectMeta: metav1.ObjectMeta{Name: "t1"}},
},
}, {
name: "multiple-taskruns-one-missing",
embeddedStatus: config.DefaultEmbeddedStatus,
name: "multiple-taskruns-one-missing-with-full",
embeddedStatus: config.FullEmbeddedStatus,
pipelineRun: &v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{Name: "test-pipeline-run-cancelled"},
Spec: v1beta1.PipelineRunSpec{
Expand All @@ -90,8 +90,8 @@ func TestCancelPipelineRun(t *testing.T) {
{ObjectMeta: metav1.ObjectMeta{Name: "t2"}},
},
}, {
name: "multiple-taskruns",
embeddedStatus: config.DefaultEmbeddedStatus,
name: "multiple-taskruns-with-full",
embeddedStatus: config.FullEmbeddedStatus,
pipelineRun: &v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{Name: "test-pipeline-run-cancelled"},
Spec: v1beta1.PipelineRunSpec{
Expand All @@ -109,8 +109,8 @@ func TestCancelPipelineRun(t *testing.T) {
{ObjectMeta: metav1.ObjectMeta{Name: "t2"}},
},
}, {
name: "multiple-runs",
embeddedStatus: config.DefaultEmbeddedStatus,
name: "multiple-runs-with-full",
embeddedStatus: config.FullEmbeddedStatus,
pipelineRun: &v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{Name: "test-pipeline-run-cancelled"},
Spec: v1beta1.PipelineRunSpec{
Expand All @@ -128,8 +128,8 @@ func TestCancelPipelineRun(t *testing.T) {
{ObjectMeta: metav1.ObjectMeta{Name: "t2"}},
},
}, {
name: "multiple-runs-one-missing",
embeddedStatus: config.DefaultEmbeddedStatus,
name: "multiple-runs-one-missing-with-full",
embeddedStatus: config.FullEmbeddedStatus,
pipelineRun: &v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{Name: "test-pipeline-run-cancelled"},
Spec: v1beta1.PipelineRunSpec{
Expand Down Expand Up @@ -227,7 +227,7 @@ func TestCancelPipelineRun(t *testing.T) {
},
}, {
name: "child-references-with-minimal",
embeddedStatus: config.MinimalEmbeddedStatus,
embeddedStatus: config.DefaultEmbeddedStatus,
pipelineRun: &v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{Name: "test-pipeline-run-cancelled"},
Spec: v1beta1.PipelineRunSpec{
Expand Down Expand Up @@ -268,7 +268,7 @@ func TestCancelPipelineRun(t *testing.T) {
},
}, {
name: "child-references-with-minimal-some-missing",
embeddedStatus: config.MinimalEmbeddedStatus,
embeddedStatus: config.DefaultEmbeddedStatus,
pipelineRun: &v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{Name: "test-pipeline-run-cancelled"},
Spec: v1beta1.PipelineRunSpec{
Expand Down Expand Up @@ -458,8 +458,8 @@ func TestGetChildObjectsFromPRStatusForTaskNames(t *testing.T) {
hasError bool
}{
{
name: "single taskrun, default embedded",
embeddedStatus: config.DefaultEmbeddedStatus,
name: "single taskrun, full embedded",
embeddedStatus: config.FullEmbeddedStatus,
prStatus: v1beta1.PipelineRunStatus{PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{
TaskRuns: map[string]*v1beta1.PipelineRunTaskRunStatus{
"t1": {PipelineTaskName: "task-1"},
Expand All @@ -470,8 +470,8 @@ func TestGetChildObjectsFromPRStatusForTaskNames(t *testing.T) {
expectedCustomRunNames: nil,
hasError: false,
}, {
name: "single run, default embedded",
embeddedStatus: config.DefaultEmbeddedStatus,
name: "single run, full embedded",
embeddedStatus: config.FullEmbeddedStatus,
prStatus: v1beta1.PipelineRunStatus{PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{
Runs: map[string]*v1beta1.PipelineRunRunStatus{
"r1": {PipelineTaskName: "run-1"},
Expand All @@ -481,8 +481,8 @@ func TestGetChildObjectsFromPRStatusForTaskNames(t *testing.T) {
expectedCustomRunNames: []string{"r1"},
hasError: false,
}, {
name: "taskrun and run, default embedded",
embeddedStatus: config.DefaultEmbeddedStatus,
name: "taskrun and run, full embedded",
embeddedStatus: config.FullEmbeddedStatus,
prStatus: v1beta1.PipelineRunStatus{PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{
TaskRuns: map[string]*v1beta1.PipelineRunTaskRunStatus{
"t1": {PipelineTaskName: "task-1"},
Expand All @@ -495,8 +495,8 @@ func TestGetChildObjectsFromPRStatusForTaskNames(t *testing.T) {
expectedCustomRunNames: []string{"r1"},
hasError: false,
}, {
name: "taskrun and run, default embedded, just want taskrun",
embeddedStatus: config.DefaultEmbeddedStatus,
name: "taskrun and run, full embedded, just want taskrun",
embeddedStatus: config.FullEmbeddedStatus,
prStatus: v1beta1.PipelineRunStatus{PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{
TaskRuns: map[string]*v1beta1.PipelineRunTaskRunStatus{
"t1": {PipelineTaskName: "task-1"},
Expand Down Expand Up @@ -548,7 +548,7 @@ func TestGetChildObjectsFromPRStatusForTaskNames(t *testing.T) {
expectedRunNames: []string{"r1"},
hasError: false,
}, {
name: "minimal embedded",
name: "default minimal embedded",
embeddedStatus: config.MinimalEmbeddedStatus,
prStatus: v1beta1.PipelineRunStatus{PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{
TaskRuns: map[string]*v1beta1.PipelineRunTaskRunStatus{
Expand Down
Loading

0 comments on commit 7501be5

Please sign in to comment.