1
0
mirror of https://github.com/rancher/types.git synced 2025-09-18 07:52:41 +00:00

add compose type, add compose generator

This commit is contained in:
Daishan Peng
2018-02-19 22:53:39 -07:00
committed by Darren Shepherd
parent 84e0c8d143
commit 8ad7a4777f
7 changed files with 235 additions and 2 deletions

View File

@@ -0,0 +1,49 @@
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,7 +41,8 @@ var (
Init(podTemplateSpecTypes).
Init(workloadTypes).
Init(appTypes).
Init(configMapTypes)
Init(configMapTypes).
Init(namespaceComposeType)
)
func configMapTypes(schemas *types.Schemas) *types.Schemas {
@@ -677,3 +678,7 @@ func NewWorkloadTypeMapper() types.Mapper {
&m.AnnotationField{Field: "publicEndpoints", List: true},
}
}
func namespaceComposeType(schemas *types.Schemas) *types.Schemas {
return schemas.MustImport(&Version, v3.NamespaceComposeConfig{})
}