-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 the template processing more compatible with the dynamic client #20337
make the template processing more compatible with the dynamic client #20337
Conversation
|
||
func (c *dynamicTemplateProcessor) ProcessToListFromUnstructured(unstructuredTemplate *unstructured.Unstructured) (*unstructured.UnstructuredList, error) { | ||
processedTemplate, err := c.client.Resource(templatev1.GroupVersion.WithResource("processedtemplates")). | ||
Namespace("default").Create(unstructuredTemplate) |
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.
can you check the error here?
if err != nil { | ||
return nil, err | ||
} | ||
return processedList, 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.
i would just return processedTemplate.ToList()
} | ||
processedList, err := processedTemplate.ToList() | ||
templateProcessor := templateprocessing.NewDynamicTemplateProcessor(r.client) | ||
processedList, err := templateProcessor.ProcessToList(template) |
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.
nit: templateprocessing.NewDynamicTemplateProcessor(r.client).ProcessToList(template)
but I don't care much
@@ -453,3 +434,13 @@ func TestProcessTemplateParameters(t *testing.T) { | |||
t.Errorf("unexpected output: %s", diff.StringDiff(string(exp), string(result))) | |||
} | |||
} | |||
|
|||
// AddParameter adds new custom parameter to the Template. It overrides |
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.
nit: lower case
@deads2k small nits, LGTM otherwise |
62b2b10
to
ad79c88
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ad79c88
to
183823b
Compare
comments addressed. |
/retest |
Simplify processing a template via the API and getting a result you can use with dynamic client.
post-rebase request from @mfojtik
/assign @mfojtik