diff --git a/apis/management.cattle.io/v3/catalog_types.go b/apis/management.cattle.io/v3/catalog_types.go index 14d368f3..60a2debd 100644 --- a/apis/management.cattle.io/v3/catalog_types.go +++ b/apis/management.cattle.io/v3/catalog_types.go @@ -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 { diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index 47808beb..414c6854 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -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{}) }