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

bug: spec.injectLabels is overwritten if not specified on command line #561

Open
davidovich opened this issue May 6, 2021 · 11 comments
Open
Labels
keepalive kind/bug Something isn't working

Comments

@davidovich
Copy link
Contributor

In PR #505, support was added to the tanka cli to control labels injection for the pruning feature.

But a regression was introduced where an already present flag in the spec will not be honoured. If it is set in the spec but not on the command line, the value will always be reset to the default value.

In the code, I believe there is a missing condition to evaluate if the setting was provided in the command line.

The fix is not that trivial, because we don't know if the default value comes from not specifying the value on the command line, or that the user explicitly said --inject-lables=false. Otherwize it would be easy, add tmp.Spec.InjectLabels to the condition:

// incomplete fix, but valid if we know that the user has not specified --inject-labels=false
if tmp.Spec.InjectLabels && tmp.Spec.InjectLabels != cfg.Spec.InjectLabels {
	fmt.Printf("updated spec.injectLabels (`%t` -> `%t`)\n", cfg.Spec.InjectLabels, tmp.Spec.InjectLabels)
	cfg.Spec.InjectLabels = tmp.Spec.InjectLabels
}
@Duologic Duologic added the kind/bug Something isn't working label May 20, 2021
@stale
Copy link

stale bot commented Jun 23, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 23, 2021
@davidovich
Copy link
Contributor Author

keep active

@stale stale bot removed the stale label Jun 28, 2021
@stale
Copy link

stale bot commented Jul 29, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 29, 2021
@davidovich
Copy link
Contributor Author

Not stale

@stale stale bot removed the stale label Jul 29, 2021
@stale
Copy link

stale bot commented Sep 19, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 19, 2021
@davidovich
Copy link
Contributor Author

Not stale

@stale stale bot removed the stale label Sep 20, 2021
@stale
Copy link

stale bot commented Nov 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 9, 2021
@davidovich
Copy link
Contributor Author

Not stale

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 9, 2022
@davidovich
Copy link
Contributor Author

Not stale

@stale stale bot removed the stale label Jan 10, 2022
@Elfo404 Elfo404 added this to Tanka May 27, 2024
@github-project-automation github-project-automation bot moved this to Triage in Tanka May 27, 2024
@zerok
Copy link
Contributor

zerok commented May 28, 2024

How to reproduce:

  1. Create an empty environment using tk env add
  2. Set the injectLabels property using tk env set environments/lala --inject-labels
  3. Update another spec field using tk env set without specifying the --inject-labels flag
  4. The spec will now no longer have the injectLabels property

@zerok zerok moved this from Triage to Backlog in Tanka May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keepalive kind/bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

4 participants