-
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
cleanup: [TEP-0135] remove deprecated disable-affinity-assistant feature flag #8603
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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** | ||
|
@@ -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`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it okay to write like this in the notes?
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). | ||
|
||
|
@@ -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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💯 |
||
|
||
|
||
### Removed PipelineResources related features: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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". | ||
|
@@ -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" | ||
|
@@ -188,12 +185,9 @@ var ( | |
// FeatureFlags holds the features configurations | ||
// +k8s:deepcopy-gen=true | ||
type FeatureFlags struct { | ||
DisableAffinityAssistant bool `json:"disableAffinityAssistant,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"` | ||
|
@@ -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 | ||
} | ||
|
@@ -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 { | ||
|
@@ -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) | ||
|
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.
✅