Skip to content

Commit ec80a75

Browse files
committed
cleanup: [TEP-0135] remove deprecated disable-affinity-assistant feature flag
This field has been deprecated for about a year and half. So this is "removing" this feature flag from the codebase. The field is kept in the go code to provide a backward compatibility for client code (like chains, …) but it will be disallowed by the webhook. It will also be completely ignore by the rest of the code.
1 parent 8b8a098 commit ec80a75

18 files changed

+41
-176
lines changed

config/config-feature-flags.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@ metadata:
2121
app.kubernetes.io/instance: default
2222
app.kubernetes.io/part-of: tekton-pipelines
2323
data:
24-
# Setting this flag to "true" will prevent Tekton to create an
25-
# Affinity Assistant for every TaskRun sharing a PVC workspace
26-
#
27-
# The default behaviour is for Tekton to create Affinity Assistants
28-
#
29-
# See more in the Affinity Assistant documentation
30-
# https://github.com/tektoncd/pipeline/blob/main/docs/affinityassistants.md
31-
# or https://github.com/tektoncd/pipeline/pull/2630 for more info.
32-
#
33-
# Note: This feature flag is deprecated and will be removed in release v0.60. Consider using `coschedule` feature flag to configure Affinity Assistant behavior.
34-
disable-affinity-assistant: "false"
3524
# Setting this flag will determine how PipelineRun Pods are scheduled with Affinity Assistant.
3625
# Acceptable values are "workspaces" (default), "pipelineruns", "isolate-pipelinerun", or "disabled".
3726
#

docs/additional-configs.md

-15
Original file line numberDiff line numberDiff line change
@@ -275,21 +275,6 @@ that are running while the change occurs.
275275

276276
The flags in this ConfigMap are as follows:
277277

278-
- `disable-affinity-assistant` - set this flag to `true` to disable the [Affinity Assistant](./affinityassistants)
279-
that is used to provide Node Affinity for `TaskRun` pods that share workspace volume.
280-
The Affinity Assistant is incompatible with other affinity rules
281-
configured for `TaskRun` pods.
282-
283-
**Note:** This feature flag is deprecated and will be removed in release `v0.60`. Consider using `coschedule` feature flag to configure Affinity Assistant behavior.
284-
285-
**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)
286-
that require substantial amount of processing which can slow down scheduling in large clusters
287-
significantly. We do not recommend using them in clusters larger than several hundred nodes
288-
289-
**Note:** Pod anti-affinity requires nodes to be consistently labelled, in other words every
290-
node in the cluster must have an appropriate label matching `topologyKey`. If some or all nodes
291-
are missing the specified `topologyKey` label, it can lead to unintended behavior.
292-
293278
- `coschedule`: set this flag determines how PipelineRun Pods are scheduled with [Affinity Assistant](./affinityassistants).
294279
Acceptable values are "workspaces" (default), "pipelineruns", "isolate-pipelinerun", or "disabled".
295280
Setting it to "workspaces" will schedule all the taskruns sharing the same PVC-based workspace in a pipelinerun to the same node.

docs/affinityassistants.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ weight: 405
66
-->
77

88
# Affinity Assistants
9+
910
Affinity Assistant is a feature to coschedule `PipelineRun` `pods` to the same node
1011
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.
1112
Available Affinity Assistant Modes are **coschedule workspaces**, **coschedule pipelineruns**,
12-
**isolate pipelinerun** and **disabled**.
13+
**isolate pipelinerun** and **disabled**.
1314

1415
> :seedling: **coschedule pipelineruns** and **isolate pipelinerun** modes are [**alpha features**](./additional-configs.md#alpha-features).
1516
> **coschedule workspaces** is a **stable feature**
@@ -27,10 +28,10 @@ and only one PipelineRun is allowed to run on a node at a time.
2728
This means that Affinity Assistant is incompatible with other affinity rules
2829
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).
2930
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
30-
is deleted when the `PipelineRun` is completed.
31+
is deleted when the `PipelineRun` is completed.
3132

32-
Currently, the Affinity Assistant Modes can be configured by the `disable-affinity-assistant` and `coschedule` feature flags.
33-
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.
33+
The Affinity Assistant Modes are configured by the `coschedule` feature flag.
34+
Previously, it was also controlled by the `disable-affinity-assistant` feature flag which was deprecated and removed after release `v0.68`.
3435

3536
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).
3637

@@ -95,7 +96,7 @@ The following chart summarizes the Affinity Assistant Modes with different combi
9596
</tbody>
9697
</table>
9798

98-
**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.
99+
**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.
99100

100101
**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)
101102
that require substantial amount of processing which can slow down scheduling in large clusters

docs/artifacts.md

-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,6 @@ Upon resolution and execution of the `TaskRun`, the `Status` will look something
501501
"featureFlags": {
502502
"awaitSidecarReadiness": true,
503503
"coschedule": "workspaces",
504-
"disableAffinityAssistant": false,
505504
"disableCredsInit": false,
506505
"disableInlineSpec": "",
507506
"enableAPIFields": "beta",

docs/deprecations.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ The following features are deprecated but have not yet been removed.
2626
| [The `config-trusted-resources` configMap is deprecated](https://github.com/tektoncd/pipeline/issues/5852) | v0.45.0 | Alpha | v0.46.0 |
2727
| [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 |
2828
| [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 |
29-
| [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 |
3029
| 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. |
3130

3231
### v1beta1 deprecation
@@ -46,6 +45,8 @@ The features listed below have been removed but may still be supported in releas
4645
| [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 |
4746
| 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 |
4847
| 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 |
48+
| [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 |
49+
4950

5051
### Removed PipelineResources related features:
5152

pkg/apis/config/feature_flags.go

+3-15
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ const (
6060
ResultExtractionMethodTerminationMessage = "termination-message"
6161
// ResultExtractionMethodSidecarLogs is the value used for "results-from" as a way to extract results from tasks using sidecar logs.
6262
ResultExtractionMethodSidecarLogs = "sidecar-logs"
63-
// DefaultDisableAffinityAssistant is the default value for "disable-affinity-assistant".
64-
DefaultDisableAffinityAssistant = false
6563
// DefaultDisableCredsInit is the default value for "disable-creds-init".
6664
DefaultDisableCredsInit = false
6765
// DefaultRunningInEnvWithInjectedSidecars is the default value for "running-in-environment-with-injected-sidecars".
@@ -119,7 +117,6 @@ const (
119117
// in Taskrun or Pipelinerun
120118
DisableInlineSpec = "disable-inline-spec"
121119

122-
disableAffinityAssistantKey = "disable-affinity-assistant"
123120
disableCredsInitKey = "disable-creds-init"
124121
runningInEnvWithInjectedSidecarsKey = "running-in-environment-with-injected-sidecars"
125122
awaitSidecarReadinessKey = "await-sidecar-readiness"
@@ -188,7 +185,7 @@ var (
188185
// FeatureFlags holds the features configurations
189186
// +k8s:deepcopy-gen=true
190187
type FeatureFlags struct {
191-
DisableAffinityAssistant bool `json:"disableAffinityAssistant,omitempty"`
188+
// DisableAffinityAssistant bool `json:"disableAffinityAssistant,omitempty"`
192189
DisableCredsInit bool `json:"disableCredsInit,omitempty"`
193190
RunningInEnvWithInjectedSidecars bool `json:"runningInEnvWithInjectedSidecars,omitempty"`
194191
RequireGitSSHSecretKnownHosts bool `json:"requireGitSSHSecretKnownHosts,omitempty"`
@@ -259,9 +256,6 @@ func NewFeatureFlagsFromMap(cfgMap map[string]string) (*FeatureFlags, error) {
259256
}
260257

261258
tc := FeatureFlags{}
262-
if err := setFeature(disableAffinityAssistantKey, DefaultDisableAffinityAssistant, &tc.DisableAffinityAssistant); err != nil {
263-
return nil, err
264-
}
265259
if err := setFeature(disableCredsInitKey, DefaultDisableCredsInit, &tc.DisableCredsInit); err != nil {
266260
return nil, err
267261
}
@@ -304,7 +298,7 @@ func NewFeatureFlagsFromMap(cfgMap map[string]string) (*FeatureFlags, error) {
304298
if err := setFeature(setSecurityContextReadOnlyRootFilesystemKey, DefaultSetSecurityContextReadOnlyRootFilesystem, &tc.SetSecurityContextReadOnlyRootFilesystem); err != nil {
305299
return nil, err
306300
}
307-
if err := setCoschedule(cfgMap, DefaultCoschedule, tc.DisableAffinityAssistant, &tc.Coschedule); err != nil {
301+
if err := setCoschedule(cfgMap, DefaultCoschedule, &tc.Coschedule); err != nil {
308302
return nil, err
309303
}
310304
if err := setPerFeatureFlag(EnableCELInWhenExpression, DefaultEnableCELInWhenExpression, &tc.EnableCELInWhenExpression); err != nil {
@@ -350,20 +344,14 @@ func setEnabledAPIFields(cfgMap map[string]string, defaultValue string, feature
350344
}
351345

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

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

pkg/apis/config/feature_flags_test.go

-12
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) {
3838
testCases := []testCase{
3939
{
4040
expectedConfig: &config.FeatureFlags{
41-
DisableAffinityAssistant: false,
4241
RunningInEnvWithInjectedSidecars: true,
4342
RequireGitSSHSecretKnownHosts: false,
4443
DisableCredsInit: config.DefaultDisableCredsInit,
@@ -63,7 +62,6 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) {
6362
},
6463
{
6564
expectedConfig: &config.FeatureFlags{
66-
DisableAffinityAssistant: true,
6765
RunningInEnvWithInjectedSidecars: false,
6866
AwaitSidecarReadiness: false,
6967
RequireGitSSHSecretKnownHosts: true,
@@ -94,7 +92,6 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) {
9492
// These are prescribed as true by enabling "alpha" API fields, even
9593
// if the submitted text value is "false".
9694
EnforceNonfalsifiability: config.DefaultEnforceNonfalsifiability,
97-
DisableAffinityAssistant: config.DefaultDisableAffinityAssistant,
9895
DisableCredsInit: config.DefaultDisableCredsInit,
9996
RunningInEnvWithInjectedSidecars: config.DefaultRunningInEnvWithInjectedSidecars,
10097
AwaitSidecarReadiness: config.DefaultAwaitSidecarReadiness,
@@ -119,7 +116,6 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) {
119116
expectedConfig: &config.FeatureFlags{
120117
EnableAPIFields: "stable",
121118
EnforceNonfalsifiability: config.DefaultEnforceNonfalsifiability,
122-
DisableAffinityAssistant: config.DefaultDisableAffinityAssistant,
123119
DisableCredsInit: config.DefaultDisableCredsInit,
124120
RunningInEnvWithInjectedSidecars: config.DefaultRunningInEnvWithInjectedSidecars,
125121
AwaitSidecarReadiness: config.DefaultAwaitSidecarReadiness,
@@ -140,7 +136,6 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) {
140136
expectedConfig: &config.FeatureFlags{
141137
EnableAPIFields: "beta",
142138
EnforceNonfalsifiability: config.DefaultEnforceNonfalsifiability,
143-
DisableAffinityAssistant: config.DefaultDisableAffinityAssistant,
144139
DisableCredsInit: config.DefaultDisableCredsInit,
145140
RunningInEnvWithInjectedSidecars: config.DefaultRunningInEnvWithInjectedSidecars,
146141
AwaitSidecarReadiness: config.DefaultAwaitSidecarReadiness,
@@ -211,7 +206,6 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) {
211206
func TestNewFeatureFlagsFromEmptyConfigMap(t *testing.T) {
212207
FeatureFlagsConfigEmptyName := "feature-flags-empty"
213208
expectedConfig := &config.FeatureFlags{
214-
DisableAffinityAssistant: config.DefaultDisableAffinityAssistant,
215209
DisableCredsInit: config.DefaultDisableCredsInit,
216210
RunningInEnvWithInjectedSidecars: config.DefaultRunningInEnvWithInjectedSidecars,
217211
AwaitSidecarReadiness: config.DefaultAwaitSidecarReadiness,
@@ -286,9 +280,6 @@ func TestNewFeatureFlagsConfigMapErrors(t *testing.T) {
286280
}, {
287281
fileName: "feature-flags-enforce-nonfalsifiability-bad-flag",
288282
want: `invalid value for feature flag "enforce-nonfalsifiability": "bad-value"`,
289-
}, {
290-
fileName: "feature-flags-invalid-coschedule-affinity-assistant-comb",
291-
want: `coschedule value pipelineruns is incompatible with disable-affinity-assistant setting to false`,
292283
}, {
293284
fileName: "feature-flags-invalid-coschedule",
294285
want: `invalid value for feature flag "coschedule": "invalid"`,
@@ -298,9 +289,6 @@ func TestNewFeatureFlagsConfigMapErrors(t *testing.T) {
298289
}, {
299290
fileName: "feature-flags-invalid-running-in-environment-with-injected-sidecars",
300291
want: `failed parsing feature flags config "invalid-boolean": strconv.ParseBool: parsing "invalid-boolean": invalid syntax`,
301-
}, {
302-
fileName: "feature-flags-invalid-disable-affinity-assistant",
303-
want: `failed parsing feature flags config "truee": strconv.ParseBool: parsing "truee": invalid syntax`,
304292
}, {
305293
fileName: "feature-flags-invalid-enable-cel-in-whenexpression",
306294
want: `failed parsing feature flags config "invalid": strconv.ParseBool: parsing "invalid": invalid syntax for feature enable-cel-in-whenexpression`,

pkg/apis/config/testdata/feature-flags-all-flags-set.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ metadata:
1818
name: feature-flags
1919
namespace: tekton-pipelines
2020
data:
21-
disable-affinity-assistant: "true"
2221
coschedule: "disabled"
2322
running-in-environment-with-injected-sidecars: "false"
2423
await-sidecar-readiness: "false"

pkg/apis/config/testdata/feature-flags-invalid-coschedule-affinity-assistant-comb.yaml

-22
This file was deleted.

0 commit comments

Comments
 (0)