-
Bug
-
Resolution: Won't Do
-
Undefined
-
None
-
4.15
-
None
-
Important
-
No
-
Rejected
-
False
-
-
Description of problem:
Following error returns when attempt to use printf in hub-side template configmap name. 2023-11-23T23:53:02Z ERROR controllers.ClusterGroupUpgrade Policy is invalid {"error": "(printf \"ztp-site-%s\" .ManagedClusterName): printf variable is not supported in the template function Name field"} In 4.15, an option siteConfigMap is added to ZTP siteconfig in order to auto-generate site-specific configmap later used by hub-side templating - since every site will be generating configmap with different name, unable to dynamically compose the configmap name in PGT essentially makes this new addition unusable in scale.
Version-Release number of selected component (if applicable):
4.15
How reproducible:
100%
Steps to Reproduce:
1. use siteConfigMap to auto generate configmap that will be used by hub-side templating later on. configmap name is: ztp-site-{sitename} 2. in PGT, use hub-side template to where configmap name is dynamically composed e.g., deviceType: '{{hub fromConfigMap "ztp-group" (printf "ztp-site-%s" .ManagedClusterName) "sriov-device-type" hub}}' 3. attempt to apply the templated policy via TALM
Actual results:
error returned by TALM: 2023-11-23T23:53:02Z INFO utils.policy_template Validating hub template in policy {"policy": "group-du-sno-v4.15-site-config-policy", "template": "{{hub fromConfigMap \"ztp-group\" (printf \"ztp-site-%s\" .ManagedClusterName) \"sriov-device-type\" hub}}"} 2023-11-23T23:53:02Z ERROR controllers.ClusterGroupUpgrade Policy is invalid {"error": "(printf \"ztp-site-%s\" .ManagedClusterName): printf variable is not supported in the template function Name field"} github.com/openshift-kni/cluster-group-upgrades-operator/controllers.(*ClusterGroupUpgradeReconciler).doManagedPoliciesExist /remote-source/app/controllers/clustergroupupgrade_controller.go:1046 github.com/openshift-kni/cluster-group-upgrades-operator/controllers.(*ClusterGroupUpgradeReconciler).Reconcile /remote-source/app/controllers/clustergroupupgrade_controller.go:217 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile /remote-source/app/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:122 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler /remote-source/app/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:323 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem /remote-source/app/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:274 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2 /remote-source/app/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:235 2023-11-23T23:53:02Z INFO controllers.ClusterGroupUpgrade Finish reconciling CGU {"name": {"name":"helix60","namespace":"ztp-install"}, "requeueAfter": 60} 2023-11-23T23:53:03Z INFO controllers.ManagedClusterForCGU clusterGroupUpgrade found {"Name": "helix60", "Namespace": "ztp-install"}
Expected results:
printf should be allowed in composing configmap name
Additional info: