-
Notifications
You must be signed in to change notification settings - Fork 68
feat(23570): Add controller for workspace backup #1530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2080169
5428fb5
87d624d
24ce2c0
b5a427b
3726ab6
860219f
1765b4c
d9533a7
0f957f2
e5fc07f
24f510e
b84b069
f9297b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,27 @@ type CleanupCronJobConfig struct { | |
| Schedule string `json:"schedule,omitempty"` | ||
| } | ||
|
|
||
| type BackupCronJobConfig struct { | ||
tolusha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // Enable determines whether backup CronJobs should be created for workspace PVCs. | ||
| // Defaults to false if not specified. | ||
| // +kubebuilder:validation:Optional | ||
| Enable *bool `json:"enable,omitempty"` | ||
rohanKanojia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // Schedule specifies the cron schedule for the backup cron job. | ||
| // For example, "0 2 * * *" runs daily at 2 AM. | ||
| // +kubebuilder:default:="0 2 * * *" | ||
| // +kubebuilder:validation:Optional | ||
| Schedule string `json:"schedule,omitempty"` | ||
| // A registry where backup images are stored. Images are stored | ||
| // in {registry}/backup-${DEVWORKSPACE_NAMESPACE}-${DEVWORKSPACE_NAME} | ||
| // +kubebuilder:validation:Optional | ||
| Registry string `json:"registry,omitempty"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if registry is not public and requires authentication and/or certificate to access.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am currently working on the second phase of this feature, where I cover all the use cases, including authentication. I wanted to submit a PR as early as possible to get initial feedback. The auth part should be ready soon.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The registry authorization was added to the controller. You can check the latest commits.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you, I think it make sense to move Registry and RegistryAuthSecret to a dedicated structure |
||
|
|
||
| // RegistryAuthSecret is the name of a Kubernetes secret of | ||
| // type kubernetes.io/dockerconfigjson | ||
| // +kubebuilder:validation:Optional | ||
| RegistryAuthSecret string `json:"registryAuthSecret,omitempty"` | ||
| } | ||
|
|
||
| type RoutingConfig struct { | ||
| // DefaultRoutingClass specifies the routingClass to be used when a DevWorkspace | ||
| // specifies an empty `.spec.routingClass`. Supported routingClasses can be defined | ||
|
|
@@ -189,6 +210,8 @@ type WorkspaceConfig struct { | |
| RuntimeClassName *string `json:"runtimeClassName,omitempty"` | ||
| // CleanupCronJobConfig defines configuration options for a cron job that automatically cleans up stale DevWorkspaces. | ||
| CleanupCronJob *CleanupCronJobConfig `json:"cleanupCronJob,omitempty"` | ||
| // BackupCronJobConfig defines configuration options for a cron job that automatically backs up workspace PVCs. | ||
| BackupCronJob *BackupCronJobConfig `json:"backupCronJob,omitempty"` | ||
| // PostStartTimeout defines the maximum duration the PostStart hook can run | ||
| // before it is automatically failed. This timeout is used for the postStart lifecycle hook | ||
| // that is used to run commands in the workspace container. The timeout is specified in seconds. | ||
|
|
@@ -331,14 +354,26 @@ type ConfigmapReference struct { | |
| Namespace string `json:"namespace"` | ||
| } | ||
|
|
||
| type OperatorConfigurationStatus struct { | ||
| // Conditions represent the latest available observations of the OperatorConfiguration's state | ||
| Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
| // LastBackupTime is the timestamp of the last successful backup. Nil if | ||
| // no backup is configured or no backup has yet succeeded. | ||
| LastBackupTime *metav1.Time `json:"lastBackupTime,omitempty"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it time when backup is started or finished? |
||
| } | ||
|
|
||
| // DevWorkspaceOperatorConfig is the Schema for the devworkspaceoperatorconfigs API | ||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:subresource:status | ||
| // +kubebuilder:resource:path=devworkspaceoperatorconfigs,scope=Namespaced,shortName=dwoc | ||
| type DevWorkspaceOperatorConfig struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Config *OperatorConfiguration `json:"config,omitempty"` | ||
| // Status represents the current status of the DevWorkspaceOperatorConfig | ||
| // automatically managed by the DevWorkspace Operator. | ||
| Status *OperatorConfigurationStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // DevWorkspaceOperatorConfigList contains a list of DevWorkspaceOperatorConfig | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.