fix: don't use generateName when creating jobs #48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 aname
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.