1
0
mirror of https://github.com/rancher/types.git synced 2025-08-02 05:11:59 +00:00

Add settings, listenconfig, and cluster embedded/imported

This commit is contained in:
Darren Shepherd 2018-01-22 16:45:05 -07:00
parent 89ffa83b41
commit bb6a28ecff
3 changed files with 57 additions and 3 deletions

View File

@ -17,6 +17,7 @@ const (
ClusterConditionProvisioned condition.Cond = "Provisioned"
ClusterConditionUpdated condition.Cond = "Updated"
ClusterConditionRemoved condition.Cond = "Removed"
ClusterConditionRegistered condition.Cond = "Registered"
// ClusterConditionNoDiskPressure true when all cluster nodes have sufficient disk
ClusterConditionNoDiskPressure condition.Cond = "NoDiskPressure"
// ClusterConditionNoMemoryPressure true when all cluster nodes have sufficient memory
@ -46,7 +47,8 @@ type ClusterSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
Internal bool `json:"internal" norman:"nocreate,noupdate"`
Embedded bool `json:"embedded"`
Imported bool `json:"imported" norman:"noupdate"`
Embedded bool `json:"embedded" norman:"noupdate"`
EmbeddedConfig *K8sServerConfig `json:"embeddedConfig"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`

View File

@ -0,0 +1,40 @@
package v3
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type Setting struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Value string `json:"value" norman:"required"`
HideValue bool `json:"hideValue" norman:"noupdate"`
ReadOnly bool `json:"readOnly" norman:"nocreate,noupdate"`
}
type ListenConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"`
Mode string `json:"mode,omitempty" norman:"type=enum,options=https|http|acme"`
CACerts string `json:"caCerts,omitempty"`
Cert string `json:"cert,omitempty"`
Key string `json:"key,omitempty" norman:"writeOnly"`
Domains []string `json:"domains,omitempty"`
TOS []string `json:"tos,omitempty" norman:"default=auto"`
Enabled bool `json:"enabled,omitempty" norman:"default=true"`
CertFingerprint string `json:"certFingerprint,omitempty" norman:"nocreate,noupdate"`
CN string `json:"cn,omitempty" norman:"nocreate,noupdate"`
Version int `json:"version,omitempty" norman:"nocreate,noupdate"`
ExpiresAt string `json:"expiresAt,omitempty" norman:"nocreate,noupdate"`
Issuer string `json:"issuer,omitempty" norman:"nocreate,noupdate"`
IssuedAt string `json:"issuedAt,omitempty" norman:"nocreate,noupdate"`
Algorithm string `json:"algorithm,omitempty" norman:"nocreate,noupdate"`
SerialNumber string `json:"serialNumber,omitempty" norman:"nocreate,noupdate"`
KeySize int `json:"keySize,omitempty" norman:"nocreate,noupdate"`
SubjectAlternativeNames []string `json:"subjectAlternativeNames,omitempty" norman:"nocreate,noupdate"`
}

View File

@ -28,7 +28,8 @@ var (
Init(authnTypes).
Init(schemaTypes).
Init(stackTypes).
Init(userTypes)
Init(userTypes).
Init(globalTypes)
)
func schemaTypes(schemas *types.Schemas) *types.Schemas {
@ -238,7 +239,6 @@ func stackTypes(schema *types.Schemas) *types.Schemas {
func userTypes(schema *types.Schemas) *types.Schemas {
return schema.
AddMapperForType(&Version, v3.Preference{}).
MustImportAndCustomize(&Version, v3.Preference{}, func(schema *types.Schema) {
schema.MustCustomizeField("name", func(f types.Field) types.Field {
f.Required = true
@ -250,3 +250,15 @@ func userTypes(schema *types.Schemas) *types.Schemas {
})
})
}
func globalTypes(schema *types.Schemas) *types.Schemas {
return schema.
AddMapperForType(&Version, v3.ListenConfig{}, m.DisplayName{}).
MustImport(&Version, v3.ListenConfig{}).
MustImportAndCustomize(&Version, v3.Setting{}, func(schema *types.Schema) {
schema.MustCustomizeField("name", func(f types.Field) types.Field {
f.Required = true
return f
})
})
}