1
0
mirror of https://github.com/rancher/types.git synced 2025-06-28 14:36:50 +00:00

catalog types changes

This commit is contained in:
Daishan Peng 2018-01-10 11:13:41 -07:00 committed by Darren Shepherd
parent 87897aa616
commit 02f805be04
3 changed files with 66 additions and 2 deletions

View File

@ -26,7 +26,8 @@ var (
Init(clusterTypes).
Init(catalogTypes).
Init(authnTypes).
Init(schemaTypes)
Init(schemaTypes).
Init(stackTypes)
)
func schemaTypes(schemas *types.Schemas) *types.Schemas {
@ -200,3 +201,17 @@ func authnTypes(schemas *types.Schemas) *types.Schemas {
}
})
}
func stackTypes(schema *types.Schemas) *types.Schemas {
return schema.
MustImportAndCustomize(&Version, v3.Stack{}, func(schema *types.Schema) {
schema.ResourceActions = map[string]types.Action{
"upgrade": {
Input: "templateVersionId",
},
"rollback": {
Input: "revision",
},
}
})
}

View File

@ -0,0 +1,40 @@
package v3
import (
"github.com/rancher/norman/types"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type Stack struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec StackSpec `json:"spec,omitempty"`
Status StackStatus `json:"status,omitempty"`
}
type StackSpec struct {
ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"`
Description string `json:"description,omitempty"`
InstallNamespace string `json:"installNamespace,omitempty"`
TemplateVersionID string `json:"templateVersionId,omitempty"`
Templates map[string]string `json:"templates,omitempty"`
Answers map[string]string `json:"answers,omitempty"`
Prune bool `json:"prune,omitempty"`
Tag map[string]string `json:"tag,omitempty"`
User string `json:"user,omitempty"`
Groups []string `json:"groups,omitempty"`
}
type StackStatus struct {
Releases []ReleaseInfo `json:"releases,omitempty"`
}
type ReleaseInfo struct {
Name string `json:"name"`
Version string `json:"version"`
CreateTimestamp string `json:"createTimestamp"`
ModifiedAt string `json:"modifiedAt"`
TemplateVersionID string `json:"templateVersionId"`
}

View File

@ -35,9 +35,18 @@ var (
Init(replicaSet).
Init(replicationController).
Init(daemonSet).
Init(workloadTypes)
Init(workloadTypes).
Init(configMapTypes)
)
func configMapTypes(schemas *types.Schemas) *types.Schemas {
return ConfigMapTypes(&Version, schemas)
}
func ConfigMapTypes(version *types.APIVersion, schemas *types.Schemas) *types.Schemas {
return schemas.MustImport(version, v1.ConfigMap{})
}
func namespaceTypes(schemas *types.Schemas) *types.Schemas {
return NamespaceTypes(&Version, schemas)
}