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

Conversation

l-qing
Copy link
Member

@l-qing l-qing commented Mar 1, 2025

fix #8587

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.

Changes

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release 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

/kind cleanup

@tekton-robot tekton-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 1, 2025
@tekton-robot tekton-robot requested review from afrittoli and dibyom March 1, 2025 07:04
@l-qing
Copy link
Member Author

l-qing commented Mar 1, 2025

/cc @vdemeester

@tekton-robot tekton-robot requested a review from vdemeester March 1, 2025 07:08
configMap := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{Name: config.GetFeatureFlagsConfigName(), Namespace: system.Namespace()},
Data: map[string]string{
featureFlagDisableAffinityAssistantKey: "true",
"coschedule": "disabled",
Copy link
Member Author

Choose a reason for hiding this comment

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

As mentioned in the action required, if you want to maintain the execution behavior, you may need to set the coschedule to disabled.

The focus is on the line of code below: (line: 53)

// GetAffinityAssistantBehavior returns an AffinityAssistantBehavior based on the
// combination of "disable-affinity-assistant" and "coschedule" feature flags
// TODO(#6740)(WIP): consume this function in the PipelineRun reconciler to determine Affinity Assistant behavior.
func GetAffinityAssistantBehavior(ctx context.Context) (AffinityAssistantBehavior, error) {
cfg := config.FromContextOrDefaults(ctx)
disableAA := cfg.FeatureFlags.DisableAffinityAssistant
coschedule := cfg.FeatureFlags.Coschedule
// at this point, we have validated that "coschedule" can only be "workspaces"
// when "disable-affinity-assistant" is false
if !disableAA {
return AffinityAssistantPerWorkspace, nil
}
switch coschedule {
case config.CoschedulePipelineRuns:
return AffinityAssistantPerPipelineRun, nil
case config.CoscheduleIsolatePipelineRun:
return AffinityAssistantPerPipelineRunWithIsolation, nil
case config.CoscheduleDisabled, config.CoscheduleWorkspaces:
return AffinityAssistantDisabled, nil
}

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.2% 95.0% -0.2
pkg/internal/affinityassistant/affinityassistant_types.go 90.0% 87.5% -2.5

"test-pipeline-run-variable-substitution", "test-pipeline", "b-task", false),
taskRunObjectMetaWithAnnotations("test-pipeline-run-variable-substitution-b-task", "foo",
"test-pipeline-run-variable-substitution", "test-pipeline", "b-task", false, map[string]string{
"pipeline.tekton.dev/affinity-assistant": "affinity-assistant-0358aabfa2",
Copy link
Member Author

Choose a reason for hiding this comment

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

Since the previous setting of disable-affinity-assistant was true, the default behavior was not to add the relevant annotations. Now that the feature switch has been removed, the behavior has changed somewhat.

Theoretically, the previous effect can also be achieved by setting other feature switches.

@l-qing l-qing closed this Mar 1, 2025
@l-qing l-qing reopened this Mar 1, 2025
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.2% 95.0% -0.2
pkg/internal/affinityassistant/affinityassistant_types.go 90.0% 87.5% -2.5

@l-qing l-qing closed this Mar 1, 2025
@l-qing l-qing reopened this Mar 1, 2025
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.2% 95.0% -0.2
pkg/internal/affinityassistant/affinityassistant_types.go 90.0% 87.5% -2.5

@l-qing l-qing closed this Mar 1, 2025
@l-qing l-qing reopened this Mar 1, 2025
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.2% 95.0% -0.2
pkg/internal/affinityassistant/affinityassistant_types.go 90.0% 87.5% -2.5

@l-qing l-qing closed this Mar 1, 2025
@l-qing l-qing reopened this Mar 1, 2025
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.2% 95.0% -0.2
pkg/internal/affinityassistant/affinityassistant_types.go 90.0% 87.5% -2.5

@l-qing l-qing closed this Mar 1, 2025
@l-qing l-qing reopened this Mar 1, 2025
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.2% 95.0% -0.2
pkg/internal/affinityassistant/affinityassistant_types.go 90.0% 87.5% -2.5

@waveywaves
Copy link
Member

/assign

# 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.

**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.

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 😸

@waveywaves
Copy link
Member

/approve

@arturdzm
Copy link

arturdzm commented Mar 6, 2025

Looks like this also fixes the bug that coschedule was actually disabled when set to 'workspaces' Or is this is expected behavior and AA has to be enabled for now until flag is removed?

We are ruuning v0.65.6 and coscheduling seems to not work with disable-affinity-assistant=true and coschedule=workspaces.

@l-qing
Copy link
Member Author

l-qing commented Mar 6, 2025

Looks like this also fixes the bug that coschedule was actually disabled when set to 'workspaces' Or is this is expected behavior and AA has to be enabled for now until flag is removed?

We are ruuning v0.65.6 and coscheduling seems to not work with disable-affinity-assistant=true and coschedule=workspaces.

In v0.65.6, the disable-affinity-assistant needs to be used in conjunction with coschedule. According to the documentation, this aligns with previous expectations.

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 11, 2025
@l-qing l-qing force-pushed the feat/remove-deprecated-disable-affinity-assistant-field branch from e365ea3 to ec80a75 Compare March 12, 2025 02:07
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 12, 2025
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.2% 95.0% -0.2
pkg/internal/affinityassistant/affinityassistant_types.go 90.0% 87.5% -2.5

@l-qing l-qing closed this Mar 12, 2025
@l-qing l-qing reopened this Mar 12, 2025
@l-qing l-qing closed this Mar 12, 2025
@l-qing l-qing reopened this Mar 12, 2025
@l-qing l-qing force-pushed the feat/remove-deprecated-disable-affinity-assistant-field branch from ec80a75 to 25d7a0c Compare March 12, 2025 07:20
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.2% 95.0% -0.2
pkg/internal/affinityassistant/affinityassistant_types.go 90.0% 87.5% -2.5

disableCredsInit:
description: 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.

Those descriptions seems weird, don't they ?

@@ -188,7 +185,7 @@ var (
// FeatureFlags holds the features configurations
// +k8s:deepcopy-gen=true
type FeatureFlags struct {
DisableAffinityAssistant bool `json:"disableAffinityAssistant,omitempty"`
// 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.

Either we keep it as no-op (in order to not fail existing configuration), or we remove it, but we shouldn't keep the comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems that the strange annotations generated by hack/update-codegen.sh are due to the comments below. I removed the comments and regenerated it, and it worked fine.

Please have a look when you have time. Thank you!

@l-qing l-qing force-pushed the feat/remove-deprecated-disable-affinity-assistant-field branch from 25d7a0c to b39da59 Compare March 13, 2025 03:31
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.2% 95.0% -0.2
pkg/internal/affinityassistant/affinityassistant_types.go 90.0% 87.5% -2.5

l-qing added 2 commits March 14, 2025 12:23
…ure 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.
@l-qing l-qing force-pushed the feat/remove-deprecated-disable-affinity-assistant-field branch from b39da59 to 2c9f859 Compare March 14, 2025 04:23
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.2% 95.0% -0.2
pkg/internal/affinityassistant/affinityassistant_types.go 90.0% 87.5% -2.5

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester, waveywaves

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Question: Is there a plan to completely remove the deprecated disable-affinity-assistant configuration option?
5 participants