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

fix: don't use generateName when creating jobs #48

Merged
merged 1 commit into from
Jan 16, 2023

Conversation

erikgb
Copy link
Member

@erikgb erikgb commented Jan 12, 2023

The main purpose of this PR is to address the fragile tests we have been seeing in #19 and #27. After the investigation performed by @padlar, it seems like the underlying cause might be duplicate jobs. So I took a closer look, and using generateName in a controller seems like a bad idea - since the name will be a random one and not deterministic.

So this PR replaces use of generateName with a deterministic name, composed by CIS name, spec and namespace. But since a Kubernetes job has a name max length of 63 characters, we need to do this "smart".

Finally I found some constants in an api-machinery package for these max length values.

The e2e-tests seems to work again after this PR, so we should re-enable them in a follow-up PR. Ref. #63

We should probably try to revert #41 and lower the e2e test timeout in follow-up PRs if we see that this fix works.

@erikgb erikgb marked this pull request as ready for review January 12, 2023 20:11
@erikgb erikgb requested a review from a team as a code owner January 12, 2023 20:11
@erikgb erikgb force-pushed the no-generate-name branch 2 times, most recently from d3ab6a2 to b790457 Compare January 12, 2023 20:47
@erikgb erikgb marked this pull request as draft January 14, 2023 21:24
@erikgb erikgb marked this pull request as ready for review January 16, 2023 08:25
padlar
padlar previously approved these changes Jan 16, 2023
Copy link
Contributor

@padlar padlar left a comment

Choose a reason for hiding this comment

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

lgtm

bendikp
bendikp previously approved these changes Jan 16, 2023
@erikgb erikgb dismissed stale reviews from bendikp and padlar via 4fed45b January 16, 2023 08:56
@erikgb erikgb requested review from padlar and bendikp January 16, 2023 08:57
@erikgb erikgb enabled auto-merge (squash) January 16, 2023 08:59
@erikgb erikgb merged commit d7c8185 into statnett:main Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants