Skip to content

Commit

Permalink
DeploymentResult -> ControllerResult
Browse files Browse the repository at this point in the history
  • Loading branch information
rbren committed May 2, 2019
1 parent 1282359 commit 244a1de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions pkg/validator/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import (
)

// ValidateDeployment validates a single deployment, returns a PodResult.
func ValidateDeployment(conf conf.Configuration, deploy *appsv1.Deployment) DeploymentResult {
func ValidateDeployment(conf conf.Configuration, deploy *appsv1.Deployment) ControllerResult {
pod := deploy.Spec.Template.Spec
podResult := ValidatePod(conf, &pod)
return DeploymentResult{
return ControllerResult{
Name: deploy.Name,
Type: "Deployment",
PodResult: podResult,
}
}
Expand All @@ -47,7 +48,7 @@ func ValidateDeployments(config conf.Configuration, k8sAPI *kube.API) (Namespace
return nsResults, nil
}

func addResult(deploymentResult DeploymentResult, nsResults NamespacedResults, nsName string) NamespacedResults {
func addResult(deploymentResult ControllerResult, nsResults NamespacedResults, nsName string) NamespacedResults {
nsResult := &NamespaceResult{}

// If there is already data stored for this namespace name,
Expand All @@ -56,7 +57,7 @@ func addResult(deploymentResult DeploymentResult, nsResults NamespacedResults, n
case nil:
nsResult = &NamespaceResult{
Summary: &ResultSummary{},
DeploymentResults: []DeploymentResult{},
DeploymentResults: []ControllerResult{},
}
nsResults[nsName] = nsResult
default:
Expand Down
7 changes: 4 additions & 3 deletions pkg/validator/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type NamespacedResults map[string]*NamespaceResult
type NamespaceResult struct {
Name string
Summary *ResultSummary
DeploymentResults []DeploymentResult
DeploymentResults []ControllerResult
}

// CountSummary provides a high level overview of success, warnings, and errors.
Expand Down Expand Up @@ -73,9 +73,10 @@ func (rs *ResultSummary) appendResults(toAppend ResultSummary) {
}
}

// DeploymentResult provides a wrapper around a PodResult
type DeploymentResult struct {
// ControllerResult provides a wrapper around a PodResult
type ControllerResult struct {
Name string
Type string
PodResult PodResult
}

Expand Down

0 comments on commit 244a1de

Please sign in to comment.