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

cleanup: [TEP-0135] remove deprecated disable-affinity-assistant feature flag #8603

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 0 additions & 8 deletions config/300-crds/300-pipelinerun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2565,8 +2565,6 @@ spec:
type: boolean
coschedule:
type: string
disableAffinityAssistant:
type: boolean
disableCredsInit:
type: boolean
disableInlineSpec:
Expand Down Expand Up @@ -2979,8 +2977,6 @@ spec:
type: boolean
coschedule:
type: string
disableAffinityAssistant:
type: boolean
disableCredsInit:
type: boolean
disableInlineSpec:
Expand Down Expand Up @@ -3267,8 +3263,6 @@ spec:
type: boolean
coschedule:
type: string
disableAffinityAssistant:
type: boolean
disableCredsInit:
type: boolean
disableInlineSpec:
Expand Down Expand Up @@ -5876,8 +5870,6 @@ spec:
type: boolean
coschedule:
type: string
disableAffinityAssistant:
type: boolean
disableCredsInit:
type: boolean
disableInlineSpec:
Expand Down
8 changes: 0 additions & 8 deletions config/300-crds/300-taskrun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1948,8 +1948,6 @@ spec:
type: boolean
coschedule:
type: string
disableAffinityAssistant:
type: boolean
disableCredsInit:
type: boolean
disableInlineSpec:
Expand Down Expand Up @@ -2236,8 +2234,6 @@ spec:
type: boolean
coschedule:
type: string
disableAffinityAssistant:
type: boolean
disableCredsInit:
type: boolean
disableInlineSpec:
Expand Down Expand Up @@ -4135,8 +4131,6 @@ spec:
type: boolean
coschedule:
type: string
disableAffinityAssistant:
type: boolean
disableCredsInit:
type: boolean
disableInlineSpec:
Expand Down Expand Up @@ -4389,8 +4383,6 @@ spec:
type: boolean
coschedule:
type: string
disableAffinityAssistant:
type: boolean
disableCredsInit:
type: boolean
disableInlineSpec:
Expand Down
11 changes: 0 additions & 11 deletions config/config-feature-flags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ metadata:
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-pipelines
data:
# Setting this flag to "true" will prevent Tekton to create an
# Affinity Assistant for every TaskRun sharing a PVC workspace
#
# The default behaviour is for Tekton to create Affinity Assistants
#
# See more in the Affinity Assistant documentation
# https://github.com/tektoncd/pipeline/blob/main/docs/affinityassistants.md
# or https://github.com/tektoncd/pipeline/pull/2630 for more info.
#
# Note: This feature flag is deprecated and will be removed in release v0.60. Consider using `coschedule` feature flag to configure Affinity Assistant behavior.
disable-affinity-assistant: "false"
Copy link
Member

Choose a reason for hiding this comment

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

# Setting this flag will determine how PipelineRun Pods are scheduled with Affinity Assistant.
# Acceptable values are "workspaces" (default), "pipelineruns", "isolate-pipelinerun", or "disabled".
#
Expand Down
15 changes: 0 additions & 15 deletions docs/additional-configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,21 +275,6 @@ that are running while the change occurs.

The flags in this ConfigMap are as follows:

- `disable-affinity-assistant` - set this flag to `true` to disable the [Affinity Assistant](./affinityassistants)
that is used to provide Node Affinity for `TaskRun` pods that share workspace volume.
The Affinity Assistant is incompatible with other affinity rules
configured for `TaskRun` pods.

**Note:** This feature flag is deprecated and will be removed in release `v0.60`. Consider using `coschedule` feature flag to configure Affinity Assistant behavior.

**Note:** Affinity Assistant use [Inter-pod affinity and anti-affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity)
that require substantial amount of processing which can slow down scheduling in large clusters
significantly. We do not recommend using them in clusters larger than several hundred nodes

**Note:** Pod anti-affinity requires nodes to be consistently labelled, in other words every
node in the cluster must have an appropriate label matching `topologyKey`. If some or all nodes
are missing the specified `topologyKey` label, it can lead to unintended behavior.

Copy link
Member

Choose a reason for hiding this comment

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

- `coschedule`: set this flag determines how PipelineRun Pods are scheduled with [Affinity Assistant](./affinityassistants).
Acceptable values are "workspaces" (default), "pipelineruns", "isolate-pipelinerun", or "disabled".
Setting it to "workspaces" will schedule all the taskruns sharing the same PVC-based workspace in a pipelinerun to the same node.
Expand Down
11 changes: 6 additions & 5 deletions docs/affinityassistants.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ weight: 405
-->

# Affinity Assistants

Affinity Assistant is a feature to coschedule `PipelineRun` `pods` to the same node
based on [kubernetes pod affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity) so that it possible for the taskruns to execute parallel while sharing volume.
Available Affinity Assistant Modes are **coschedule workspaces**, **coschedule pipelineruns**,
**isolate pipelinerun** and **disabled**.
**isolate pipelinerun** and **disabled**.

> :seedling: **coschedule pipelineruns** and **isolate pipelinerun** modes are [**alpha features**](./additional-configs.md#alpha-features).
> **coschedule workspaces** is a **stable feature**
Expand All @@ -27,10 +28,10 @@ and only one PipelineRun is allowed to run on a node at a time.
This means that Affinity Assistant is incompatible with other affinity rules
configured for the `TaskRun` pods (i.e. other affinity rules specified in custom [PodTemplate](pipelineruns.md#specifying-a-pod-template) will be overwritten by Affinity Assistant).
If the `PipelineRun` has a custom [PodTemplate](pipelineruns.md#specifying-a-pod-template) configured, the `NodeSelector` and `Tolerations` fields will also be set on the Affinity Assistant pod. The Affinity Assistant
is deleted when the `PipelineRun` is completed.
is deleted when the `PipelineRun` is completed.

Currently, the Affinity Assistant Modes can be configured by the `disable-affinity-assistant` and `coschedule` feature flags.
The `disable-affinity-assistant` feature flag is now deprecated and will be removed in release `v0.60`. At the time, the Affinity Assistant Modes will be only determined by the `coschedule` feature flag.
The Affinity Assistant Modes are configured by the `coschedule` feature flag.
Previously, it was also controlled by the `disable-affinity-assistant` feature flag which was deprecated and removed after release `v0.68`.
Copy link
Member

@waveywaves waveywaves Mar 4, 2025

Choose a reason for hiding this comment

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

nit: I believe this needs to go in a note as it's not directly useful while configuring the affinity assistant for user at the time of reading the docs for affinity assistant.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it okay to write like this in the notes?

Action Required: The feature flag `disable-affinity-assistant` has been removed. Please use `coschedule` as a replacement.
It was marked as deprecated in version v0.51 and has been completely removed in the current version.
If you need to maintain the previous default behavior, set feature flag `coschedule` to `disabled`.
For specific behavioral differences, please refer to: https://github.com/tektoncd/community/blob/main/teps/0135-coscheduling-pipelinerun-pods.md#tep-0135-coscheduling-pipelinerun-pods

Copy link
Member

Choose a reason for hiding this comment

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

that'll work 😸


The following chart summarizes the Affinity Assistant Modes with different combinations of the `disable-affinity-assistant` and `coschedule` feature flags during migration (when both feature flags are present) and after the migration (when only the `coschedule` flag is present).

Expand Down Expand Up @@ -95,7 +96,7 @@ The following chart summarizes the Affinity Assistant Modes with different combi
</tbody>
</table>

**Note:** For users who previously accepted the default behavior (`disable-affinity-assistant`: `false`) but now want one of the new features, you need to set `disable-affinity-assistant` to "true" and then turn on the new behavior by setting the `coschedule` flag. For users who previously disabled the affinity assistant but want one of the new features, just set the `coschedule` flag accordingly.
**Note:** After release `v0.68`, the `disable-affinity-assistant` feature flag is removed and the Affinity Assistant Modes are only controlled by the `coschedule` feature flag.

**Note:** Affinity Assistant use [Inter-pod affinity and anti-affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity)
that require substantial amount of processing which can slow down scheduling in large clusters
Expand Down
1 change: 0 additions & 1 deletion docs/artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ Upon resolution and execution of the `TaskRun`, the `Status` will look something
"featureFlags": {
"awaitSidecarReadiness": true,
"coschedule": "workspaces",
"disableAffinityAssistant": false,
"disableCredsInit": false,
"disableInlineSpec": "",
"enableAPIFields": "beta",
Expand Down
3 changes: 2 additions & 1 deletion docs/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ The following features are deprecated but have not yet been removed.
| [The `config-trusted-resources` configMap is deprecated](https://github.com/tektoncd/pipeline/issues/5852) | v0.45.0 | Alpha | v0.46.0 |
| [The `default-cloud-events-sink` setting in the `config-defaults` configMap is deprecated](https://github.com/tektoncd/pipeline/pull/6883) in favour of the new `config-events` configMap. | v0.50.0 | N/A | v0.59.0 |
| [v1beta1 Tasks, TaskRuns, Pipelines, and PipelineRuns are deprecated in favor of v1](https://github.com/tektoncd/pipeline/issues/5541) | v0.50.0 | Beta | v0.62.0 |
| [The `disable-affinity-assistant` feature flag is deprecated in favor of the `coschedule` feature flag](https://github.com/tektoncd/pipeline/issues/6988) | v0.51.0 | N/A | April 27, 2024 |
| The `resolver framework` is [deprecated](https://github.com/tektoncd/pipeline/pull/7945) in favor of an [upgraded framework](https://github.com/tektoncd/pipeline/pull/7910) | v0.60.0 | N/A | v0.72. |

### v1beta1 deprecation
Expand All @@ -46,6 +45,8 @@ The features listed below have been removed but may still be supported in releas
| [The `PipelineRun.Status.TaskRuns` and `PipelineRun.Status.Runs` fields and the `embedded-status` feature flag along with their functionalities have been tombstoned since v0.45.](https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md) | [[TEP100] Remove Taskruns and Runs Fields for PipelineRunStatus](https://github.com/tektoncd/pipeline/pull/6099) | Jan 25, 2023 | v0.44.0 | Jan 24, 2024 |
| PipelineResources are removed, along with the components of the API that rely on them as proposed in [TEP-0074](https://github.com/tektoncd/community/blob/main/teps/0074-deprecate-pipelineresources.md). See [Removed `PipelineResources` related features](#removed-pipelineresources-related-features) for more info. | [[TEP074] Remove Generic PipelineResources with Rest of Resources Types](https://github.com/tektoncd/pipeline/pull/6150) | Mar 8, 2023 | v0.44.0 | Jan 24, 2024 |
| v1alpha1 Runs are removed, as proposed in [TEP-0114](https://github.com/tektoncd/community/blob/main/teps/0114-custom-tasks-beta.md), along with the feature flags `enable-custom-task` and `custom-task-version`. | [TEP-0114: Remove support for v1alpha1.Run](https://github.com/tektoncd/pipeline/pull/6508) | April 7, 2023 | v0.44.0 | Jan 24, 2024 |
| [The `disable-affinity-assistant` feature flag is deprecated in favor of the `coschedule` feature flag](https://github.com/tektoncd/community/blob/main/teps/0135-coscheduling-pipelinerun-pods.md#tep-0135-coscheduling-pipelinerun-pods) | [cleanup: [TEP-0135] remove deprecated disable-affinity-assistant feature flag](https://github.com/tektoncd/pipeline/pull/8603) | Mar 1, 2025 | v0.68.0 | Jan 30, 2026 |
Copy link
Member

Choose a reason for hiding this comment

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

💯



### Removed PipelineResources related features:

Expand Down
19 changes: 2 additions & 17 deletions pkg/apis/config/feature_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ const (
ResultExtractionMethodTerminationMessage = "termination-message"
// ResultExtractionMethodSidecarLogs is the value used for "results-from" as a way to extract results from tasks using sidecar logs.
ResultExtractionMethodSidecarLogs = "sidecar-logs"
// DefaultDisableAffinityAssistant is the default value for "disable-affinity-assistant".
DefaultDisableAffinityAssistant = false
// DefaultDisableCredsInit is the default value for "disable-creds-init".
DefaultDisableCredsInit = false
// DefaultRunningInEnvWithInjectedSidecars is the default value for "running-in-environment-with-injected-sidecars".
Expand Down Expand Up @@ -119,7 +117,6 @@ const (
// in Taskrun or Pipelinerun
DisableInlineSpec = "disable-inline-spec"

disableAffinityAssistantKey = "disable-affinity-assistant"
disableCredsInitKey = "disable-creds-init"
runningInEnvWithInjectedSidecarsKey = "running-in-environment-with-injected-sidecars"
awaitSidecarReadinessKey = "await-sidecar-readiness"
Expand Down Expand Up @@ -188,12 +185,9 @@ var (
// FeatureFlags holds the features configurations
// +k8s:deepcopy-gen=true
type FeatureFlags struct {
DisableAffinityAssistant bool `json:"disableAffinityAssistant,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

👍

DisableCredsInit bool `json:"disableCredsInit,omitempty"`
RunningInEnvWithInjectedSidecars bool `json:"runningInEnvWithInjectedSidecars,omitempty"`
RequireGitSSHSecretKnownHosts bool `json:"requireGitSSHSecretKnownHosts,omitempty"`
// EnableTektonOCIBundles bool // Deprecated: this is now ignored
// ScopeWhenExpressionsToTask bool // Deprecated: this is now ignored

EnableAPIFields string `json:"enableAPIFields,omitempty"`
SendCloudEventsForRuns bool `json:"sendCloudEventsForRuns,omitempty"`
Expand Down Expand Up @@ -259,9 +253,6 @@ func NewFeatureFlagsFromMap(cfgMap map[string]string) (*FeatureFlags, error) {
}

tc := FeatureFlags{}
if err := setFeature(disableAffinityAssistantKey, DefaultDisableAffinityAssistant, &tc.DisableAffinityAssistant); err != nil {
return nil, err
}
if err := setFeature(disableCredsInitKey, DefaultDisableCredsInit, &tc.DisableCredsInit); err != nil {
return nil, err
}
Expand Down Expand Up @@ -304,7 +295,7 @@ func NewFeatureFlagsFromMap(cfgMap map[string]string) (*FeatureFlags, error) {
if err := setFeature(setSecurityContextReadOnlyRootFilesystemKey, DefaultSetSecurityContextReadOnlyRootFilesystem, &tc.SetSecurityContextReadOnlyRootFilesystem); err != nil {
return nil, err
}
if err := setCoschedule(cfgMap, DefaultCoschedule, tc.DisableAffinityAssistant, &tc.Coschedule); err != nil {
if err := setCoschedule(cfgMap, DefaultCoschedule, &tc.Coschedule); err != nil {
return nil, err
}
if err := setPerFeatureFlag(EnableCELInWhenExpression, DefaultEnableCELInWhenExpression, &tc.EnableCELInWhenExpression); err != nil {
Expand Down Expand Up @@ -350,20 +341,14 @@ func setEnabledAPIFields(cfgMap map[string]string, defaultValue string, feature
}

// setCoschedule sets the "coschedule" flag based on the content of a given map.
// If the feature gate is invalid or incompatible with `disable-affinity-assistant`, then an error is returned.
func setCoschedule(cfgMap map[string]string, defaultValue string, disabledAffinityAssistant bool, feature *string) error {
func setCoschedule(cfgMap map[string]string, defaultValue string, feature *string) error {
value := defaultValue
if cfg, ok := cfgMap[coscheduleKey]; ok {
value = strings.ToLower(cfg)
}

switch value {
case CoscheduleDisabled, CoscheduleWorkspaces, CoschedulePipelineRuns, CoscheduleIsolatePipelineRun:
// validate that "coschedule" is compatible with "disable-affinity-assistant"
// "coschedule" must be set to "workspaces" when "disable-affinity-assistant" is false
if !disabledAffinityAssistant && value != CoscheduleWorkspaces {
return fmt.Errorf("coschedule value %v is incompatible with %v setting to false", value, disableAffinityAssistantKey)
}
*feature = value
default:
return fmt.Errorf("invalid value for feature flag %q: %q", coscheduleKey, value)
Expand Down
Loading
Loading