1
0
mirror of https://github.com/rancher/types.git synced 2025-08-01 04:57:05 +00:00

add catalog condition

This commit is contained in:
Daishan Peng 2018-02-27 00:18:22 -07:00 committed by Darren Shepherd
parent a78c745baa
commit 73aa2d76dc
2 changed files with 32 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package v3
import (
"github.com/rancher/norman/condition"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -27,6 +29,26 @@ type CatalogStatus struct {
Commit string `json:"commit,omitempty"`
// helmVersionCommits records hash of each helm template version
HelmVersionCommits map[string]VersionCommits `json:"helmVersionCommits,omitempty"`
Conditions []CatalogCondition `json:"conditions,omitempty"`
}
var (
CatalogConditionRefreshed condition.Cond = "Refreshed"
)
type CatalogCondition struct {
// Type of cluster condition.
Type ClusterConditionType `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
// Human-readable message indicating details about last transition
Message string `json:"message,omitempty"`
}
type VersionCommits struct {

View File

@ -53,8 +53,17 @@ func catalogTypes(schemas *types.Schemas) *types.Schemas {
return schemas.
AddMapperForType(&Version, v3.Catalog{},
&m.Move{From: "catalogKind", To: "kind"},
&m.Embed{Field: "status"},
&m.Drop{Field: "helmVersionCommits"},
).
MustImport(&Version, v3.Catalog{}).
MustImportAndCustomize(&Version, v3.Catalog{}, func(schema *types.Schema) {
schema.ResourceActions = map[string]types.Action{
"refresh": {},
}
schema.CollectionActions = map[string]types.Action{
"refresh": {},
}
}).
MustImport(&Version, v3.Template{}).
MustImport(&Version, v3.TemplateVersion{})
}