Add imagePullSecrets support to JobConfig for backup and restore jobs#887
Add imagePullSecrets support to JobConfig for backup and restore jobs#887shunki-fujita wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for imagePullSecrets to the JobConfig specification, enabling users with private container registries to authenticate when pulling backup and restore images. This addresses issue #848, which requested this feature to avoid manual patching of CronJobs and Jobs created by the MOCO operator.
Changes:
- Added
ImagePullSecretsfield toJobConfigAPI type - Propagated
imagePullSecretsto both backup CronJob and restore Job PodSpecs in the controller - Updated CRD definitions for MySQLCluster and BackupPolicy resources
- Added comprehensive test coverage for both backup and restore scenarios
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| api/v1beta2/job_types.go | Added ImagePullSecrets field to JobConfig struct and implemented LocalObjectReferenceApplyConfiguration type with DeepCopy method; also fixed comment on line 218 |
| api/v1beta2/zz_generated.deepcopy.go | Auto-generated DeepCopy methods for ImagePullSecrets field and LocalObjectReferenceApplyConfiguration type |
| controllers/mysqlcluster_controller.go | Added WithImagePullSecrets calls to both backup CronJob and restore Job PodSpec construction, following established patterns for slice conversion |
| controllers/mysqlcluster_controller_test.go | Added test data for imagePullSecrets and assertions to verify proper propagation in both backup and restore scenarios |
| config/crd/bases/moco.cybozu.com_mysqlclusters.yaml | Added CRD schema for imagePullSecrets field in MySQLCluster JobConfig |
| config/crd/bases/moco.cybozu.com_backuppolicies.yaml | Added CRD schema for imagePullSecrets field in BackupPolicy JobConfig |
| config/crd/tests/apiextensions.k8s.io_v1_customresourcedefinition_mysqlclusters.moco.cybozu.com.yaml | Test CRD updated with imagePullSecrets schema |
| config/crd/tests/apiextensions.k8s.io_v1_customresourcedefinition_backuppolicies.moco.cybozu.com.yaml | Test CRD updated with imagePullSecrets schema |
| charts/moco/templates/generated/crds/moco_crds.yaml | Helm chart CRD updated with imagePullSecrets schema for both MySQLCluster and BackupPolicy |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Users with private container registries can now specify imagePullSecrets in JobConfig, which is propagated to both backup CronJob and restore Job PodSpecs. This enables pulling backup/restore images from authenticated registries without manual intervention. Signed-off-by: shunki-fujita <shunki-fujita@cybozu.co.jp>
2065254 to
b2a141e
Compare
Signed-off-by: shunki-fujita <shunki-fujita@cybozu.co.jp>
| }, | ||
| } | ||
| jc.ImagePullSecrets = []mocov1beta2.LocalObjectReferenceApplyConfiguration{ | ||
| {Name: ptr.To[string]("my-registry-secret")}, |
There was a problem hiding this comment.
@shunki-fujita
Please update your branch with the latest changes from main.
Also, please replace the k8s.io/utils/ptr.To() calls with Go 1.26's new new(expr) builtin once you've updated. That would let us drop the k8s.io/utils/ptr dependency here.
Close: #848
Users with private container registries can now specify imagePullSecrets in JobConfig, which is propagated to both backup CronJob and restore Job PodSpecs. This enables pulling backup/restore images from authenticated registries without manual intervention.