Register the new evaluator with the index package

Signed-off-by: Nathan Lowe <public@nlowe.me>
This commit is contained in:
Nathan Lowe 2019-08-05 20:05:33 -04:00
parent 14eff4d9f2
commit 9f88e78381
No known key found for this signature in database
GPG Key ID: 1091439964459621

View File

@ -17,20 +17,14 @@ package index
import ( import (
"sync" "sync"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/latestpl"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/latestk"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/always"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/lastx"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/latestps"
"github.com/goharbor/harbor/src/pkg/retention/policy/action" "github.com/goharbor/harbor/src/pkg/retention/policy/action"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/always"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/daysps"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/lastx"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/latestk"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/latestpl"
"github.com/goharbor/harbor/src/pkg/retention/policy/rule/latestps"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -131,6 +125,20 @@ func init() {
Action: action.Retain, Action: action.Retain,
Parameters: []*IndexedParam{}, Parameters: []*IndexedParam{},
}, always.New) }, always.New)
// Register daysps
Register(&Metadata{
TemplateID: daysps.TemplateID,
Action: action.Retain,
Parameters: []*IndexedParam{
{
Name: daysps.ParameterN,
Type: "int",
Unit: "days",
Required: true,
},
},
}, daysps.New)
} }
// Register the rule evaluator with the corresponding rule template // Register the rule evaluator with the corresponding rule template