Skip to content
Merged
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
4 changes: 4 additions & 0 deletions pkg/cvo/internal/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package internal

import (
"encoding/json"
"fmt"

apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -28,6 +29,9 @@ func readUnstructuredV1OrDie(objBytes []byte) *unstructured.Unstructured {
}

func applyUnstructured(client dynamic.ResourceInterface, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) {
if required.GetName() == "" {
return nil, false, fmt.Errorf("invalid object: name cannot be empty")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrm. Is there some way we can get an identifier here to help the log-reader figure out what needs fixing? Ordinarily that would be the name, but in this case... ? Maybe push this up into genericBuilder.Do where we can dump the broken b.raw?

Copy link
Member

@wking wking Oct 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe keep more information (like the GVK?) from the initial m lib.Manifest in NewGenericBuilder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if err := b.Do(); err != nil {

We print out the details of the task.

}
existing, err := client.Get(required.GetName(), metav1.GetOptions{})
if apierrors.IsNotFound(err) {
actual, err := client.Create(required)
Expand Down