Skip to content
This repository was archived by the owner on Apr 29, 2020. It is now read-only.
Open
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
15 changes: 12 additions & 3 deletions pkg/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,18 @@ func FromReader(reader io.Reader) (Manifest, error) {
// manifest can be a raw YAML document or a PGP clearsigned YAML document. If signed, the
// signature components will be stored inside the Manifest instance.
func FromBytes(bytes []byte) (Manifest, error) {
manifest, err := FromBytesNoValidation(bytes)
if err != nil {
return nil, err
}

if err := ValidManifest(manifest); err != nil {
return nil, util.Errorf("invalid manifest: %s", err)
}
return manifest, nil
}

func FromBytesNoValidation(bytes []byte) (Manifest, error) {
manifest := &manifest{}

// Preserve the raw manifest so that manifest.Bytes() returns bytes in
Expand All @@ -371,9 +383,6 @@ func FromBytes(bytes []byte) (Manifest, error) {
if err := yaml.Unmarshal(bytes, manifest); err != nil {
return nil, util.Errorf("Could not read pod manifest: %s", err)
}
if err := ValidManifest(manifest); err != nil {
return nil, util.Errorf("invalid manifest: %s", err)
}
return manifest, nil
}

Expand Down