feat: parameterization #8365
Conversation
cb6024e to
e1ac0a1
Compare
Codecov Report
@@ Coverage Diff @@
## main #8365 +/- ##
==========================================
- Coverage 70.48% 65.20% -5.29%
==========================================
Files 515 607 +92
Lines 23150 30100 +6950
==========================================
+ Hits 16317 19626 +3309
- Misses 5776 8999 +3223
- Partials 1057 1475 +418
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
8bd8405 to
2721c1b
Compare
| metadata: | ||
| name: getting-started | ||
| labels: | ||
| a: hhhh # kpt-set: ${hello} |
There was a problem hiding this comment.
nit: hhhh -> will-be-overwritten
| args = append(args, "-f", exp) | ||
| } | ||
|
|
||
| for _, k := range maps.SortKeys(manifestOverrides) { |
There was a problem hiding this comment.
if there is a duplicate key set via r.SetValues above, will the key appended later win out? Just want to make sure the key:values set in manifestOverrides have priorty over setValues key:values
There was a problem hiding this comment.
yes.. tested locally later write wins.
| var ( | ||
| KptVersion = currentKptVersion | ||
| maxKptVersionAllowedForDeployer = "1.0.0-beta.13" | ||
| maxKptVersionAllowedForDeployer = "1.0.0-beta.24" |
There was a problem hiding this comment.
My understanding is that for the kpt renderer any version could be used but for the kpt deployer they broke some things we depend on after 1.0.0-beta.13. @renzodavid9 did you have any additional information here? I'm not sure if we can change this. I think it makes sense to allow any version if kpt deploy isn't required (eg: render only) but I think that is the case currently?
There was a problem hiding this comment.
This is a temporary workaround as using 1.0.0-beta.15 above will break kpt render, but using lower version kpt doesn't support running krm function to modify yaml out-place. I'm going to remove the validation and fix kpt render output Kptfile issue in another pr to fix #8306
| t.CheckFileExistAndContent(filepath.Join(tmpDirObj.Root(), constants.DefaultHydrationDir, kptfile.KptFileName), | ||
| []byte(test.updatedKptfile)) | ||
| }) | ||
| t.Skip("todo:" + test.description) |
There was a problem hiding this comment.
Is this t.Skip necessary here? Might make sense to remove or if it is necessary, add a comment as to why this is skipped
There was a problem hiding this comment.
ohh.. I was thinking to re-write the tests. This skip was meant to add comments. I'll add a separate comment.
There was a problem hiding this comment.
Just realized that related tests are added in this pr .. I'm removing the test here.
| deployConfig := pipeline.Deploy | ||
|
|
||
| if renderConfig.Validate != nil || renderConfig.Transform != nil || renderConfig.Kpt != nil { | ||
| if renderConfig.Kpt != nil { |
There was a problem hiding this comment.
Why is this conditional different now?
There was a problem hiding this comment.
Why is this conditional different now?
yeah.. the function was mainly used to determine if a kpt hydrationDir should be created , because the original implementation around transform/validate is to marshal related config into a kptfile and put the kptfile and intermediary manifests into the hydrationDir and then call kpt render to do the actual transformation in-place in that direcotry, then call kpt source to get the result into memory. In the new flow, we run krm function against a manifest input stream with kpt fn eval, we don't create any directories. Also, kpt here for renderConfig.Transform and renderConfig.Validate is a krm function executor, this can be replaced by internal function or kustomize run fn. This is not tied to kpt render or kpt live apply , as the method name suggested isKptRendererOrDeployerUsed, those conditions shouldn't be here.
| } | ||
| // TODO(tejaldesai) consult with cloud deploy team if namespaces can be set in offline mode | ||
| // in case namespace is set on the skaffold render cli command. | ||
| // This is kind of strange, it seems to indicate namespace setting is controlled by this offline flag. If a user set namespace through command line, the command line setting should always be honored |
There was a problem hiding this comment.
nit: I'm a bit confused if this comment should be here, it seems more this statement should be tracked in an issue - I think it might already be here:
#8318
I don't think this comment adds clarify to any of the surrounding code atm
There was a problem hiding this comment.
great! I'll remove it.
| if sUtil.IsURL(path) { | ||
| return nil | ||
| } | ||
| // todo making everything absolute path |
There was a problem hiding this comment.
nit: todos usually follow a syntax like
// TODO(#issue-number) <explanation>
OR
// TODO(@ gh-username) <explanation>
aaron-prindle
left a comment
There was a problem hiding this comment.
LGTM, just a few nits. Exciting!
Fixes: #8245, #7954
Future work: #8306, #8406, #8410 add kpt examples
Description:
Kustomizeremoves comments when building manifests, the previous approach for using transformers doesn't work for manifests with comments.kpt rendercommand outputs Kptfile content as part of render result unless using kpt with version under 1.0.0-beta.15 which is less preferred, this actually breaks krm function specs, and will causekubectl apply -f -fail if piped with the render result.--set flagkpt rendercommand and output unwrapped result into memory, then running transformers against the output.Manual Test
skaffold render --set key1=value1 --set key2=value2, should be able to see values with kpt setter comments are replaced by provided values from command line.