Background
#544 added a year option to generator commands (object, crd, rbac, and webhook), allowing callers to substitute a YEAR placeholder in boilerplate header files with a specific value.
Problem
The applyconfiguration generator is missing the year option and unconditionally replaces YEAR using time.Now().UTC().Year(), leading to inconsistent behaviour.
The full call chain is:
controller-tools/pkg/applyconfiguration/gen.go#L215
controller-tools/pkg/applyconfiguration/gen.go#L293
code-generator/cmd/applyconfiguration-gen/generators/targets.go#L60
gengo/v2/execute.go#L59
Proposed Solution
Add a optional year option to the applyconfiguration generator, which when set, will take precedence. This change would be backwards compatible, as if the option is not specified, the current logic stays as it currently is.
Additionally, the other generators could have same logic, of defaulting to the current year as a subsitution for the string "YEAR" if not overridden by the option.
Background
#544 added a
yearoption to generator commands (object,crd,rbac, andwebhook), allowing callers to substitute aYEARplaceholder in boilerplate header files with a specific value.Problem
The
applyconfigurationgenerator is missing theyearoption and unconditionally replacesYEARusingtime.Now().UTC().Year(), leading to inconsistent behaviour.The full call chain is:
controller-tools/pkg/applyconfiguration/gen.go#L215controller-tools/pkg/applyconfiguration/gen.go#L293code-generator/cmd/applyconfiguration-gen/generators/targets.go#L60gengo/v2/execute.go#L59Proposed Solution
Add a optional
yearoption to theapplyconfigurationgenerator, which when set, will take precedence. This change would be backwards compatible, as if the option is not specified, the current logic stays as it currently is.Additionally, the other generators could have same logic, of defaulting to the current year as a subsitution for the string "YEAR" if not overridden by the option.