Skip to content

Commit ca253fd

Browse files
committed
feat(23570): Add controller for workspace backup
A new backup controller orchestrates a backup process for workspace PVC. A new configuration option is added to DevWorkspaceOperatorConfig that enables running regular cronjob that is responsible for backup mechanism. The job executes following steps: - Find a workspaces - Finds out that workspace has been recently stopped - Detect a workspace PVC - Execute a job in the same namespace that does the backup The last step is currently not fully implemented as it requires running a buildah inside the container and it will be delivered as a separate feature. Issue: eclipse-che/che#23570 Signed-off-by: Ales Raszka <[email protected]>
1 parent e0ed8d2 commit ca253fd

File tree

10 files changed

+890
-1
lines changed

10 files changed

+890
-1
lines changed

apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ type CleanupCronJobConfig struct {
7272
Schedule string `json:"schedule,omitempty"`
7373
}
7474

75+
type BackupCronJobConfig struct {
76+
// Enable determines whether backup CronJobs should be created for workspace PVCs.
77+
// Defaults to false if not specified.
78+
// +kubebuilder:validation:Optional
79+
Enable *bool `json:"enable,omitempty"`
80+
// Schedule specifies the cron schedule for the backup cron job.
81+
// For example, "0 2 * * *" runs daily at 2 AM.
82+
// +kubebuilder:default:="0 2 * * *"
83+
// +kubebuilder:validation:Optional
84+
Schedule string `json:"schedule,omitempty"`
85+
}
86+
7587
type RoutingConfig struct {
7688
// DefaultRoutingClass specifies the routingClass to be used when a DevWorkspace
7789
// specifies an empty `.spec.routingClass`. Supported routingClasses can be defined
@@ -189,6 +201,8 @@ type WorkspaceConfig struct {
189201
RuntimeClassName *string `json:"runtimeClassName,omitempty"`
190202
// CleanupCronJobConfig defines configuration options for a cron job that automatically cleans up stale DevWorkspaces.
191203
CleanupCronJob *CleanupCronJobConfig `json:"cleanupCronJob,omitempty"`
204+
// BackupCronJobConfig defines configuration options for a cron job that automatically backs up workspace PVCs.
205+
BackupCronJob *BackupCronJobConfig `json:"backupCronJob,omitempty"`
192206
// PostStartTimeout defines the maximum duration the PostStart hook can run
193207
// before it is automatically failed. This timeout is used for the postStart lifecycle hook
194208
// that is used to run commands in the workspace container. The timeout is specified in seconds.

apis/controller/v1alpha1/zz_generated.deepcopy.go

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)