mirror of
https://github.com/rancher/types.git
synced 2025-09-12 21:13:18 +00:00
Updates type for subcontext rewrite
This commit is contained in:
@@ -13,17 +13,15 @@ import (
|
||||
|
||||
var (
|
||||
Version = types.APIVersion{
|
||||
Version: "v3",
|
||||
Group: "project.cattle.io",
|
||||
Path: "/v3/projects",
|
||||
SubContexts: map[string]bool{
|
||||
"projects": true,
|
||||
},
|
||||
Version: "v3",
|
||||
Group: "project.cattle.io",
|
||||
Path: "/v3/project",
|
||||
SubContext: true,
|
||||
SubContextSchema: "/v3/schemas/project",
|
||||
}
|
||||
|
||||
Schemas = factory.Schemas(&Version).
|
||||
// Namespace must be first
|
||||
Init(namespaceTypes).
|
||||
// volume before pod types. pod types uses volume things, so need to register mapper
|
||||
Init(volumeTypes).
|
||||
Init(ingressTypes).
|
||||
@@ -36,6 +34,7 @@ var (
|
||||
Init(replicationController).
|
||||
Init(daemonSet).
|
||||
Init(workloadTypes).
|
||||
Init(appTypes).
|
||||
Init(configMapTypes)
|
||||
)
|
||||
|
||||
@@ -454,3 +453,17 @@ func volumeTypes(schemas *types.Schemas) *types.Schemas {
|
||||
return schemas.
|
||||
MustImport(&Version, v1.PersistentVolumeClaim{}, projectOverride{})
|
||||
}
|
||||
|
||||
func appTypes(schema *types.Schemas) *types.Schemas {
|
||||
return schema.
|
||||
MustImportAndCustomize(&Version, v3.App{}, func(schema *types.Schema) {
|
||||
schema.ResourceActions = map[string]types.Action{
|
||||
"upgrade": {
|
||||
Input: "templateVersionId",
|
||||
},
|
||||
"rollback": {
|
||||
Input: "revision",
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
40
apis/project.cattle.io/v3/stack_types.go
Normal file
40
apis/project.cattle.io/v3/stack_types.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
types.Namespaced
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec AppSpec `json:"spec,omitempty"`
|
||||
Status AppStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type AppSpec struct {
|
||||
ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"`
|
||||
Description string `json:"description,omitempty"`
|
||||
InstallNamespace string `json:"installNamespace,omitempty"`
|
||||
ExternalID string `json:"externalId,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 AppStatus 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"`
|
||||
}
|
Reference in New Issue
Block a user