-
Notifications
You must be signed in to change notification settings - Fork 20
/
types.go
85 lines (71 loc) · 2.95 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package registry
import (
"time"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// RegistryConfig contains information about registry caches to deploy.
type RegistryConfig struct {
metav1.TypeMeta
// Caches is a slice of registry caches to deploy.
Caches []RegistryCache
}
// RegistryCache represents a registry cache to deploy.
type RegistryCache struct {
// Upstream is the remote registry host to cache.
// The value must be a valid DNS subdomain (RFC 1123) and optionally a port.
Upstream string
// RemoteURL is the remote registry URL. The format must be `<scheme><host>[:<port>]` where
// `<scheme>` is `https://` or `http://` and `<host>[:<port>]` corresponds to the Upstream
//
// If defined, the value is set as `proxy.remoteurl` in the registry [configuration](https://github.com/distribution/distribution/blob/main/docs/content/recipes/mirror.md#configure-the-cache)
// and in containerd configuration as `server` field in [hosts.toml](https://github.com/containerd/containerd/blob/main/docs/hosts.md#server-field) file.
RemoteURL *string
// Volume contains settings for the registry cache volume.
Volume *Volume
// GarbageCollection contains settings for the garbage collection of content from the cache.
GarbageCollection *GarbageCollection
// SecretReferenceName is the name of the reference for the Secret containing the upstream registry credentials
SecretReferenceName *string
}
// Volume contains settings for the registry cache volume.
type Volume struct {
// Size is the size of the registry cache volume.
// Defaults to 10Gi.
// This field is immutable.
Size *resource.Quantity
// StorageClassName is the name of the StorageClass used by the registry cache volume.
// This field is immutable.
StorageClassName *string
}
// GarbageCollection contains settings for the garbage collection of content from the cache.
type GarbageCollection struct {
// TTL is the time to live of a blob in the cache.
// Set to 0s to disable the garbage collection.
TTL metav1.Duration
}
var (
// DefaultTTL is the default time to live of a blob in the cache.
DefaultTTL = metav1.Duration{Duration: 7 * 24 * time.Hour}
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// RegistryStatus contains information about deployed registry caches.
type RegistryStatus struct {
metav1.TypeMeta
// Caches is a slice of deployed registry caches.
Caches []RegistryCacheStatus
}
// RegistryCacheStatus represents a deployed registry cache.
type RegistryCacheStatus struct {
// Upstream is the remote registry host (and optionally port).
Upstream string
// Endpoint is the registry cache endpoint.
// Example: "http://10.4.246.205:5000"
Endpoint string
// RemoteURL is the remote registry URL.
RemoteURL string
}