Skip to content

Commit 563edef

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#55983 from mtaufen/seccomp-is-alpha
Automatic merge from submit-queue (batch tested with PRs 55839, 54495, 55884, 55983, 56069). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. seccomp is an alpha feature and not feature gated Move SeccompProfileRoot to KubeletFlags and document flag as alpha. wrt kubernetes#53833 (comment), seccomp is an alpha feature, but this isn't clearly documented anywhere (the annotation just has the word "alpha" in it, and that's your signal that it's alpha). Since seccomp was around before feature gates, it doesn't have one. Thus SeccompProfileRoot should not be part of KubeletConfiguration, and this PR moves it to KubeletFlags, and amends the help text to note the alpha state of the feature. fixes: kubernetes#56087 ```release-note NONE ```
2 parents 0b1d023 + ca8cffe commit 563edef

File tree

9 files changed

+16
-19
lines changed

9 files changed

+16
-19
lines changed

cmd/kubelet/app/options/options.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package options
2020
import (
2121
"fmt"
2222
_ "net/http/pprof"
23+
"path/filepath"
2324
"runtime"
2425
"strings"
2526

@@ -154,6 +155,8 @@ type KubeletFlags struct {
154155
// This will cause the kubelet to listen to inotify events on the lock file,
155156
// releasing it and exiting when another process tries to open that file.
156157
ExitOnLockContention bool
158+
// seccompProfileRoot is the directory path for seccomp profiles.
159+
SeccompProfileRoot string
157160

158161
// DEPRECATED FLAGS
159162
// minimumGCAge is the minimum age for a finished container before it is
@@ -214,6 +217,7 @@ func NewKubeletFlags() *KubeletFlags {
214217
NodeLabels: make(map[string]string),
215218
VolumePluginDir: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/",
216219
RegisterNode: true,
220+
SeccompProfileRoot: filepath.Join(v1alpha1.DefaultRootDir, "seccomp"),
217221
}
218222
}
219223

@@ -338,6 +342,7 @@ func (f *KubeletFlags) AddFlags(fs *pflag.FlagSet) {
338342
fs.StringVar(&f.VolumePluginDir, "volume-plugin-dir", f.VolumePluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for additional third party volume plugins")
339343
fs.StringVar(&f.LockFilePath, "lock-file", f.LockFilePath, "<Warning: Alpha feature> The path to file for kubelet to use as a lock file.")
340344
fs.BoolVar(&f.ExitOnLockContention, "exit-on-lock-contention", f.ExitOnLockContention, "Whether kubelet should exit upon lock-file contention.")
345+
fs.StringVar(&f.SeccompProfileRoot, "seccomp-profile-root", f.SeccompProfileRoot, "<Warning: Alpha feature> Directory path for seccomp profiles.")
341346

342347
// DEPRECATED FLAGS
343348
fs.DurationVar(&f.MinimumGCAge.Duration, "minimum-container-ttl-duration", f.MinimumGCAge.Duration, "Minimum age for a finished container before it is garbage collected. Examples: '300ms', '10s' or '2h45m'")
@@ -405,7 +410,6 @@ func AddKubeletConfigFlags(fs *pflag.FlagSet, c *kubeletconfig.KubeletConfigurat
405410
"are generated for the public address and saved to the directory passed to --cert-dir.")
406411
fs.StringVar(&c.TLSPrivateKeyFile, "tls-private-key-file", c.TLSPrivateKeyFile, "File containing x509 private key matching --tls-cert-file.")
407412

408-
fs.StringVar(&c.SeccompProfileRoot, "seccomp-profile-root", c.SeccompProfileRoot, "Directory path for seccomp profiles.")
409413
fs.BoolVar(&c.AllowPrivileged, "allow-privileged", c.AllowPrivileged, "If true, allow containers to request privileged mode.")
410414
fs.StringSliceVar(&c.HostNetworkSources, "host-network-sources", c.HostNetworkSources, "Comma-separated list of sources from which the Kubelet allows pods to use of host network.")
411415
fs.StringSliceVar(&c.HostPIDSources, "host-pid-sources", c.HostPIDSources, "Comma-separated list of sources from which the Kubelet allows pods to use the host pid namespace.")

cmd/kubelet/app/server.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,8 @@ func RunKubelet(kubeFlags *options.KubeletFlags, kubeCfg *kubeletconfiginternal.
728728
kubeFlags.RegisterSchedulable,
729729
kubeFlags.NonMasqueradeCIDR,
730730
kubeFlags.KeepTerminatedPodVolumes,
731-
kubeFlags.NodeLabels)
731+
kubeFlags.NodeLabels,
732+
kubeFlags.SeccompProfileRoot)
732733
if err != nil {
733734
return fmt.Errorf("failed to create kubelet: %v", err)
734735
}
@@ -800,7 +801,8 @@ func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
800801
registerSchedulable bool,
801802
nonMasqueradeCIDR string,
802803
keepTerminatedPodVolumes bool,
803-
nodeLabels map[string]string) (k kubelet.Bootstrap, err error) {
804+
nodeLabels map[string]string,
805+
seccompProfileRoot string) (k kubelet.Bootstrap, err error) {
804806
// TODO: block until all sources have delivered at least one update to the channel, or break the sync loop
805807
// up into "per source" synchronizations
806808

@@ -832,7 +834,8 @@ func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
832834
registerSchedulable,
833835
nonMasqueradeCIDR,
834836
keepTerminatedPodVolumes,
835-
nodeLabels)
837+
nodeLabels,
838+
seccompProfileRoot)
836839
if err != nil {
837840
return nil, err
838841
}

pkg/kubelet/apis/kubeletconfig/helpers.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ func KubeletConfigurationPathRefs(kc *KubeletConfiguration) []*string {
2525
paths = append(paths, &kc.Authentication.X509.ClientCAFile)
2626
paths = append(paths, &kc.TLSCertFile)
2727
paths = append(paths, &kc.TLSPrivateKeyFile)
28-
paths = append(paths, &kc.SeccompProfileRoot)
2928
paths = append(paths, &kc.ResolverConfig)
3029
return paths
3130
}

pkg/kubelet/apis/kubeletconfig/helpers_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ var (
132132
"Authentication.X509.ClientCAFile",
133133
"TLSCertFile",
134134
"TLSPrivateKeyFile",
135-
"SeccompProfileRoot",
136135
"ResolverConfig",
137136
)
138137

pkg/kubelet/apis/kubeletconfig/types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ type KubeletConfiguration struct {
8989
Authentication KubeletAuthentication
9090
// authorization specifies how requests to the Kubelet's server are authorized
9191
Authorization KubeletAuthorization
92-
// seccompProfileRoot is the directory path for seccomp profiles.
93-
SeccompProfileRoot string
9492
// allowPrivileged enables containers to request privileged mode.
9593
// Defaults to false.
9694
AllowPrivileged bool

pkg/kubelet/apis/kubeletconfig/v1alpha1/defaults.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20-
"path/filepath"
2120
"time"
2221

2322
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -177,9 +176,6 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
177176
if obj.SerializeImagePulls == nil {
178177
obj.SerializeImagePulls = boolVar(true)
179178
}
180-
if obj.SeccompProfileRoot == "" {
181-
obj.SeccompProfileRoot = filepath.Join(DefaultRootDir, "seccomp")
182-
}
183179
if obj.StreamingConnectionIdleTimeout == zeroDuration {
184180
obj.StreamingConnectionIdleTimeout = metav1.Duration{Duration: 4 * time.Hour}
185181
}

pkg/kubelet/apis/kubeletconfig/v1alpha1/types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ type KubeletConfiguration struct {
8989
Authentication KubeletAuthentication `json:"authentication"`
9090
// authorization specifies how requests to the Kubelet's server are authorized
9191
Authorization KubeletAuthorization `json:"authorization"`
92-
// seccompProfileRoot is the directory path for seccomp profiles.
93-
SeccompProfileRoot string `json:"seccompProfileRoot"`
9492
// allowPrivileged enables containers to request privileged mode.
9593
// Defaults to false.
9694
AllowPrivileged *bool `json:"allowPrivileged"`

pkg/kubelet/apis/kubeletconfig/v1alpha1/zz_generated.conversion.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/kubelet/kubelet.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ type Builder func(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
217217
registerSchedulable bool,
218218
nonMasqueradeCIDR string,
219219
keepTerminatedPodVolumes bool,
220-
nodeLabels map[string]string) (Bootstrap, error)
220+
nodeLabels map[string]string,
221+
seccompProfileRoot string) (Bootstrap, error)
221222

222223
// Dependencies is a bin for things we might consider "injected dependencies" -- objects constructed
223224
// at runtime that are necessary for running the Kubelet. This is a temporary solution for grouping
@@ -343,7 +344,8 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
343344
registerSchedulable bool,
344345
nonMasqueradeCIDR string,
345346
keepTerminatedPodVolumes bool,
346-
nodeLabels map[string]string) (*Kubelet, error) {
347+
nodeLabels map[string]string,
348+
seccompProfileRoot string) (*Kubelet, error) {
347349
if rootDirectory == "" {
348350
return nil, fmt.Errorf("invalid root directory %q", rootDirectory)
349351
}
@@ -657,7 +659,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
657659
runtime, err := kuberuntime.NewKubeGenericRuntimeManager(
658660
kubecontainer.FilterEventRecorder(kubeDeps.Recorder),
659661
klet.livenessManager,
660-
kubeCfg.SeccompProfileRoot,
662+
seccompProfileRoot,
661663
containerRefManager,
662664
machineInfo,
663665
klet,

0 commit comments

Comments
 (0)