-
Notifications
You must be signed in to change notification settings - Fork 22
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
Make NSTemplateTier generator generic #381
Make NSTemplateTier generator generic #381
Conversation
//go:embed testdata/nstemplatetiers* | ||
var testTemplateFiles embed.FS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just a copy-paste of what was in host-operator: https://github.com/codeready-toolchain/host-operator/tree/master/test/templates/nstemplatetiers
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #381 +/- ##
==========================================
+ Coverage 75.75% 77.66% +1.91%
==========================================
Files 45 46 +1
Lines 1728 1952 +224
==========================================
+ Hits 1309 1516 +207
- Misses 367 376 +9
- Partials 52 60 +8
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Job 👍
I like that we switched to embed.FS
and the new ensureObject
function.
for _, tierTmpl := range tierTmpls.tierTemplates { | ||
log.Info("creating TierTemplate", "namespace", tierTmpl.Namespace, "name", tierTmpl.Name) | ||
// using the "standard" client since we don't need to support updates on such resources, they should be immutable | ||
if _, err := t.ensureObject(tierTmpl, false); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the second parameter wasn't immediately clear to me, but I like the new ensureObject
function.
Quality Gate passedIssues Measures |
This PR moves the logic of nstemplatetier_generator.go from host-operator to toolchain-common and make it generic so it can be used by a ksctl command for generating NSTemplateTier & TierTemplate manifests locally in a GitOps repository.
There is almost no change in the logic of the generator, it should work in the same way as it was before, just with the difference that it doesn't load templates from the assets, but takes them from the map passed as a parameter.
KUBESAW-59
related PR in host-operator repo codeready-toolchain/host-operator#1006