Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3808243b
Unverified
Commit
3808243b
authored
Aug 29, 2016
by
Tim St. Clair
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Append "AppArmor enabled" to the Node ready condition message
parent
d0a2d17e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
4 deletions
+21
-4
kubelet.go
pkg/kubelet/kubelet.go
+6
-1
kubelet_node_status.go
pkg/kubelet/kubelet_node_status.go
+7
-0
handlers.go
pkg/kubelet/lifecycle/handlers.go
+2
-2
validate.go
pkg/security/apparmor/validate.go
+6
-1
No files found.
pkg/kubelet/kubelet.go
View file @
3808243b
...
@@ -77,6 +77,7 @@ import (
...
@@ -77,6 +77,7 @@ import (
"k8s.io/kubernetes/pkg/kubelet/util/sliceutils"
"k8s.io/kubernetes/pkg/kubelet/util/sliceutils"
"k8s.io/kubernetes/pkg/kubelet/volumemanager"
"k8s.io/kubernetes/pkg/kubelet/volumemanager"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/security/apparmor"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/bandwidth"
"k8s.io/kubernetes/pkg/util/bandwidth"
"k8s.io/kubernetes/pkg/util/clock"
"k8s.io/kubernetes/pkg/util/clock"
...
@@ -736,7 +737,8 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
...
@@ -736,7 +737,8 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
klet
.
AddPodSyncLoopHandler
(
activeDeadlineHandler
)
klet
.
AddPodSyncLoopHandler
(
activeDeadlineHandler
)
klet
.
AddPodSyncHandler
(
activeDeadlineHandler
)
klet
.
AddPodSyncHandler
(
activeDeadlineHandler
)
klet
.
AddPodAdmitHandler
(
lifecycle
.
NewAppArmorAdmitHandler
(
kubeCfg
.
ContainerRuntime
))
klet
.
appArmorValidator
=
apparmor
.
NewValidator
(
kubeCfg
.
ContainerRuntime
)
klet
.
AddPodAdmitHandler
(
lifecycle
.
NewAppArmorAdmitHandler
(
klet
.
appArmorValidator
))
// apply functional Option's
// apply functional Option's
for
_
,
opt
:=
range
kubeDeps
.
Options
{
for
_
,
opt
:=
range
kubeDeps
.
Options
{
...
@@ -1041,6 +1043,9 @@ type Kubelet struct {
...
@@ -1041,6 +1043,9 @@ type Kubelet struct {
// The bit of the fwmark space to mark packets for dropping.
// The bit of the fwmark space to mark packets for dropping.
iptablesDropBit
int
iptablesDropBit
int
// The AppArmor validator for checking whether AppArmor is supported.
appArmorValidator
apparmor
.
Validator
}
}
// setupDataDirs creates:
// setupDataDirs creates:
...
...
pkg/kubelet/kubelet_node_status.go
View file @
3808243b
...
@@ -489,6 +489,13 @@ func (kl *Kubelet) setNodeReadyCondition(node *api.Node) {
...
@@ -489,6 +489,13 @@ func (kl *Kubelet) setNodeReadyCondition(node *api.Node) {
}
}
}
}
// Append AppArmor status if it's enabled.
// TODO(timstclair): This is a temporary message until node feature reporting is added.
if
newNodeReadyCondition
.
Status
==
api
.
ConditionTrue
&&
kl
.
appArmorValidator
!=
nil
&&
kl
.
appArmorValidator
.
ValidateHost
()
==
nil
{
newNodeReadyCondition
.
Message
=
fmt
.
Sprintf
(
"%s. AppArmor enabled"
,
newNodeReadyCondition
.
Message
)
}
// Record any soft requirements that were not met in the container manager.
// Record any soft requirements that were not met in the container manager.
status
:=
kl
.
containerManager
.
Status
()
status
:=
kl
.
containerManager
.
Status
()
if
status
.
SoftRequirements
!=
nil
{
if
status
.
SoftRequirements
!=
nil
{
...
...
pkg/kubelet/lifecycle/handlers.go
View file @
3808243b
...
@@ -144,9 +144,9 @@ func getHttpRespBody(resp *http.Response) string {
...
@@ -144,9 +144,9 @@ func getHttpRespBody(resp *http.Response) string {
return
""
return
""
}
}
func
NewAppArmorAdmitHandler
(
runtime
string
)
PodAdmitHandler
{
func
NewAppArmorAdmitHandler
(
validator
apparmor
.
Validator
)
PodAdmitHandler
{
return
&
appArmorAdmitHandler
{
return
&
appArmorAdmitHandler
{
Validator
:
apparmor
.
NewValidator
(
runtime
)
,
Validator
:
validator
,
}
}
}
}
...
...
pkg/security/apparmor/validate.go
View file @
3808243b
...
@@ -37,6 +37,7 @@ var isDisabledBuild bool
...
@@ -37,6 +37,7 @@ var isDisabledBuild bool
// Interface for validating that a pod with with an AppArmor profile can be run by a Node.
// Interface for validating that a pod with with an AppArmor profile can be run by a Node.
type
Validator
interface
{
type
Validator
interface
{
Validate
(
pod
*
api
.
Pod
)
error
Validate
(
pod
*
api
.
Pod
)
error
ValidateHost
()
error
}
}
func
NewValidator
(
runtime
string
)
Validator
{
func
NewValidator
(
runtime
string
)
Validator
{
...
@@ -64,7 +65,7 @@ func (v *validator) Validate(pod *api.Pod) error {
...
@@ -64,7 +65,7 @@ func (v *validator) Validate(pod *api.Pod) error {
return
nil
return
nil
}
}
if
v
.
validateHostErr
!=
nil
{
if
v
.
ValidateHost
()
!=
nil
{
return
v
.
validateHostErr
return
v
.
validateHostErr
}
}
...
@@ -87,6 +88,10 @@ func (v *validator) Validate(pod *api.Pod) error {
...
@@ -87,6 +88,10 @@ func (v *validator) Validate(pod *api.Pod) error {
return
nil
return
nil
}
}
func
(
v
*
validator
)
ValidateHost
()
error
{
return
v
.
validateHostErr
}
// Verify that the host and runtime is capable of enforcing AppArmor profiles.
// Verify that the host and runtime is capable of enforcing AppArmor profiles.
func
validateHost
(
runtime
string
)
error
{
func
validateHost
(
runtime
string
)
error
{
// Check feature-gates
// Check feature-gates
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment