Skip to content

Add imagePullSecrets support to JobConfig for backup and restore jobs - #887

Merged
yoheinbb merged 5 commits into
mainfrom
issue-848
Sep 30, 2026
Merged

yoheinbb merged 5 commits into
mainfrom
issue-848

Conversation

@shunki-fujita

Copy link
Copy Markdown
Contributor

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ImagePullSecrets field to JobConfig API type
  • Propagated imagePullSecrets to 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>
@shunki-fujita
shunki-fujita marked this pull request as ready for review February 18, 2026 05:05
arosh
arosh previously requested changes Feb 24, 2026
Comment thread api/v1beta2/job_types.go Outdated
Signed-off-by: shunki-fujita <shunki-fujita@cybozu.co.jp>
@arosh
arosh dismissed their stale review February 27, 2026 07:46

I have no more changing requests.

Comment thread controllers/mysqlcluster_controller_test.go Outdated
Follow the main branch, which has moved to Go 1.26's new(expr) builtin
and dropped the redundant loop variable copies. Regenerate the CRD
manifests with the updated controller-gen so that the description of
LocalObjectReference.name is included.

Signed-off-by: shunki-fujita <shunki-fujita@cybozu.co.jp>
@yoheinbb

Copy link
Copy Markdown
Contributor

LGTM

@yoheinbb
yoheinbb merged commit 4cfd341 into main Sep 30, 2026
21 checks passed
@yoheinbb
yoheinbb deleted the issue-848 branch September 30, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for imagePullSecrets for Backup and Restore

4 participants