Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
kube-bench
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
aquasecurity
kube-bench
Commits
6ce0c5bf
Commit
6ce0c5bf
authored
7 years ago
by
Abubakr-Sadik Nii Nai Davis
Browse files
Options
Downloads
Patches
Plain Diff
Add function to get pod specs for kubernetes components.
parent
8e758bb5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cfg/config.yaml
+16
-4
16 additions, 4 deletions
cfg/config.yaml
cmd/common.go
+2
-0
2 additions, 0 deletions
cmd/common.go
cmd/util.go
+31
-0
31 additions, 0 deletions
cmd/util.go
with
49 additions
and
4 deletions
cfg/config.yaml
+
16
−
4
View file @
6ce0c5bf
...
...
@@ -26,42 +26,54 @@ master:
-
"
hyperkube
apiserver"
-
"
apiserver"
confs
:
-
/etc/kubernetes/manifests/kube-apiserver.yaml
-
/etc/kubernetes/apiserver.conf
-
/etc/kubernetes/apiserver
defaultconf
:
/etc/kubernetes/apiserver
podspecs
:
-
/etc/kubernetes/manifests/kube-apiserver.yaml
defaultpodspec
:
/etc/kubernetes/manifests/kube-apiserver.yaml
scheduler
:
bins
:
-
"
kube-scheduler"
-
"
hyperkube
scheduler"
-
"
scheduler"
confs
:
-
/etc/kubernetes/manifests/kube-scheduler.yaml
-
/etc/kubernetes/scheduler.conf
-
/etc/kubernetes/scheduler
defaultconf
:
/etc/kubernetes/scheduler
podspecs
:
-
/etc/kubernetes/manifests/kube-scheduler.yaml
defaultpodspec
:
/etc/kubernetes/manifests/kube-scheduler.yaml
controllermanager
:
bins
:
-
"
kube-controller-manager"
-
"
hyperkube
controller-manager"
-
"
controller-manager"
confs
:
-
/etc/kubernetes/manifests/kube-controller-manager.yaml
-
/etc/kubernetes/controller-manager.conf
-
/etc/kubernetes/controller-manager
defaultconf
:
/etc/kubernetes/controller-manager
podspecs
:
-
/etc/kubernetes/manifests/kube-controller-manager.yaml
defaultpodspec
:
/etc/kubernetes/manifests/kube-controller-manager.yaml
etcd
:
optional
:
true
bins
:
-
"
etcd"
confs
:
-
/etc/kubernetes/manifests/etcd.yaml
-
/etc/etcd/etcd.conf
defaultconf
:
/etc/etcd/etcd.conf
podspecs
:
-
/etc/kubernetes/manifests/etcd.yaml
defaultpodspec
:
/etc/kubernetes/manifests/etcd.yaml
flanneld
:
optional
:
true
bins
:
...
...
This diff is collapsed.
Click to expand it.
cmd/common.go
+
2
−
0
View file @
6ce0c5bf
...
...
@@ -67,6 +67,7 @@ func runChecks(t check.NodeType) {
// checks that the executables we need for the node type are running.
binmap
:=
getBinaries
(
typeConf
)
confmap
:=
getConfigFiles
(
typeConf
)
podspecmap
:=
getPodSpecFiles
(
typeConf
)
switch
t
{
case
check
.
MASTER
:
...
...
@@ -88,6 +89,7 @@ func runChecks(t check.NodeType) {
s
:=
string
(
in
)
s
=
makeSubstitutions
(
s
,
"bin"
,
binmap
)
s
=
makeSubstitutions
(
s
,
"conf"
,
confmap
)
s
=
makeSubstitutions
(
s
,
"podspec"
,
podspecmap
)
glog
.
V
(
1
)
.
Info
(
fmt
.
Sprintf
(
"Using config file: %s
\n
"
,
viper
.
ConfigFileUsed
()))
glog
.
V
(
1
)
.
Info
(
fmt
.
Sprintf
(
"Using benchmark file: %s
\n
"
,
path
))
...
...
This diff is collapsed.
Click to expand it.
cmd/util.go
+
31
−
0
View file @
6ce0c5bf
...
...
@@ -147,6 +147,37 @@ func getConfigFiles(v *viper.Viper) map[string]string {
return
confmap
}
// getPodSpecFiles finds which of the set of candidate podspec files exist
func
getPodSpecFiles
(
v
*
viper
.
Viper
)
map
[
string
]
string
{
podspecmap
:=
make
(
map
[
string
]
string
)
for
_
,
component
:=
range
v
.
GetStringSlice
(
"components"
)
{
s
:=
v
.
Sub
(
component
)
if
s
==
nil
{
continue
}
// See if any of the candidate podspec files exist
podspec
:=
findConfigFile
(
s
.
GetStringSlice
(
"podspecs"
))
if
podspec
==
""
{
if
s
.
IsSet
(
"defaultpodspec"
)
{
podspec
=
s
.
GetString
(
"defaultpodspec"
)
glog
.
V
(
2
)
.
Info
(
fmt
.
Sprintf
(
"Using default podspec file name '%s' for component %s"
,
podspec
,
component
))
}
else
{
// Default the config file name that we'll substitute to the name of the component
printlnWarn
(
fmt
.
Sprintf
(
"Missing podspec file for %s"
,
component
))
podspec
=
component
}
}
else
{
glog
.
V
(
2
)
.
Info
(
fmt
.
Sprintf
(
"Component %s uses podspec file '%s'"
,
component
,
podspec
))
}
podspecmap
[
component
]
=
podspec
}
return
podspecmap
}
// verifyBin checks that the binary specified is running
func
verifyBin
(
bin
string
)
bool
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment