Skip to content
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

Add DevWorkspace Pruner (operator-lib/prune package) #1402

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@ type OperatorConfiguration struct {
EnableExperimentalFeatures *bool `json:"enableExperimentalFeatures,omitempty"`
}

type CleanupCronJobConfig struct {
// Enable determines whether the cleanup cron job is enabled.
// Defaults to false if not specified.
// +kubebuilder:validation:Optional
Enable *bool `json:"enable,omitempty"`
// RetainTime specifies the minimum time (in seconds) since a DevWorkspace was last started before it is considered stale and eligible for cleanup.
// For example, a value of 2592000 (30 days) would mean that any DevWorkspace that has not been started in the last 30 days will be deleted.
// Defaults to 2592000 seconds (30 days) if not specified.
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default:=2592000
// +kubebuilder:validation:Optional
RetainTime *int32 `json:"retainTime,omitempty"`
// DryRun determines whether the cleanup cron job should be run in dry-run mode.
// If set to true, the cron job will not delete any DevWorkspaces, but will log the DevWorkspaces that would have been deleted.
// Defaults to false if not specified.
// +kubebuilder:validation:Optional
DryRun *bool `json:"dryRun,omitempty"`
// Schedule specifies the cron schedule for the cleanup cron job.
// +kubebuilder:default:="0 0 1 * *"
// +kubebuilder:validation:Optional
Schedule string `json:"schedule,omitempty"`
}

type RoutingConfig struct {
// DefaultRoutingClass specifies the routingClass to be used when a DevWorkspace
// specifies an empty `.spec.routingClass`. Supported routingClasses can be defined
Expand Down Expand Up @@ -161,6 +184,8 @@ type WorkspaceConfig struct {
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
// RuntimeClassName defines the spec.runtimeClassName for DevWorkspace pods created by the DevWorkspace Operator.
RuntimeClassName *string `json:"runtimeClassName,omitempty"`
// CleanupCronJobConfig defines configuration options for a cron job that automatically cleans up stale DevWorkspaces.
CleanupCronJob *CleanupCronJobConfig `json:"cleanupCronJob,omitempty"`
}

type WebhookConfig struct {
Expand Down
35 changes: 35 additions & 0 deletions apis/controller/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading