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

feat: set pruneMark based on path #433

Closed
wants to merge 3 commits into from
Closed

Conversation

Duologic
Copy link
Member

The current pruning logic uses the metadata.Name, under the assumption this is unique. We forced it to be unique by
setting the name equal to the path. This has caused a few headaches for newcomers.

This PR proposes to use a hash of the path and add it as a sha256 prune mark. Except for consistency, this also resolves
the issue that labels are limited to 63 characters while paths can be much longer. This can optionally be enabled by
setting spec.pruneMark and leaves the original spec.injectLabels untouched. What's the catch? This label can't be
used anymore for pruning as the logic to support it would be arguably more complex.

Surplus, this PR also sets metadata.Path at runtime, the path relative to the root. This removes the aformentioned
assumption that name equals path and also shows up in tk env list --json, which can in turn be used by other tools
that want to perform bulk actions on Tanka environments.

@Duologic Duologic force-pushed the duologic/env_path_prune branch from d31bdd2 to 3e2efdb Compare November 29, 2020 00:02
if !k.Env.Spec.InjectLabels {
return nil, fmt.Errorf(`spec.injectLabels is set to false in your spec.json. Tanka needs to add
if k.Env.Spec.InjectLabels {
return nil, fmt.Errorf(`spec.injectLabels for pruning is deprecated, please use spec.pruneMark instead. See
Copy link
Member Author

Choose a reason for hiding this comment

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

Just realized failing on this setting while keeping support for it in general is probably not going to work well.

@Duologic
Copy link
Member Author

Duologic commented Dec 4, 2020

I think the metadata.path commit might be more useful as a separate PR, it is a bit related to #393

@stale
Copy link

stale bot commented Jan 3, 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 Jan 3, 2021
@stale stale bot removed the stale label Jan 6, 2021
@Duologic
Copy link
Member Author

Closing this for now, we might take inspiration from this in a future refactor of the pruning code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant