| 1 |
/* |
| 2 |
Copyright The containerd Authors. |
| 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 service |
| 18 |
|
| 19 |
import ( |
| 20 |
"github.com/containerd/stargz-snapshotter/fs/config" |
| 21 |
"github.com/containerd/stargz-snapshotter/service/resolver" |
| 22 |
) |
| 23 |
|
| 24 |
type Config struct { |
| 25 |
config.Config |
| 26 |
|
| 27 |
// KubeconfigKeychainConfig is config for kubeconfig-based keychain. |
| 28 |
KubeconfigKeychainConfig `toml:"kubeconfig_keychain"` |
| 29 |
|
| 30 |
// CRIKeychainConfig is config for CRI-based keychain. |
| 31 |
CRIKeychainConfig `toml:"cri_keychain"` |
| 32 |
|
| 33 |
// ResolverConfig is config for resolving registries. |
| 34 |
ResolverConfig `toml:"resolver"` |
| 35 |
|
| 36 |
// SnapshotterConfig is snapshotter-related config. |
| 37 |
SnapshotterConfig `toml:"snapshotter"` |
| 38 |
} |
| 39 |
|
| 40 |
// KubeconfigKeychainConfig is config for kubeconfig-based keychain. |
| 41 |
type KubeconfigKeychainConfig struct { |
| 42 |
// EnableKeychain enables kubeconfig-based keychain |
| 43 |
EnableKeychain bool `toml:"enable_keychain"` |
| 44 |
|
| 45 |
// KubeconfigPath is the path to kubeconfig which can be used to sync |
| 46 |
// secrets on the cluster into this snapshotter. |
| 47 |
KubeconfigPath string `toml:"kubeconfig_path"` |
| 48 |
} |
| 49 |
|
| 50 |
// CRIKeychainConfig is config for CRI-based keychain. |
| 51 |
type CRIKeychainConfig struct { |
| 52 |
// EnableKeychain enables CRI-based keychain |
| 53 |
EnableKeychain bool `toml:"enable_keychain"` |
| 54 |
|
| 55 |
// ImageServicePath is the path to the unix socket of backing CRI Image Service (e.g. containerd CRI plugin) |
| 56 |
ImageServicePath string `toml:"image_service_path"` |
| 57 |
} |
| 58 |
|
| 59 |
// ResolverConfig is config for resolving registries. |
| 60 |
type ResolverConfig resolver.Config |
| 61 |
|
| 62 |
// SnapshotterConfig is snapshotter-related config. |
| 63 |
type SnapshotterConfig struct { |
| 64 |
// AllowInvalidMountsOnRestart allows that there are snapshot mounts that cannot access to the |
| 65 |
// data source when restarting the snapshotter. |
| 66 |
// NOTE: User needs to manually remove the snapshots from containerd's metadata store using |
| 67 |
// ctr (e.g. `ctr snapshot rm`). |
| 68 |
AllowInvalidMountsOnRestart bool `toml:"allow_invalid_mounts_on_restart"` |
| 69 |
} |