1 /* 2 Copyright 2017 The Kubernetes 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 config 18 19 import ( 20 "fmt" 21 22 "github.com/spf13/pflag" 23 ) 24 25 // ContainerRuntimeOptions defines options for the container runtime. 26 type ContainerRuntimeOptions struct { 27 // General Options. 28 29 // RuntimeCgroups that container runtime is expected to be isolated in. 30 RuntimeCgroups string 31 // PodSandboxImage is the image whose network/ipc namespaces 32 // containers in each pod will use. 33 PodSandboxImage string 34 // Image credential provider plugin options 35 36 // ImageCredentialProviderConfigFile is the path to the credential provider plugin config file. 37 // This config file is a specification for what credential providers are enabled and invoked 38 // by the kubelet. The plugin config should contain information about what plugin binary 39 // to execute and what container images the plugin should be called for. 40 // +optional 41 ImageCredentialProviderConfigFile string 42 // ImageCredentialProviderBinDir is the path to the directory where credential provider plugin 43 // binaries exist. The name of each plugin binary is expected to match the name of the plugin 44 // specified in imageCredentialProviderConfigFile. 45 // +optional 46 ImageCredentialProviderBinDir string 47 } 48 49 // AddFlags adds flags to the container runtime, according to ContainerRuntimeOptions. 50 func (s *ContainerRuntimeOptions) AddFlags(fs *pflag.FlagSet) { 51 // General settings. 52 fs.StringVar(&s.RuntimeCgroups, "runtime-cgroups", s.RuntimeCgroups, "Optional absolute name of cgroups to create and run the runtime in.") 53 fs.StringVar(&s.PodSandboxImage, "pod-infra-container-image", s.PodSandboxImage, fmt.Sprintf("Specified image will not be pruned by the image garbage collector. CRI implementations have their own configuration to set this image.")) 54 fs.MarkDeprecated("pod-infra-container-image", "will be removed in a future release. Image garbage collector will get sandbox image information from CRI.") 55 56 // Image credential provider settings. 57 fs.StringVar(&s.ImageCredentialProviderConfigFile, "image-credential-provider-config", s.ImageCredentialProviderConfigFile, "The path to the credential provider plugin config file.") 58 fs.StringVar(&s.ImageCredentialProviderBinDir, "image-credential-provider-bin-dir", s.ImageCredentialProviderBinDir, "The path to the directory where credential provider plugin binaries are located.") 59 } 60