mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
Moved getSecurityOpts() function to OS specific manager variant
This commit is contained in:
parent
9ef35289e4
commit
a659ac99b6
@ -1113,23 +1113,6 @@ func (dm *DockerManager) fmtDockerOpts(opts []dockerOpt) ([]string, error) {
|
|||||||
return fmtOpts, nil
|
return fmtOpts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dm *DockerManager) getSecurityOpts(pod *api.Pod, ctrName string) ([]dockerOpt, error) {
|
|
||||||
var securityOpts []dockerOpt
|
|
||||||
if seccompOpts, err := dm.getSeccompOpts(pod, ctrName); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
securityOpts = append(securityOpts, seccompOpts...)
|
|
||||||
}
|
|
||||||
|
|
||||||
if appArmorOpts, err := dm.getAppArmorOpts(pod, ctrName); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
securityOpts = append(securityOpts, appArmorOpts...)
|
|
||||||
}
|
|
||||||
|
|
||||||
return securityOpts, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type dockerOpt struct {
|
type dockerOpt struct {
|
||||||
// The key-value pair passed to docker.
|
// The key-value pair passed to docker.
|
||||||
key, value string
|
key, value string
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package dockertools
|
package dockertools
|
||||||
|
|
||||||
import dockertypes "github.com/docker/engine-api/types"
|
import (
|
||||||
|
dockertypes "github.com/docker/engine-api/types"
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
)
|
||||||
|
|
||||||
func getContainerIP(container *dockertypes.ContainerJSON) string {
|
func getContainerIP(container *dockertypes.ContainerJSON) string {
|
||||||
result := ""
|
result := ""
|
||||||
@ -22,3 +25,21 @@ func getNetworkingMode() string { return "" }
|
|||||||
func containerProvidesPodIP(name *KubeletContainerName) bool {
|
func containerProvidesPodIP(name *KubeletContainerName) bool {
|
||||||
return name.ContainerName == PodInfraContainerName
|
return name.ContainerName == PodInfraContainerName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns Seccomp and AppArmor Security options
|
||||||
|
func (dm *DockerManager) getSecurityOpts(pod *api.Pod, ctrName string) ([]dockerOpt, error) {
|
||||||
|
var securityOpts []dockerOpt
|
||||||
|
if seccompOpts, err := dm.getSeccompOpts(pod, ctrName); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
securityOpts = append(securityOpts, seccompOpts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
if appArmorOpts, err := dm.getAppArmorOpts(pod, ctrName); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
securityOpts = append(securityOpts, appArmorOpts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
return securityOpts, nil
|
||||||
|
}
|
||||||
|
@ -3,6 +3,8 @@ package dockertools
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
|
||||||
dockertypes "github.com/docker/engine-api/types"
|
dockertypes "github.com/docker/engine-api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,3 +33,8 @@ func getNetworkingMode() string {
|
|||||||
func containerProvidesPodIP(name *KubeletContainerName) bool {
|
func containerProvidesPodIP(name *KubeletContainerName) bool {
|
||||||
return name.ContainerName != PodInfraContainerName
|
return name.ContainerName != PodInfraContainerName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns nil as both Seccomp and AppArmor security options are not valid on Windows
|
||||||
|
func (dm *DockerManager) getSecurityOpts(pod *api.Pod, ctrName string) ([]dockerOpt, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user