mirror of
https://github.com/rancher/types.git
synced 2025-09-18 16:10:58 +00:00
add new fields and action to multi cluster app
This commit is contained in:
committed by
Alena Prokharchyk
parent
93dc9ff0d6
commit
167329b41c
@@ -1,10 +1,17 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/condition"
|
||||
"github.com/rancher/norman/types"
|
||||
"github.com/rancher/types/apis/project.cattle.io/v3"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
MultiClusterAppConditionInstalled condition.Cond = "Installed"
|
||||
MultiClusterAppConditionDeployed condition.Cond = "Deployed"
|
||||
)
|
||||
|
||||
type MultiClusterApp struct {
|
||||
types.Namespaced
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
@@ -19,14 +26,17 @@ type MultiClusterApp struct {
|
||||
}
|
||||
|
||||
type MultiClusterAppSpec struct {
|
||||
TemplateVersionName string `json:"templateVersionName,omitempty" norman:"type=reference[templateVersion],required"`
|
||||
Answers []Answer `json:"answers,omitempty"`
|
||||
Targets []Target `json:"targets,omitempty" norman:"required"`
|
||||
Members []Member `json:"members,omitempty"`
|
||||
TemplateVersionName string `json:"templateVersionName,omitempty" norman:"type=reference[templateVersion],required"`
|
||||
Answers []Answer `json:"answers,omitempty"`
|
||||
Targets []Target `json:"targets,omitempty" norman:"required"`
|
||||
Members []Member `json:"members,omitempty"`
|
||||
RevisionHistoryLimit int `json:"revisionHistoryLimit,omitempty" norman:"default=10"`
|
||||
UpgradeStrategy UpgradeStrategy `json:"upgradeStrategy,omitempty"`
|
||||
}
|
||||
|
||||
type MultiClusterAppStatus struct {
|
||||
Healthstate string `json:"healthState,omitempty"`
|
||||
Conditions []v3.AppCondition `json:"conditions,omitempty"`
|
||||
RevisionName string `json:"revisionName,omitempty" norman:"type=reference[multiClusterAppRevision],required"`
|
||||
}
|
||||
|
||||
type Target struct {
|
||||
@@ -48,3 +58,25 @@ type Member struct {
|
||||
GroupPrincipalName string `json:"groupPrincipalName,omitempty" norman:"type=reference[principal]"`
|
||||
AccessType string `json:"accessType,omitempty" norman:"type=enum,options=all|readonly|update"`
|
||||
}
|
||||
|
||||
type UpgradeStrategy struct {
|
||||
RollingUpdate *RollingUpdate `json:"rollingUpdate,omitempty"`
|
||||
}
|
||||
|
||||
type RollingUpdate struct {
|
||||
BatchSize int `json:"batchSize,omitempty"`
|
||||
Interval int `json:"interval,omitempty"`
|
||||
}
|
||||
|
||||
type MultiClusterAppRevision struct {
|
||||
types.Namespaced
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
TemplateVersionName string `json:"templateVersionName,omitempty" norman:"type=reference[templateVersion]"`
|
||||
Answers []Answer `json:"answers,omitempty"`
|
||||
}
|
||||
|
||||
type MultiClusterAppRollbackInput struct {
|
||||
RevisionName string `json:"revisionName,omitempty" norman:"type=reference[multiClusterAppRevision]"`
|
||||
}
|
||||
|
@@ -620,9 +620,20 @@ func clusterCatalogTypes(schemas *types.Schemas) *types.Schemas {
|
||||
func multiClusterAppTypes(schemas *types.Schemas) *types.Schemas {
|
||||
return schemas.
|
||||
AddMapperForType(&Version, v3.MultiClusterApp{}, m.Drop{Field: "namespaceId"}).
|
||||
AddMapperForType(&Version, v3.MultiClusterAppRevision{}, m.Drop{Field: "namespaceId"}).
|
||||
AddMapperForType(&Version, v3.Member{}, m.Drop{Field: "userName"}, m.Drop{Field: "displayName"}).
|
||||
MustImport(&Version, v3.MultiClusterApp{}).
|
||||
MustImport(&Version, v3.Target{})
|
||||
MustImport(&Version, v3.Target{}).
|
||||
MustImport(&Version, v3.UpgradeStrategy{}).
|
||||
MustImport(&Version, v3.MultiClusterAppRollbackInput{}).
|
||||
MustImport(&Version, v3.MultiClusterAppRevision{}).
|
||||
MustImportAndCustomize(&Version, v3.MultiClusterApp{}, func(schema *types.Schema) {
|
||||
schema.ResourceActions = map[string]types.Action{
|
||||
"rollback": {
|
||||
Input: "multiClusterAppRollbackInput",
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func globalDNSTypes(schemas *types.Schemas) *types.Schemas {
|
||||
|
Reference in New Issue
Block a user