Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete controllers package #270

Merged
merged 14 commits into from
Apr 27, 2020
Prev Previous commit
Next Next commit
fix lint error
  • Loading branch information
rbren committed Apr 24, 2020
commit 073d3fa580daea4d94688efa094c68642a6d9a54
6 changes: 4 additions & 2 deletions pkg/kube/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type k8sResource struct {
Kind string `yaml:"kind"`
}

var podSpecFields = []string{"jobTemplate", "spec", "template"}

// CreateResourceProvider returns a new ResourceProvider object to interact with k8s resources
func CreateResourceProvider(directory string) (*ResourceProvider, error) {
if directory != "" {
Expand Down Expand Up @@ -180,9 +182,9 @@ func deduplicateControllers(inputControllers []GenericWorkload) []GenericWorkloa
return results
}

// GetPodSpec looks inside arbitrary YAML for a PodSpec
func GetPodSpec(yaml map[string]interface{}) interface{} {
allowedChildren := []string{"jobTemplate", "spec", "template"}
for _, child := range allowedChildren {
for _, child := range podSpecFields {
if childYaml, ok := yaml[child]; ok {
return GetPodSpec(childYaml.(map[string]interface{}))
}
Expand Down