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

Remove the stale references to kustomize. #1241

Merged
merged 1 commit into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/engine/renderer/enhancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Enhancer interface {
Apply(templates map[string]string, metadata Metadata) ([]runtime.Object, error)
}

// DefaultEnhancer is implementation of Enhancer that uses kustomize to apply the defined conventions
// DefaultEnhancer is implementation of Enhancer that applies the defined conventions by directly editing runtime.Objects (Unstructured).
type DefaultEnhancer struct {
Scheme *runtime.Scheme
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/engine/task/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ func render(resourceNames []string, ctx Context) (map[string]string, error) {
return resources, nil
}

// kustomize method takes a slice of rendered templates, applies conventions using Enhancer and
// enhance method takes a slice of rendered templates, applies conventions using Enhancer and
// returns a slice of k8s objects.
func kustomize(rendered map[string]string, meta renderer.Metadata, enhancer renderer.Enhancer) ([]runtime.Object, error) {
func enhance(rendered map[string]string, meta renderer.Metadata, enhancer renderer.Enhancer) ([]runtime.Object, error) {
enhanced, err := enhancer.Apply(rendered, meta)
return enhanced, err
}
8 changes: 4 additions & 4 deletions pkg/engine/task/task_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type ApplyTask struct {
}

// Run method for the ApplyTask. Given the task context, it renders the templates using context parameters
// creates runtime objects and kustomizes them, and applies them using the controller client. Finally,
// creates runtime objects and enhances them, and applies them using the controller client. Finally,
// resources are checked for health.
func (at ApplyTask) Run(ctx Context) (bool, error) {
// 1. - Render task templates -
Expand All @@ -32,14 +32,14 @@ func (at ApplyTask) Run(ctx Context) (bool, error) {
return false, fatalExecutionError(err, taskRenderingError, ctx.Meta)
}

// 2. - Kustomize them with metadata -
kustomized, err := kustomize(rendered, ctx.Meta, ctx.Enhancer)
// 2. - Enhance them with metadata -
enhanced, err := enhance(rendered, ctx.Meta, ctx.Enhancer)
if err != nil {
return false, fatalExecutionError(err, taskEnhancementError, ctx.Meta)
}

// 3. - Apply them using the client -
applied, err := apply(kustomized, ctx.Client)
applied, err := apply(enhanced, ctx.Client)
if err != nil {
return false, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/task/task_apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (k *testEnhancer) Apply(templates map[string]string, metadata renderer.Meta
for _, t := range templates {
objsToAdd, err := renderer.YamlToObject(t)
if err != nil {
return nil, fmt.Errorf("error parsing kubernetes objects after applying kustomize: %w", err)
return nil, fmt.Errorf("error parsing kubernetes objects after applying enhance: %w", err)
}
result = append(result, objsToAdd[0])
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/engine/task/task_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ type DeleteTask struct {
}

// Run method for the DeleteTask. Given the task context, it renders the templates using context parameters
// creates runtime objects and kustomizes them, and finally removes them using the controller client.
// creates runtime objects and enhances them, and finally removes them using the controller client.
func (dt DeleteTask) Run(ctx Context) (bool, error) {
// 1. - Render task templates -
rendered, err := render(dt.Resources, ctx)
if err != nil {
return false, fatalExecutionError(err, taskRenderingError, ctx.Meta)
}

// 2. - Kustomize them with metadata -
kustomized, err := kustomize(rendered, ctx.Meta, ctx.Enhancer)
// 2. - Enhance them with metadata -
enhanced, err := enhance(rendered, ctx.Meta, ctx.Enhancer)
if err != nil {
return false, fatalExecutionError(err, taskEnhancementError, ctx.Meta)
}

// 3. - Delete them using the client -
err = delete(kustomized, ctx.Client)
err = delete(enhanced, ctx.Client)
if err != nil {
return false, err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/engine/task/task_pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func (pt PipeTask) Run(ctx Context) (bool, error) {
return false, fatalExecutionError(err, pipeTaskError, ctx.Meta)
}

// 5. - Kustomize pod with metadata
podObj, err := kustomize(map[string]string{"pipe-pod.yaml": podYaml}, ctx.Meta, ctx.Enhancer)
// 5. - Enhance pod with metadata
podObj, err := enhance(map[string]string{"pipe-pod.yaml": podYaml}, ctx.Meta, ctx.Enhancer)
if err != nil {
return false, fatalExecutionError(err, taskEnhancementError, ctx.Meta)
}
Expand Down Expand Up @@ -118,8 +118,8 @@ func (pt PipeTask) Run(ctx Context) (bool, error) {
return false, err
}

// 10. - Kustomize artifacts -
artObj, err := kustomize(artStr, ctx.Meta, ctx.Enhancer)
// 10. - Enhance artifacts -
artObj, err := enhance(artStr, ctx.Meta, ctx.Enhancer)
if err != nil {
return false, fatalExecutionError(err, taskEnhancementError, ctx.Meta)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/workflow/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ func (k *testEnhancer) Apply(templates map[string]string, metadata renderer.Meta
for _, t := range templates {
objsToAdd, err := renderer.YamlToObject(t)
if err != nil {
return nil, fmt.Errorf("error parsing kubernetes objects after applying kustomize: %w", err)
return nil, fmt.Errorf("error parsing kubernetes objects after applying enhance: %v", err)
}
result = append(result, objsToAdd[0])
}
Expand Down