kubebuilder icon indicating copy to clipboard operation
kubebuilder copied to clipboard

Refactor `CronJob` and `MultiVersion` Sample Code to Align with `DeployImage` Plugin Scaffold Structure

Open camilamacedo86 opened this issue 1 year ago • 0 comments
trafficstars

What do you want to happen?

This issue proposes refactoring the CronJob and MultiVersion samples to follow the structure and best practices introduced by the DeployImage plugin, which includes scaffolding to manage resources defined via command-line inputs, such as images.

Objectives

The main goals for this refactoring include ensure:

  1. Align the structure of the CronJob and MultiVersion examples with the scaffolded layout used by the DeployImage plugin.
  2. Apply best practices, such as fetching the resource before updates, to prevent reconciliation conflicts due to intermediate changes.
  3. Integrate status conditions to better track resource states. (see that we have indeed a task for that: https://github.com/kubernetes-sigs/kubebuilder/issues/4019)
  4. Ensure that test implementations mirror the DeployImage scaffolded layout, with comprehensive tests for the controller logic.(see that we have indeed a task for that: https://github.com/kubernetes-sigs/kubebuilder/issues/4140)
  5. Retain the original logic and functionality of the CronJob and MultiVersion examples.
  6. Preserve the existing markers to ensure that documentation snippets are generated and rendered consistently in the docs.

Reference Materials

To align with DeployImage scaffolding, please review the following examples:

Additional Notes

All sample updates should be implemented to ensure they match the DeployImage plugin’s scaffold structure and best practices, while still fulfilling the unique requirements of each sample (i.e., CronJob and MultiVersion functionality).

Related tasks:

  • https://github.com/kubernetes-sigs/kubebuilder/issues/4019
  • https://github.com/kubernetes-sigs/kubebuilder/issues/4140

Example of Motivation: https://github.com/kubernetes-sigs/kubebuilder/discussions/4290

Updating the Documentation Samples

Please note that these sample files are auto-generated for the documentation. Any changes made to these samples will be reflected in the documentation only when running make generate-docs.

The sample generation process is managed through:

  • Makefile configuration: See Makefile#L82-L84.
  • Documentation generation scripts: Updates should be made within

Note: We can approach this refactoring with multiple smaller PRs or a single comprehensive one. For example, we could start by adding Status Conditions, then improve the tests, and so on.

Extra Labels

No response

camilamacedo86 avatar Nov 05 '24 06:11 camilamacedo86