Documentation ¶
Index ¶
- Constants
- Variables
- func MergeEnvWithBuiltinKeys(src map[string]string, m MountImage) map[string]string
- type Arch
- type Cluster
- func (in *Cluster) DeepCopy() *Cluster
- func (in *Cluster) DeepCopyInto(out *Cluster)
- func (in *Cluster) DeepCopyObject() runtime.Object
- func (c *Cluster) FindImage(name string) (int, *MountImage)
- func (c *Cluster) GetAllIPS() []string
- func (c *Cluster) GetAllLabels() map[string]string
- func (c *Cluster) GetDistribution() string
- func (c *Cluster) GetIPSByRole(role string) []string
- func (c *Cluster) GetImageEndpoint() string
- func (c *Cluster) GetLvscareImage() string
- func (c *Cluster) GetMaster0IP() string
- func (c *Cluster) GetMaster0IPAndPort() string
- func (c *Cluster) GetMasterIPAndPortList() []string
- func (c *Cluster) GetMasterIPList() []string
- func (c *Cluster) GetNodeIPAndPortList() []string
- func (c *Cluster) GetNodeIPList() []string
- func (c *Cluster) GetRegistryIP() string
- func (c *Cluster) GetRegistryIPAndPort() string
- func (c *Cluster) GetRegistryIPAndPortList() []string
- func (c *Cluster) GetRegistryIPList() []string
- func (c *Cluster) GetRolesByIP(ip string) []string
- func (c *Cluster) GetRootfsImage() *MountImage
- func (c *Cluster) GetVIP() string
- func (c *Cluster) ReplaceRootfsImage()
- func (c *Cluster) SetNewImages(images []string)
- func (c *Cluster) String() string
- type ClusterCondition
- type ClusterPhase
- type ClusterSpec
- type ClusterStatus
- type CommandCondition
- type Config
- type ConfigList
- type ConfigSpec
- type Host
- type ImageList
- type ImageType
- type MountImage
- type RegistryConfig
- type SSH
- type StrategyType
Constants ¶
const ( AppImage ImageType = "application" RootfsImage ImageType = "rootfs" PatchImage ImageType = "patch" ImageKubeVersionKey = "version" ImageVIPKey = "vip" ImageKubeLvscareImageKey = "image" ImageKubeVersionEnvSysKey = "SEALOS_SYS_KUBE_VERSION" ImageSealosVersionEnvSysKey = "SEALOS_SYS_SEALOS_VERSION" ImageRunModeEnvSysKey = "SEALOS_SYS_RUN_MODE" ImageImageEndpointSysKey = "SEALOS_SYS_IMAGE_ENDPOINT" )
const ( ImageTypeVersionKeyV1Beta1 = "v1beta1" ImageTypeVersionKeyV1Beta2 = "v1beta2" )
const ( ClusterConditionTypeSuccess string = "ApplyClusterSuccess" ClusterConditionTypeError string = "ApplyClusterError" CommandConditionTypeSuccess string = "ApplyCommandSuccess" CommandConditionTypeError string = "ApplyCommandError" CommandConditionTypeCancelled string = "ApplyCommandCancelled" )
const (
DefaultLvsCareImage = "sealos.hub:5000/sealos/lvscare:latest"
)
const (
DefaultSSHPort = 22
)
const (
DefaultUserRoot = "root"
)
const GroupName = "apps.sealos.io"
GroupName is the group name use in this package
Variables ¶
var ( MASTER = "master" NODE = "node" REGISTRY = "registry" )
var ImageDistributionKeys = []string{imageDistributionKey, imageDistributionKeyV2}
var ImageTypeKeys = []string{imageTypeKey, imageTypeKeyV2}
var ImageVersionKeys = []string{imageVersionKey, imageVersionKeyV2}
var ImageVersionList = []string{ImageTypeVersionKeyV1Beta1, ImageTypeVersionKeyV1Beta2}
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
SchemeGroupVersion is group version used to register these objects
Functions ¶
func MergeEnvWithBuiltinKeys ¶
func MergeEnvWithBuiltinKeys(src map[string]string, m MountImage) map[string]string
Types ¶
type Cluster ¶
type Cluster struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec ClusterSpec `json:"spec,omitempty"` Status ClusterStatus `json:"status,omitempty"` }
Cluster is the Schema for the InfraMetadata API
func (*Cluster) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.
func (*Cluster) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Cluster) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*Cluster) GetAllLabels ¶
func (*Cluster) GetDistribution ¶
func (*Cluster) GetIPSByRole ¶
func (*Cluster) GetImageEndpoint ¶
func (*Cluster) GetLvscareImage ¶
func (*Cluster) GetMaster0IP ¶
func (*Cluster) GetMaster0IPAndPort ¶
func (*Cluster) GetMasterIPAndPortList ¶
func (*Cluster) GetMasterIPList ¶
func (*Cluster) GetNodeIPAndPortList ¶
func (*Cluster) GetNodeIPList ¶
func (*Cluster) GetRegistryIP ¶
func (*Cluster) GetRegistryIPAndPort ¶
func (*Cluster) GetRegistryIPAndPortList ¶
func (*Cluster) GetRegistryIPList ¶
func (*Cluster) GetRolesByIP ¶
func (*Cluster) GetRootfsImage ¶
func (c *Cluster) GetRootfsImage() *MountImage
func (*Cluster) ReplaceRootfsImage ¶
func (c *Cluster) ReplaceRootfsImage()
func (*Cluster) SetNewImages ¶
type ClusterCondition ¶
type ClusterCondition struct { Type string `json:"type"` Status v1.ConditionStatus `json:"status"` LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime,omitempty"` // +optional Reason string `json:"reason,omitempty"` // +optional Message string `json:"message,omitempty"` }
ClusterCondition describes the state of a cluster at a certain point.
func NewFailedClusterCondition ¶
func NewFailedClusterCondition(message string) ClusterCondition
func NewSuccessClusterCondition ¶
func NewSuccessClusterCondition() ClusterCondition
func UpdateCondition ¶
func UpdateCondition(conditions []ClusterCondition, condition ClusterCondition) []ClusterCondition
UpdateCondition updates condition in cluster conditions using giving condition adds condition if not existed
func (*ClusterCondition) DeepCopy ¶
func (in *ClusterCondition) DeepCopy() *ClusterCondition
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCondition.
func (*ClusterCondition) DeepCopyInto ¶
func (in *ClusterCondition) DeepCopyInto(out *ClusterCondition)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ClusterPhase ¶
type ClusterPhase string
const ( ClusterFailed ClusterPhase = "ClusterFailed" ClusterSuccess ClusterPhase = "ClusterSuccess" ClusterInProcess ClusterPhase = "ClusterInProcess" )
type ClusterSpec ¶
type ClusterSpec struct { // desired state of cluster // Important: Run "make" to regenerate code after modifying this file // Foo is an example field of Cluster. Edit Cluster_types.go to remove/update Image ImageList `json:"image,omitempty"` SSH SSH `json:"ssh"` Hosts []Host `json:"hosts,omitempty"` // Why env not using map[string]string // Because some argument is list, like: CertSANS=127.0.0.1 CertSANS=localhost, if ENV is map, will merge those two values // but user want to InfraMetadata a list, using array we can convert it to {CertSANS:[127.0.0.1, localhost]} Env []string `json:"env,omitempty"` // Entrypoint array. Not executed within a shell. // The docker image's ENTRYPOINT is used if this is not provided. // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable // cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced // to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will // produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless // of whether the variable exists or not. Cannot be updated. // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell // +optional Command []string `json:"command,omitempty"` }
ClusterSpec defines the desired state of InfraMetadata
func (*ClusterSpec) DeepCopy ¶
func (in *ClusterSpec) DeepCopy() *ClusterSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec.
func (*ClusterSpec) DeepCopyInto ¶
func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ClusterStatus ¶
type ClusterStatus struct { Phase ClusterPhase `json:"phase,omitempty"` Mounts []MountImage `json:"mounts,omitempty"` Conditions []ClusterCondition `json:"conditions,omitempty"` CommandConditions []CommandCondition `json:"commandCondition,omitempty"` }
func (*ClusterStatus) DeepCopy ¶
func (in *ClusterStatus) DeepCopy() *ClusterStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus.
func (*ClusterStatus) DeepCopyInto ¶
func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CommandCondition ¶
type CommandCondition struct { Type string `json:"type"` Status v1.ConditionStatus `json:"status"` LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime,omitempty"` // +optional Images []string `json:"images"` // +optional Reason string `json:"reason,omitempty"` // +optional Message string `json:"message,omitempty"` }
func NewCancelledCommandCondition ¶
func NewCancelledCommandCondition(message string) CommandCondition
func NewFailedCommandCondition ¶
func NewFailedCommandCondition(message string) CommandCondition
func UpdateCommandCondition ¶
func UpdateCommandCondition(cmdConditions []CommandCondition, cmdCondition CommandCondition) []CommandCondition
UpdateCommandCondition updates condition in cluster conditions using giving condition, append only
func (*CommandCondition) DeepCopy ¶
func (in *CommandCondition) DeepCopy() *CommandCondition
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommandCondition.
func (*CommandCondition) DeepCopyInto ¶
func (in *CommandCondition) DeepCopyInto(out *CommandCondition)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Config ¶
type Config struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec ConfigSpec `json:"spec,omitempty"` }
Config is the Schema for the configs API
func (*Config) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.
func (*Config) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Config) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ConfigList ¶
type ConfigList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []Config `json:"items"` }
ConfigList contains a list of Config
func (*ConfigList) DeepCopy ¶
func (in *ConfigList) DeepCopy() *ConfigList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigList.
func (*ConfigList) DeepCopyInto ¶
func (in *ConfigList) DeepCopyInto(out *ConfigList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ConfigList) DeepCopyObject ¶
func (in *ConfigList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ConfigSpec ¶
type ConfigSpec struct { Match string `json:"match,omitempty"` Strategy StrategyType `json:"strategy,omitempty"` Data string `json:"data,omitempty"` Path string `json:"path,omitempty"` }
ConfigSpec defines the desired state of Config
func (*ConfigSpec) DeepCopy ¶
func (in *ConfigSpec) DeepCopy() *ConfigSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigSpec.
func (*ConfigSpec) DeepCopyInto ¶
func (in *ConfigSpec) DeepCopyInto(out *ConfigSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Host ¶
type Host struct { IPS []string `json:"ips,omitempty"` Roles []string `json:"roles,omitempty"` Env []string `json:"env,omitempty"` // overwrite env SSH *SSH `json:"ssh,omitempty"` // overwrite global ssh config }
func (*Host) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Host.
func (*Host) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ImageList ¶
type ImageList []string
func (ImageList) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageList.
func (ImageList) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type MountImage ¶
type MountImage struct { Name string `json:"name"` Type ImageType `json:"type"` ImageName string `json:"imageName"` MountPoint string `json:"mountPoint"` Env map[string]string `json:"env,omitempty"` Labels map[string]string `json:"labels,omitempty"` Cmd []string `json:"cmd,omitempty"` Entrypoint []string `json:"entrypoint,omitempty"` }
func (*MountImage) DeepCopy ¶
func (in *MountImage) DeepCopy() *MountImage
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MountImage.
func (*MountImage) DeepCopyInto ¶
func (in *MountImage) DeepCopyInto(out *MountImage)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*MountImage) IsApplication ¶
func (m *MountImage) IsApplication() bool
func (*MountImage) IsPatch ¶
func (m *MountImage) IsPatch() bool
func (*MountImage) IsRootFs ¶
func (m *MountImage) IsRootFs() bool
func (*MountImage) KubeVersion ¶
func (m *MountImage) KubeVersion() string
type RegistryConfig ¶
type RegistryConfig struct { IP string `json:"ip,omitempty"` Domain string `json:"domain,omitempty"` Port string `json:"port,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Data string `json:"data,omitempty"` }
func (*RegistryConfig) DeepCopy ¶
func (in *RegistryConfig) DeepCopy() *RegistryConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryConfig.
func (*RegistryConfig) DeepCopyInto ¶
func (in *RegistryConfig) DeepCopyInto(out *RegistryConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SSH ¶
type SSH struct { User string `json:"user,omitempty"` Passwd string `json:"passwd,omitempty"` PkName string `json:"pkName,omitempty"` PkData string `json:"pkData,omitempty"` Pk string `json:"pk,omitempty"` PkPasswd string `json:"pkPasswd,omitempty"` Port uint16 `json:"port,omitempty"` }
func (*SSH) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SSH.
func (*SSH) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*SSH) DefaultPort ¶
type StrategyType ¶
type StrategyType string
const ( Merge StrategyType = "merge" Override StrategyType = "override" Insert StrategyType = "insert" Append StrategyType = "append" )