Debian Codegraph @

buildkit/cmd/buildkitd/config/config.go

raw symbols SCIP
1 package config
2
3 import (
4 resolverconfig "github.com/moby/buildkit/util/resolver/config"
5 )
6
7 // Config provides containerd configuration data for the server
8 type Config struct {
9 Debug bool `toml:"debug"`
10 Trace bool `toml:"trace"`
11
12 // Root is the path to a directory where buildkit will store persistent data
13 Root string `toml:"root"`
14
15 // Entitlements e.g. security.insecure, network.host, device
16 Entitlements []string `toml:"insecure-entitlements"`
17
18 // LogFormat is the format of the logs. It can be "json" or "text".
19 Log LogConfig `toml:"log"`
20
21 // GRPC configuration settings
22 GRPC GRPCConfig `toml:"grpc"`
23
24 OTEL OTELConfig `toml:"otel"`
25
26 CDI CDIConfig `toml:"cdi"`
27
28 Workers struct {
29 OCI OCIConfig `toml:"oci"`
30 Containerd ContainerdConfig `toml:"containerd"`
31 } `toml:"worker"`
32
33 Registries map[string]resolverconfig.RegistryConfig `toml:"registry"`
34
35 DNS *DNSConfig `toml:"dns"`
36
37 History *HistoryConfig `toml:"history"`
38
39 Frontends struct {
40 Dockerfile DockerfileFrontendConfig `toml:"dockerfile.v0"`
41 Gateway GatewayFrontendConfig `toml:"gateway.v0"`
42 } `toml:"frontend"`
43
44 System *SystemConfig `toml:"system"`
45
46 // ProvenanceEnvDir is the directory where extra config is loaded
47 // that is added to the provenance of builds. Defaults to /etc/buildkit/provenance.d/ ,
48 ProvenanceEnvDir string `toml:"provenanceEnvDir"`
49 }
50
51 type SystemConfig struct {
52 // PlatformCacheMaxAge controls how often supported platforms
53 // are refreshed by rescanning the system.
54 PlatformsCacheMaxAge *Duration `toml:"platformsCacheMaxAge"`
55 }
56
57 type LogConfig struct {
58 Format string `toml:"format"`
59 }
60
61 type GRPCConfig struct {
62 Address []string `toml:"address"`
63 DebugAddress string `toml:"debugAddress"`
64 UID *int `toml:"uid"`
65 GID *int `toml:"gid"`
66 SecurityDescriptor string `toml:"securityDescriptor"`
67
68 TLS TLSConfig `toml:"tls"`
69 // MaxRecvMsgSize int `toml:"max_recv_message_size"`
70 // MaxSendMsgSize int `toml:"max_send_message_size"`
71 }
72
73 type TLSConfig struct {
74 Cert string `toml:"cert"`
75 Key string `toml:"key"`
76 CA string `toml:"ca"`
77 }
78
79 type OTELConfig struct {
80 SocketPath string `toml:"socketPath"`
81 }
82
83 type CDIConfig struct {
84 Disabled *bool `toml:"disabled"`
85 SpecDirs []string `toml:"specDirs"`
86 AutoAllowed []string `toml:"autoAllowed"`
87 }
88
89 type GCConfig struct {
90 GC *bool `toml:"gc"`
91 // Deprecated: use GCReservedSpace instead
92 GCKeepStorage DiskSpace `toml:"gckeepstorage"`
93 GCReservedSpace DiskSpace `toml:"reservedSpace"`
94 GCMaxUsedSpace DiskSpace `toml:"maxUsedSpace"`
95 GCMinFreeSpace DiskSpace `toml:"minFreeSpace"`
96 GCPolicy []GCPolicy `toml:"gcpolicy"`
97 }
98
99 type NetworkConfig struct {
100 Mode string `toml:"networkMode"`
101 CNIConfigPath string `toml:"cniConfigPath"`
102 CNIBinaryPath string `toml:"cniBinaryPath"`
103 CNIPoolSize int `toml:"cniPoolSize"`
104 BridgeName string `toml:"bridgeName"`
105 BridgeSubnet string `toml:"bridgeSubnet"`
106 }
107
108 type OCIConfig struct {
109 Enabled *bool `toml:"enabled"`
110 Labels map[string]string `toml:"labels"`
111 Platforms []string `toml:"platforms,omitempty"`
112 Snapshotter string `toml:"snapshotter"`
113 Rootless bool `toml:"rootless"`
114 NoProcessSandbox bool `toml:"noProcessSandbox"`
115 GCConfig
116 NetworkConfig
117 // UserRemapUnsupported is unsupported key for testing. The feature is
118 // incomplete and the intention is to make it default without config.
119 UserRemapUnsupported string `toml:"userRemapUnsupported"`
120 // For use in storing the OCI worker binary name that will replace buildkit-runc
121 Binary string `toml:"binary"`
122 ProxySnapshotterPath string `toml:"proxySnapshotterPath"`
123 DefaultCgroupParent string `toml:"defaultCgroupParent"`
124
125 // StargzSnapshotterConfig is configuration for stargz snapshotter.
126 // We use a generic map[string]interface{} in order to remove the dependency
127 // on stargz snapshotter's config pkg from our config.
128 StargzSnapshotterConfig map[string]any `toml:"stargzSnapshotter"`
129
130 // ApparmorProfile is the name of the apparmor profile that should be used to constrain build containers.
131 // The profile should already be loaded (by a higher level system) before creating a worker.
132 ApparmorProfile string `toml:"apparmor-profile"`
133
134 // SELinux enables applying SELinux labels.
135 SELinux bool `toml:"selinux"`
136
137 // MaxParallelism is the maximum number of parallel build steps that can be run at the same time.
138 MaxParallelism int `toml:"max-parallelism"`
139 }
140
141 type ContainerdConfig struct {
142 Address string `toml:"address"`
143 Enabled *bool `toml:"enabled"`
144 Labels map[string]string `toml:"labels"`
145 Platforms []string `toml:"platforms,omitempty"`
146 Namespace string `toml:"namespace"`
147 Runtime ContainerdRuntime `toml:"runtime"`
148 GCConfig
149 NetworkConfig
150 Snapshotter string `toml:"snapshotter"`
151
152 // ApparmorProfile is the name of the apparmor profile that should be used to constrain build containers.
153 // The profile should already be loaded (by a higher level system) before creating a worker.
154 ApparmorProfile string `toml:"apparmor-profile"`
155
156 // SELinux enables applying SELinux labels.
157 SELinux bool `toml:"selinux"`
158
159 MaxParallelism int `toml:"max-parallelism"`
160
161 DefaultCgroupParent string `toml:"defaultCgroupParent"`
162
163 Rootless bool `toml:"rootless"`
164 }
165
166 type ContainerdRuntime struct {
167 Name string `toml:"name"`
168 Path string `toml:"path"`
169 Options map[string]any `toml:"options"`
170 }
171
172 type GCPolicy struct {
173 All bool `toml:"all"`
174 Filters []string `toml:"filters"`
175
176 KeepDuration Duration `toml:"keepDuration"`
177
178 // KeepBytes is the maximum amount of storage this policy is ever allowed
179 // to consume. Any storage above this mark can be cleared during a gc
180 // sweep.
181 //
182 // Deprecated: use ReservedSpace instead
183 KeepBytes DiskSpace `toml:"keepBytes"`
184
185 // ReservedSpace is the minimum amount of disk space this policy is guaranteed to retain.
186 // Any usage below this threshold will not be reclaimed during garbage collection.
187 ReservedSpace DiskSpace `toml:"reservedSpace"`
188
189 // MaxUsedSpace is the maximum amount of disk space this policy is allowed to use.
190 // Any usage exceeding this limit will be cleaned up during a garbage collection sweep.
191 MaxUsedSpace DiskSpace `toml:"maxUsedSpace"`
192
193 // MinFreeSpace is the target amount of free disk space the garbage collector will attempt to leave.
194 // However, it will never let the available space fall below ReservedSpace.
195 MinFreeSpace DiskSpace `toml:"minFreeSpace"`
196 }
197
198 type DNSConfig struct {
199 Nameservers []string `toml:"nameservers"`
200 Options []string `toml:"options"`
201 SearchDomains []string `toml:"searchDomains"`
202 }
203
204 type HistoryConfig struct {
205 MaxAge Duration `toml:"maxAge"`
206 MaxEntries int64 `toml:"maxEntries"`
207 }
208
209 type DockerfileFrontendConfig struct {
210 Enabled *bool `toml:"enabled"`
211 }
212
213 type GatewayFrontendConfig struct {
214 Enabled *bool `toml:"enabled"`
215 AllowedRepositories []string `toml:"allowedRepositories"`
216 }