Skip to content

Commit

Permalink
Merge pull request #3 from echoboomer/v0.1.1
Browse files Browse the repository at this point in the history
Cleanup output and syntax.
  • Loading branch information
echoboomer authored Mar 17, 2022
2 parents 5bc9982 + 4ed3eff commit 336a27c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 3 additions & 1 deletion cmd/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ var evalCmd = &cobra.Command{
This command looks specifically at the resiliency of your applications and
assesses their behavior during disruptive events like cluster upgrades or
Node scaling.`,
Node scaling. This is done by evaluating replica counts, PodDisruptionBudgets,
and HorizontalPodAutoscalers. Helpful suggestions will be given to help improve
resiliency.`,
Run: func(cmd *cobra.Command, args []string) {
// Initiate kubeconfig
config, clientset, _ := kubetools.CreateKubeConfig(false)
Expand Down
5 changes: 1 addition & 4 deletions pkg/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ import (
"github.com/spf13/afero"
)

// Use afero for file system to allow for easier testing
var fs afero.Fs = afero.NewOsFs()

// DeleteFromSlice removes the supplied single element from a given slice
func DeleteFromSlice(slice []string, selector string) []string {
var result []string
Expand Down Expand Up @@ -63,7 +60,7 @@ func FindInSlice(slice []string, element string) (int, bool) {
return -1, false
}

// PAFHeader returns a nice little header for the app
// PAFHeader returns a header for the app
func PAFHeader() {
myFigure := figure.NewFigure("paranoid af", "cosmic", true)
myFigure.Print()
Expand Down
8 changes: 3 additions & 5 deletions pkg/eval/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func buildDeploymentDescription(d appsv1.Deployment) *deploymentDescription {
// checkDeployments procsses a list of Deployments and verifies their configurations as they
// relate to high availability and resiliency
func checkDeployments(clientset kubernetes.Interface, deployments []appsv1.Deployment) {
fmt.Printf("\n")
fmt.Println()
for _, d := range deployments {
// Build a struct for each Deployment
dep := buildDeploymentDescription(d)
Expand Down Expand Up @@ -153,7 +153,7 @@ func checkDeployments(clientset kubernetes.Interface, deployments []appsv1.Deplo
log.Fatal(err)
}
}
fmt.Printf("\n")
fmt.Println()
}
}

Expand All @@ -176,9 +176,7 @@ func returnEligibleDeployments(clientset kubernetes.Interface, nsList []string)
if err != nil {
log.Errorf("Error: %s", err)
}
for _, d := range deployments.Items {
deploymentList = append(deploymentList, d)
}
deploymentList = append(deploymentList, deployments.Items...)
}
return deploymentList
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/eval/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ import (
"k8s.io/client-go/rest"
)

// Ignored Kubernetes Namespaces
var nsFilter = []string{"kube-system", "kube-node-lease", "kube-public"}

// UGPrepOptions acts as a container to hold information passed into the process
type UGPrepOptions struct {
ClusterName string
Expand Down Expand Up @@ -61,7 +64,6 @@ func Check(config *rest.Config, clientset kubernetes.Interface, o *UGPrepOptions

// Filter out unwanted Namespaces
// kube-public, kube-system, kube-node-lease
nsFilter := []string{"kube-system", "kube-node-lease", "kube-public"}
for _, filteredNS := range nsFilter {
nsList = common.DeleteFromSlice(nsList, filteredNS)
}
Expand Down

0 comments on commit 336a27c

Please sign in to comment.