Use MultiTemplateDir for the support of multi-segment dir in template#1096
Use MultiTemplateDir for the support of multi-segment dir in template#1096amartyasinha wants to merge 1 commit into
Conversation
|
Skipping CI for Draft Pull Request. |
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/f92eab4ff0494c3c974f4b47862cc437 ❌ openstack-meta-content-provider FAILURE in 9m 22s |
833acea to
4205714
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/bd483d15a9304711826243d8e3546a72 ❌ openstack-meta-content-provider FAILURE in 9m 49s |
|
So for Kinds that already had explicit cases in #1090,
|
|
This PR intends to remove the InstanceType overloading (done in #1090), and leave Regarding
I did not get where to audit this change. Should I amend the commit message to include all details, or add them somewhere else?
Sorry, did not get it. Could you please explain it a bit (maybe an example would be helpful)
IIUC, #1090 has already moved template trees for all kinds as |
gibizer
left a comment
There was a problem hiding this comment.
You can try to run a build and test in CI by temporarily adding the new lib-common hash to the go.mod file so the build can see the new field.
| Type: util.TemplateTypeConfig, | ||
| InstanceType: getTemplateInstanceType(instance), | ||
| InstanceType: gvk.Kind, | ||
| MultiTemplateDir: util.GetTemplateSubpath(gvk.Group, gvk.Kind), |
There was a problem hiding this comment.
I think this is where the change go too far by trying to generate the path instead of just defining the path per service. Trying to support the generation is just unnecessary complexity. Simply define the path per service in the nova-operator then we can avoid this complexity.
There was a problem hiding this comment.
ack! I thought we need to generate path from kind, i.e. NovaAPI -> nova + api. Since we can define the path directly instead of generating, I'll remove the generation functions from lib-common, and close the CRD spec modification PR.
There was a problem hiding this comment.
defined the path instead of generating them
| Namespace: instance.Namespace, | ||
| Type: util.TemplateTypeScripts, | ||
| InstanceType: instance.GetObjectKind().GroupVersionKind().Kind, | ||
| MultiTemplateDir: "nova/nova-manage", |
There was a problem hiding this comment.
Yepp this is the correct use of the new interface.
Explicit is better than implicit.
Simple is better than complex.
| templateParameters map[string]any, | ||
| extraData map[string]string, cmLabels map[string]string, | ||
| additionalTemplates map[string]string, | ||
| withScripts bool, |
There was a problem hiding this comment.
- You probably need a new param here to pass the template dir.
- Or you can try to change the
instance client.Objectto be a specific interface type where the interface defines a getter for the template dir and then implement that
interface function for our Objects - Or you can add the getter for the ReconcileBase and then implement it in each Reconciler to return the service specific path.
There was a problem hiding this comment.
added a new param templateDir.
4205714 to
ae96eb3
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: amartyasinha The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
cb7af73 to
8e6c407
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/543c38b98e54484585ca5047ccff327d ❌ openstack-meta-content-provider FAILURE in 9m 11s |
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/de67ec79fde947fdb7710c52538dff49 ✔️ openstack-meta-content-provider SUCCESS in 3h 47m 10s |
|
recheck nova-operator-kuttl |
gibizer
left a comment
There was a problem hiding this comment.
Overall looks good to me.
| InstanceType: getTemplateInstanceType(instance), | ||
| InstanceType: instance.GetObjectKind().GroupVersionKind().Kind, | ||
| Labels: labels, | ||
| CustomData: data, |
There was a problem hiding this comment.
I guess we are not loading any template from file here hence we don't need to pass a templateDir. If I'm correct then a comment would be nice here about it.
There was a problem hiding this comment.
In lib-common, we do not check InstanceType (old logic) or MultiTemplateDir (new change) if template type is none.
Ref: https://github.com/amartyasinha/lib-common/blob/135bf0acdeafc623f9f9f855ca6850748664ff69/modules/common/util/template_util.go#L297
Will add a comment in there in code to clarify.
|
|
||
| replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20250627150254-e9823e99808e //allow-merging | ||
|
|
||
| replace github.com/openstack-k8s-operators/lib-common/modules/common => github.com/amartyasinha/lib-common/modules/common v0.0.0-20260416075014-135bf0acdeaf |
There was a problem hiding this comment.
yepp this way we can get CI results. After the lib-common change lands we need to remove this line but that is a small price to pay to have early CI results
ff25b96 to
ec94f8a
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/31acb1fdb20342ca9bd0d672e26cc7d0 ✔️ openstack-meta-content-provider SUCCESS in 2h 57m 37s |
|
recheck nova-operator-kuttl |
| Type: util.TemplateTypeNone, | ||
| InstanceType: getTemplateInstanceType(instance), | ||
| InstanceType: instance.GetObjectKind().GroupVersionKind().Kind, | ||
| MultiTemplateDir: "nova/metadata", |
There was a problem hiding this comment.
it seems that other callers with TemplateTypeNone do NOT provide MultiTemplateDir.
Why this one is special?
Please evaluate it for consistency with lib-common behavior and other call sites
There was a problem hiding this comment.
Thanks for the catch! removed MultiTemplateDir here as this specific case is of TemplateTypeNone.
| Namespace: instance.GetNamespace(), | ||
| Type: util.TemplateTypeConfig, | ||
| InstanceType: getTemplateInstanceType(instance), | ||
| InstanceType: instance.GetObjectKind().GroupVersionKind().Kind, |
There was a problem hiding this comment.
For a NovaCell instance, lib-common will look under a subdir derived from "novacell", not "nova/compute". Is that expected?
| configName := instance.GetName() + "-compute-config" | ||
| err := r.GenerateConfigs( | ||
| ctx, h, instance, configName, &hashes, templateParameters, extraData, cmLabels, map[string]string{}, | ||
| ctx, h, instance, configName, &hashes, templateParameters, extraData, cmLabels, map[string]string{}, "nova/compute", |
There was a problem hiding this comment.
ok, I see that this resolved the 'novacell' mismatching behavior I thought still takes place
3f89221 to
ccbea21
Compare
a13603e to
809d07c
Compare
|
lib-common bump PR: #1088 |
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/5dd4abb4e8b844e8a0187f87ccbc6b30 ❌ openstack-meta-content-provider FAILURE in 8m 44s |
you'd have to bump lib-common in go.mod and api/go.mod in this pr, or wait for a next bump to happen. |
The bump has happened in that PR. What's the procedure to get that merged? |
the lib-common PR got merged, but the reference in the go.mod of the nova-operator was not bumped yet. you'd have to do that. https://github.com/openstack-k8s-operators/nova-operator/blob/main/go.mod#L15-L17 |
Yes, get that. This automation PR [1] is bumping the lib-common changes in nova-operator. It now points to the latest commit id [1] https://github.com/openstack-k8s-operators/nova-operator/pull/1088/changes |
yes, when tests passed, we can approve it |
ack! thanks |
809d07c to
06fa137
Compare
With the restructure of the templates dir to have multi-segment dir, this commit ensures the proper templating from these dirs. Signed-off-by: Amartya Sinha <amsinha@redhat.com>
06fa137 to
defa882
Compare
|
/retest |
With the restructure of the templates dir to have multi-segment dir, this commit ensures the proper templating from these dirs.
lib-common change introducing MultiTemplateDir: openstack-k8s-operators/lib-common#682