Skip to content
Merged
Changes from 1 commit
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
14 changes: 14 additions & 0 deletions pkg/validation/internal/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ func validateCSV(csv *v1alpha1.ClusterServiceVersion) errors.ManifestResult {
result.Add(checkFields(*csv)...)
// validate case sensitive annotation names
result.Add(ValidateAnnotationNames(csv.GetAnnotations(), csv.GetName())...)
// validate Version and Kind
result.Add(validateVersionKind(csv)...)
return result
}

Expand Down Expand Up @@ -194,3 +196,15 @@ func validateInstallModes(csv *v1alpha1.ClusterServiceVersion) (errs []errors.Er
}
return errs
}

// validateVersionKind checks presense of GroupVersionKind.Verion and GroupVersionKind.Kind
func validateVersionKind(csv *v1alpha1.ClusterServiceVersion) (errs []errors.Error) {
gvk := csv.GroupVersionKind()
if gvk.Version == "" {
errs = append(errs, errors.ErrInvalidCSV("'apiVersion' is missing", csv.GetName()))
}
if gvk.Kind == "" {
errs = append(errs, errors.ErrInvalidCSV("'kind' is missing", csv.GetName()))
}
return
}