Skip to content
Open
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 internal/kustomize/kustomization.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func parseKustomization(fsys fs.FS, kustomizationPath string, options Kustomizat

for _, path := range options.IncludedFiles {
if filepath.IsAbs(path) {
return nil, fmt.Errorf("include path (%s) must be absolute", path)
return nil, fmt.Errorf("include path (%s) must not be absolute", path)
}
absolutePath := filepath.Clean(filepath.Join(kustomizationPath, path))
if isSubdirectory(absolutePath, kustomizationPath) {
Expand Down
9 changes: 9 additions & 0 deletions pkg/reconciler/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@ func normalizeObjects(objects []client.Object, scheme *runtime.Scheme) ([]client
if gvk.Version == "" || gvk.Kind == "" {
return nil, fmt.Errorf("unstructured object %s is missing type information", types.ObjectKeyToString(object))
}
// explicitly check that metadata.labels and metadata.annotations are map[string]string;
// the same method unstructured.NestedNullCoercingStringMap() is used in GetLabels() and GetAnnotations(), but errors
// are discarded there; this is why we check it here
if _, _, err := unstructured.NestedNullCoercingStringMap(unstructuredObject.Object, "metadata", "labels"); err != nil {
return nil, legacyerrors.Wrapf(err, "unstructured object %s has invalid labels (probably because of non-string label values)", types.ObjectKeyToString(object))
}
if _, _, err := unstructured.NestedNullCoercingStringMap(unstructuredObject.Object, "metadata", "annotations"); err != nil {
return nil, legacyerrors.Wrapf(err, "unstructured object %s has invalid annotations (probably because of non-string annotation values)", types.ObjectKeyToString(object))
}
if scheme.Recognizes(gvk) {
typedObject, err := scheme.New(gvk)
if err != nil {
Expand Down
Loading