From c22f81610d26aba5d254f28c82e5f4fb6fb556ac Mon Sep 17 00:00:00 2001
From: Roberto Rojas <robertojrojas@gmail.com>
Date: Sat, 12 Oct 2019 19:00:26 -0400
Subject: [PATCH] removes federated (#431)

---
 cfg/config.yaml  | 20 +-------------------
 check/check.go   |  4 +---
 cmd/common.go    |  2 --
 cmd/federated.go | 41 -----------------------------------------
 cmd/root.go      |  5 ++---
 5 files changed, 4 insertions(+), 68 deletions(-)
 delete mode 100644 cmd/federated.go

diff --git a/cfg/config.yaml b/cfg/config.yaml
index 1fae6bb..aff949a 100644
--- a/cfg/config.yaml
+++ b/cfg/config.yaml
@@ -5,7 +5,6 @@
 ## Uncomment to use different control file paths.
 # masterControls: ./cfg/master.yaml
 # nodeControls: ./cfg/node.yaml
-# federatedControls: ./cfg/federated.yaml
 
 master:
   components:
@@ -131,21 +130,4 @@ node:
     svc:
       - "/lib/systemd/system/kube-proxy.service"
     defaultconf: /etc/kubernetes/addons/kube-proxy-daemonset.yaml
-    defaultkubeconfig: "/etc/kubernetes/proxy.conf"
-
-federated:
-  components:
-    - fedapiserver
-    - fedcontrollermanager
-
-  fedapiserver:
-    bins:
-      - "hyperkube federation-apiserver"
-      - "kube-federation-apiserver"
-      - "federation-apiserver"
-
-  fedcontrollermanager:
-    bins:
-      - "hyperkube federation-controller-manager"
-      - "kube-federation-controller-manager"
-      - "federation-controller-manager"
+    defaultkubeconfig: "/etc/kubernetes/proxy.conf"
\ No newline at end of file
diff --git a/check/check.go b/check/check.go
index 2b28a8b..d3b3fb2 100644
--- a/check/check.go
+++ b/check/check.go
@@ -26,7 +26,7 @@ import (
 	"github.com/golang/glog"
 )
 
-// NodeType indicates the type of node (master, node, federated).
+// NodeType indicates the type of node (master, node).
 type NodeType string
 
 // State is the state of a control check.
@@ -46,8 +46,6 @@ const (
 	MASTER NodeType = "master"
 	// NODE a node
 	NODE NodeType = "node"
-	// FEDERATED a federated deployment.
-	FEDERATED NodeType = "federated"
 )
 
 func handleError(err error, context string) (errmsg string) {
diff --git a/cmd/common.go b/cmd/common.go
index bc4b272..aee3cbf 100644
--- a/cmd/common.go
+++ b/cmd/common.go
@@ -207,8 +207,6 @@ func loadConfig(nodetype check.NodeType) string {
 		file = masterFile
 	case check.NODE:
 		file = nodeFile
-	case check.FEDERATED:
-		file = federatedFile
 	}
 
 	runningVersion := ""
diff --git a/cmd/federated.go b/cmd/federated.go
deleted file mode 100644
index 0f9dbf3..0000000
--- a/cmd/federated.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright © 2017 Aqua Security Software Ltd. <info@aquasec.com>
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cmd
-
-import (
-	"github.com/aquasecurity/kube-bench/check"
-	"github.com/spf13/cobra"
-)
-
-// nodeCmd represents the node command
-var federatedCmd = &cobra.Command{
-	Use:   "federated",
-	Short: "Run benchmark checks for a Kubernetes federated deployment.",
-	Long:  `Run benchmark checks for a Kubernetes federated deployment.`,
-	Run: func(cmd *cobra.Command, args []string) {
-		runChecks(check.FEDERATED)
-	},
-}
-
-func init() {
-	federatedCmd.PersistentFlags().StringVarP(&federatedFile,
-		"file",
-		"f",
-		"/federated.yaml",
-		"Alternative YAML file for federated checks",
-	)
-
-	RootCmd.AddCommand(federatedCmd)
-}
diff --git a/cmd/root.go b/cmd/root.go
index 2591e6a..35c16eb 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -42,7 +42,6 @@ var (
 	pgSQL              bool
 	masterFile         = "master.yaml"
 	nodeFile           = "node.yaml"
-	federatedFile      string
 	noResults          bool
 	noSummary          bool
 	noRemediations     bool
@@ -134,12 +133,12 @@ func initConfig() {
 	// Precedence: Command line flags take precedence over environment variables.
 	viper.SetEnvPrefix(envVarsPrefix)
 	viper.AutomaticEnv()
-	
+
 	if kubeVersion == "" {
 		if env := viper.Get("version"); env != nil {
 			kubeVersion = env.(string)
 		}
- 	}
+	}
 
 	// If a config file is found, read it in.
 	if err := viper.ReadInConfig(); err != nil {
-- 
GitLab