Skip to content

Commit e8e70b4

Browse files
authored
feat(dvcr): auto-cleanup for dvcr storage (#1688)
1. feat(dvcr): add controller to cleanup registry on schedule (#1688) - Add dvcr-maintenance controller tht triggers on schedule and secret/dvcr-maintenance changes. - Sets Maintenance condition on deployment/dvcr with cleanup state. - Creates secret to start cleanup, deletes secret when cleanup is finished. - Add hook to switch deployment/dvcr into maintenance mode. - Add gc.schedule setting to specify schedule in the ModuleConfig. - Note: Garbage collection is disabled by default, set schedule explicitly in spec.settings.dvcr.gc.schedule to run cleanup periodically. 2. feat(api): postpone image operations until dvcr maintenance finishes (#1689) - Add postpone handler that runs before all other handlers. - VirtualDisk: postpone only disks with dataSource that requires import to dvcr first. - Add ProvisioningPostponed reason for Ready condition for vi/cvi/vd resources. 3. feat(core): add auto-cleanup and check commands for dvcr-cleaner (#1675) - dvcr-cleaner gc auto-cleanup — compares images in registry and in cluster, removes manifests not found in cluster, runs garbage collect on registry blobs. - dvcr-cleaner gc check — compares images in registry and in cluster and prints images eligible to cleanup. --------- Signed-off-by: Ivan Mikheykin <[email protected]>
1 parent 0f623b2 commit e8e70b4

File tree

50 files changed

+2866
-23
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2866
-23
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
Copyright 2025 Flant JSC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package dvcr_deployment_condition
18+
19+
import appsv1 "k8s.io/api/apps/v1"
20+
21+
const (
22+
// GarbageCollectionType indicates whether the deployment/dvcr is in garbage collection mode.
23+
GarbageCollectionType appsv1.DeploymentConditionType = "GarbageCollection"
24+
)
25+
26+
type (
27+
// GarbageCollectionReason represents the various reasons for the GarbageCollection condition type.
28+
GarbageCollectionReason string
29+
)
30+
31+
func (s GarbageCollectionReason) String() string {
32+
return string(s)
33+
}
34+
35+
const (
36+
// InProgress indicates that the garbage collection is in progress. (status "True")
37+
InProgress GarbageCollectionReason = "InProgress"
38+
39+
// Completed indicates that the garbage collection is done and result is in the message. (status "False")
40+
Completed GarbageCollectionReason = "Completed"
41+
42+
// Error indicates that the garbage collection was unsuccessful and error is in the message. (status "False")
43+
Error GarbageCollectionReason = "Error"
44+
)

api/core/v1alpha2/events.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ const (
104104
// ReasonDataSourceQuotaExceeded is event reason that DataSource sync is failed because quota exceed.
105105
ReasonDataSourceQuotaExceeded = "DataSourceQuotaExceed"
106106

107+
// ReasonImageOperationPostponedDueToDVCRGarbageCollection is event reason that operation is postponed until the end of DVCR garbage collection.
108+
ReasonImageOperationPostponedDueToDVCRGarbageCollection = "ImageOperationPostponedDueToDVCRGarbageCollection"
109+
// ReasonImageOperationContinueAfterDVCRGarbageCollection is event reason that operation is resumed after DVCR garbage collection is finished.
110+
ReasonImageOperationContinueAfterDVCRGarbageCollection = "ImageOperationContinueAfterDVCRGarbageCollection"
111+
107112
// ReasonDataSourceDiskProvisioningFailed is event reason that DataSource disk provisioning is failed.
108113
ReasonDataSourceDiskProvisioningFailed = "DataSourceImportDiskProvisioningFailed"
109114

0 commit comments

Comments
 (0)