mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-18 22:57:38 +01:00
fix(preheat):remove health property check when saving instance
Signed-off-by: Steven Zou <szou@vmware.com>
This commit is contained in:
parent
af3a638980
commit
3c02b5da03
@ -26,7 +26,6 @@ var ErrorUnhealthy = errors.New("instance unhealthy")
|
||||
|
||||
// Controller defines related top interfaces to handle the workflow of
|
||||
// the image distribution.
|
||||
// TODO: Add health check API
|
||||
type Controller interface {
|
||||
// Get all the supported distribution providers
|
||||
//
|
||||
@ -166,10 +165,8 @@ func (c *controller) CreateInstance(ctx context.Context, instance *providerModel
|
||||
return 0, ErrorConflict
|
||||
}
|
||||
|
||||
// !WARN: Check healthy status at fronted.
|
||||
if instance.Status != "healthy" {
|
||||
return 0, ErrorUnhealthy
|
||||
}
|
||||
// !WARN: We don't check the health of the instance here.
|
||||
// That is ok because the health of instance will be checked before enforcing the policy each time.
|
||||
|
||||
instance.SetupTimestamp = time.Now().Unix()
|
||||
|
||||
|
@ -126,7 +126,7 @@ func (s *preheatSuite) TestCreateInstance() {
|
||||
id, err = s.controller.CreateInstance(s.ctx, &providerModel.Instance{
|
||||
Endpoint: "http://localhost",
|
||||
})
|
||||
s.Equal(ErrorUnhealthy, err)
|
||||
s.Equal(ErrorConflict, err)
|
||||
s.Empty(id)
|
||||
|
||||
// Case: instance with invalid provider, expect error.
|
||||
|
@ -603,7 +603,7 @@ func overrideSecuritySettings(p *pol.Schema, pro *models.Project) [][]interface{
|
||||
case pol.FilterTypeVulnerability:
|
||||
if v, ok := pro.Metadata[proMetaKeyVulnerability]; ok && v == "true" {
|
||||
if se, ok := pro.Metadata[proMetaKeySeverity]; ok && len(se) > 0 {
|
||||
se = strings.ToTitle(se)
|
||||
se = strings.ToTitle(strings.ToLower(se))
|
||||
code := vuln.Severity(se).Code()
|
||||
|
||||
if sev, ok := fl.Value.(int); !ok || (ok && sev < code) {
|
||||
|
Loading…
Reference in New Issue
Block a user