Skip to content

[installer]: order the custom envvars #11001

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

Merged
merged 1 commit into from
Jun 29, 2022
Merged

Conversation

mrsimonemms
Copy link
Contributor

@mrsimonemms mrsimonemms commented Jun 29, 2022

Description

Changes how the customize envvars orders it's output. It keeps the existing envvars in the order that's given and the customized envvars are ordered in terms of first one received. This is to avoid unnecessary deploys in a GitOps setup.

Overrides the "fix failing test" commit in #10836 by @Furisto - it achieves the same effect, but does so in the application code rather than the test

Related Issue(s)

Fixes #11000

How to test

The unit tests provides the test coverage. @mads-hartmann should check that the order is as expected

Release Notes

[installer]: order the custom envvars

Documentation

Werft options:

  • /werft with-preview

@@ -521,13 +527,6 @@ func TestCustomizeEnvvar(t *testing.T) {

result := common.CustomizeEnvvar(ctx, testCase.Component, testCase.ExistingEnnvars)

sort.Slice(result, func(a, b int) bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing this ensures that the order generated by the function matches the expectation

@mrsimonemms mrsimonemms marked this pull request as ready for review June 29, 2022 10:36
@mrsimonemms mrsimonemms requested a review from a team June 29, 2022 10:36
@github-actions github-actions bot added the team: delivery Issue belongs to the self-hosted team label Jun 29, 2022
@corneliusludmann
Copy link
Contributor

@mrsimonemms: When it's true that the “map doesn't maintain any kind of stable ordering” as stated in the issue, then we would have the same issue with e.g. annotations (and maybe in several other places as well). I guess, in practice, we can assume that the order, in general, is the same in a map (even if that is not guaranteed), can't we?

cc @mads-hartmann

Copy link
Contributor

@corneliusludmann corneliusludmann left a comment

Choose a reason for hiding this comment

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

Besides my more general comment above, the implementation looks good so far.

@roboquat roboquat merged commit 6aebb2a into main Jun 29, 2022
@roboquat roboquat deleted the sje/order-custom-envvars branch June 29, 2022 11:43
@mrsimonemms
Copy link
Contributor Author

@corneliusludmann yes, you are correct. However, as these are already map[string]string in the Kubernetes spec, the order is not specified (nor has it ever been).

My guess is, knowing this, ArgoCD makes allowances for labels and annotations in it's diff

@mads-hartmann
Copy link
Contributor

@mrsimonemms I think your guess is right. ArgoCD uses their GitOps Engine which I believe tries to be clever about these things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note size/M team: delivery Issue belongs to the self-hosted team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Gitpod Installer randomises ordering of environment variables for components
4 participants