1
0
mirror of https://github.com/rancher/types.git synced 2025-08-28 00:30:31 +00:00

rancher up

This commit is contained in:
Daishan Peng 2018-05-23 10:21:49 -07:00 committed by Darren Shepherd
parent 2e39c2c6c8
commit 8e53d04d3c
5 changed files with 11 additions and 76 deletions

View File

@ -240,6 +240,10 @@ type GenerateKubeConfigOutput struct {
Config string `json:"config"`
}
type ExportOutput struct {
YAMLOutput string `json:"yamlOutput"`
}
type ImportClusterYamlInput struct {
YAML string `json:"yaml,omitempty"`
DefaultNamespace string `json:"defaultNamespace,omitempty"`

View File

@ -2,12 +2,11 @@ package v3
import (
"github.com/rancher/norman/condition"
"github.com/rancher/norman/types"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type GlobalComposeConfig struct {
type ComposeConfig struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
@ -44,20 +43,3 @@ type ComposeCondition struct {
// Human-readable message indicating details about last transition
Message string `json:"message,omitempty"`
}
type ClusterComposeConfig struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec ClusterComposeSpec `json:"spec,omitempty"`
Status ComposeStatus `json:"status,omitempty"`
}
type ClusterComposeSpec struct {
ClusterName string `json:"clusterName" norman:"type=reference[cluster]"`
RancherCompose string `json:"rancherCompose,omitempty"`
}

View File

@ -157,6 +157,9 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
Input: "importClusterYamlInput",
Output: "importYamlOutput",
}
schema.ResourceActions["exportYaml"] = types.Action{
Output: "exportOutput",
}
})
}
@ -181,6 +184,7 @@ func authzTypes(schemas *types.Schemas) *types.Schemas {
Input: "setPodSecurityPolicyTemplateInput",
Output: "project",
},
"exportYaml": {},
}
}).
MustImport(&Version, v3.GlobalRole{}).
@ -482,6 +486,5 @@ func pipelineTypes(schema *types.Schemas) *types.Schemas {
}
func composeType(schemas *types.Schemas) *types.Schemas {
return schemas.MustImport(&Version, v3.GlobalComposeConfig{}).
MustImport(&Version, v3.ClusterComposeConfig{})
return schemas.MustImport(&Version, v3.ComposeConfig{})
}

View File

@ -1,49 +0,0 @@
package v3
import (
"github.com/rancher/norman/condition"
"github.com/rancher/norman/types"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type NamespaceComposeConfig struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec NamespaceComposeSpec `json:"spec,omitempty"`
Status ComposeStatus `json:"status,omitempty"`
}
type NamespaceComposeSpec struct {
RancherCompose string `json:"rancherCompose,omitempty"`
ProjectName string `json:"projectName" norman:"type=reference[project]"`
InstallNamespace string `json:"installNamespace,omitempty"`
}
type ComposeStatus struct {
Conditions []ComposeCondition `json:"conditions,omitempty"`
}
var (
ComposeConditionExecuted condition.Cond = "Executed"
)
type ComposeCondition struct {
// Type of cluster condition.
Type string `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"`
}

View File

@ -41,8 +41,7 @@ var (
Init(cronJobTypes).
Init(podTemplateSpecTypes).
Init(workloadTypes).
Init(appTypes).
Init(namespaceComposeType)
Init(appTypes)
)
func configMapTypes(schemas *types.Schemas) *types.Schemas {
@ -734,7 +733,3 @@ func NewWorkloadTypeMapper() types.Mapper {
&m.AnnotationField{Field: "publicEndpoints", List: true},
}
}
func namespaceComposeType(schemas *types.Schemas) *types.Schemas {
return schemas.MustImport(&Version, v3.NamespaceComposeConfig{})
}