k8s: Drop process name trimming from etcd on RKE 96/100696/2
authorPawel Wieczorek <p.wieczorek2@samsung.com>
Tue, 8 Oct 2019 12:43:47 +0000 (14:43 +0200)
committerPawel Wieczorek <p.wieczorek2@samsung.com>
Wed, 29 Jan 2020 16:14:53 +0000 (17:14 +0100)
Information for etcd extracted from container on a RKE-based cluster
does not include process name.

Issue-ID: SECCOM-235
Change-Id: Ie6aee550868431d5f4d27c3b3d262e17e1aa6156
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
test/security/k8s/src/check/raw/raw.go

index eea5c01..91237ba 100644 (file)
@@ -49,7 +49,7 @@ func (r *Raw) GetControllerManagerParams() ([]string, error) {
 // GetEtcdParams returns parameters of running etcd.
 // It queries only cluster nodes with "controlplane" role.
 func (r *Raw) GetEtcdParams() ([]string, error) {
-       return []string{}, check.ErrNotImplemented
+       return getProcessParams(check.EtcdProcess)
 }
 
 func getProcessParams(process check.Command) ([]string, error) {
@@ -67,6 +67,10 @@ func getProcessParams(process check.Command) ([]string, error) {
 
                        cmd = trimOutput(cmd) // TODO: improve `docker inspect` query format.
                        if len(cmd) > 0 {
+                               if process == check.EtcdProcess { // etcd process name is not included in its argument list.
+                                       return btos(cmd), nil
+                               }
+
                                i := bytes.Index(cmd, []byte(process.String()))
                                if i == -1 {
                                        return []string{}, fmt.Errorf("missing %s command", process)