Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #657 from yifan-gu/cri_label
Browse files Browse the repository at this point in the history
CRI: Change CRILabels type to map[string]string.
  • Loading branch information
Casey Callendrello authored Sep 21, 2016
2 parents 1be68be + 713aa44 commit 549b066
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 77 deletions.
3 changes: 0 additions & 3 deletions schema/types/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,5 @@ func (a *App) assertValid() error {
if err := a.Isolators.assertValid(); err != nil {
return err
}
if err := a.CRILabels.assertValid(); err != nil {
return err
}
return nil
}
9 changes: 2 additions & 7 deletions schema/types/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func TestAppUnmarshal(t *testing.T) {
false,
},
{
`{"Exec":["/a"],"User":"0","Group":"0","CRIAnnotations":{"weird!":"normal?"},"CRILabels":{"one":"two"}}`,
`{"Exec":["/a"],"User":"0","Group":"0","CRIAnnotations":{"weird!":"normal?"},"CRILabels":{"one!":"two?"}}`,
&App{
Exec: Exec{
"/a",
Expand All @@ -224,16 +224,11 @@ func TestAppUnmarshal(t *testing.T) {
"weird!": "normal?",
},
CRILabels: CRILabels{
"one": "two",
"one!": "two?",
},
},
false,
},
{
`{"Exec":["/a"],"User":"0","Group":"0","CRIAnnotations":{"weird!":"normal?"},"CRILabels":{"!one":"two"}}`,
&App{},
true,
},
}
for i, tt := range tests {
a := &App{}
Expand Down
17 changes: 2 additions & 15 deletions schema/types/cri_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,5 @@

package types

import "fmt"

type CRILabels map[ACIdentifier]string

func (l CRILabels) assertValid() error {
for k, _ := range l {
if err := k.assertValid(); err != nil {
return err
}
if len(k) > 63 {
return fmt.Errorf(`label %q too long`, k)
}
}
return nil
}
// CRILabels are arbitrary key-value pairs
type CRILabels map[string]string
52 changes: 0 additions & 52 deletions schema/types/cri_labels_test.go

This file was deleted.

0 comments on commit 549b066

Please sign in to comment.