rainbond: github.com/goodrain/rainbond/worker/appm/types/v1 Index | Files

package v1

import "github.com/goodrain/rainbond/worker/appm/types/v1"


Package Files

endpoint.go labels.go patch.go pod_status.go status.go storeage_class.go v1.go


var (
    //RUNNING if stateful or deployment exist and ready pod number is equal to the service Replicas
    RUNNING = "running"
    //CLOSED if app service is not in store
    CLOSED = "closed"
    //STARTING if stateful or deployment exist and ready pod number is less than service Replicas
    STARTING = "starting"
    //STOPPING if stateful and deployment is nil and pod number is not 0
    STOPPING = "stopping"
    //ABNORMAL if stateful or deployment exist and ready pod number is less than service Replicas and all pod status is Error
    ABNORMAL = "abnormal"
    //SOMEABNORMAL if stateful or deployment exist and ready pod number is less than service Replicas and some pod status is Error
    SOMEABNORMAL = "some_abnormal"
    //UNKNOW indeterminacy status
    UNKNOW = "unknow"
    //UPGRADE if store have more than 1 app service
    UPGRADE = "upgrade"
    //BUILDING app service is building
    BUILDING = "building"
    //BUILDEFAILURE app service is build failure
    BUILDEFAILURE = "build_failure"
    //UNDEPLOY init status
    UNDEPLOY = "undeploy"
    //WAITTING wait depend service start
    WAITTING = "waitting"
var RainbondStatefuleLocalStorageClass = "rainbondslsc"

RainbondStatefuleLocalStorageClass rainbond support statefulset app local volume

var RainbondStatefuleShareStorageClass = "rainbondsssc"

RainbondStatefuleShareStorageClass rainbond support statefulset app share volume

func GetInitStorageClass Uses

func GetInitStorageClass() []*storagev1.StorageClass

GetInitStorageClass get init storageclass list

func GetProbeMeshImageName Uses

func GetProbeMeshImageName() string

GetProbeMeshImageName get probe init mesh image name

func GetReplicaSetVersion Uses

func GetReplicaSetVersion(rs *v1.ReplicaSet) int

GetReplicaSetVersion get rs version

func GetTCPMeshImageName Uses

func GetTCPMeshImageName() string

GetTCPMeshImageName get tcp mesh image name

func IsPodNodeLost Uses

func IsPodNodeLost(pod *corev1.Pod) bool

IsPodNodeLost node loss pod

func IsPodTerminated Uses

func IsPodTerminated(pod *corev1.Pod) bool

IsPodTerminated Exception evicted pod

type AbnormalInfo Uses

type AbnormalInfo struct {
    ServiceID     string    `json:"service_id"`
    TenantID      string    `json:"tenant_id"`
    ServiceAlias  string    `json:"service_alias"`
    PodName       string    `json:"pod_name"`
    ContainerName string    `json:"container_name"`
    Reason        string    `json:"reson"`
    Message       string    `json:"message"`
    CreateTime    time.Time `json:"create_time"`
    Count         int       `json:"count"`

AbnormalInfo pod Abnormal info Record the container exception exit information in pod.

func (AbnormalInfo) Hash Uses

func (a AbnormalInfo) Hash() string

Hash get AbnormalInfo hash

func (AbnormalInfo) String Uses

func (a AbnormalInfo) String() string

type AppService Uses

type AppService struct {

    BootSeqContainer *corev1.Container
    Logger           event.Logger

    UpgradePatch map[string][]byte
    CustomParams map[string]string
    // contains filtered or unexported fields

AppService a service of rainbond app state in kubernetes

func (*AppService) AddEndpoints Uses

func (a *AppService) AddEndpoints(ep *corev1.Endpoints)

AddEndpoints adds k8s endpoints to receiver *AppService.

func (*AppService) DelEndpoints Uses

func (a *AppService) DelEndpoints(ep *corev1.Endpoints)

DelEndpoints deletes *corev1.Endpoints

func (*AppService) DelHPA Uses

func (a *AppService) DelHPA(hpa *autoscalingv2.HorizontalPodAutoscaler)

DelHPA -

func (*AppService) DeleteClaim Uses

func (a *AppService) DeleteClaim(claim *corev1.PersistentVolumeClaim)

DeleteClaim delete claim

func (*AppService) DeleteConfigMaps Uses

func (a *AppService) DeleteConfigMaps(config *corev1.ConfigMap)

DeleteConfigMaps delete configmaps

func (*AppService) DeleteDeployment Uses

func (a *AppService) DeleteDeployment(d *v1.Deployment)

DeleteDeployment delete kubernetes deployment model

func (*AppService) DeleteIngress Uses

func (a *AppService) DeleteIngress(d *extensions.Ingress)

DeleteIngress delete kubernetes ingress model

func (*AppService) DeletePods Uses

func (a *AppService) DeletePods(d *corev1.Pod)

DeletePods delete pod

func (*AppService) DeleteReplicaSet Uses

func (a *AppService) DeleteReplicaSet(d *v1.ReplicaSet)

DeleteReplicaSet delete replicaset

func (*AppService) DeleteSecrets Uses

func (a *AppService) DeleteSecrets(d *corev1.Secret)

DeleteSecrets set secrets

func (*AppService) DeleteServiceMonitor Uses

func (a *AppService) DeleteServiceMonitor(sm *monitorv1.ServiceMonitor)

DeleteServiceMonitor delete service monitor

func (*AppService) DeleteServices Uses

func (a *AppService) DeleteServices(service *corev1.Service)

DeleteServices delete service

func (*AppService) DeleteStatefulSet Uses

func (a *AppService) DeleteStatefulSet(d *v1.StatefulSet)

DeleteStatefulSet set kubernetes statefulset model

func (*AppService) DeleteStorageClass Uses

func (a *AppService) DeleteStorageClass(sc *storagev1.StorageClass)

DeleteStorageClass deelete storageclass

func (*AppService) DistinguishPod Uses

func (a *AppService) DistinguishPod(pod *corev1.Pod) bool

DistinguishPod uses replica set to distinguish between old and new pods true: new pod; false: old pod.

func (*AppService) GetCPURequest Uses

func (a *AppService) GetCPURequest() (res int64)

GetCPURequest get component cpu request

func (*AppService) GetClaims Uses

func (a *AppService) GetClaims() []*corev1.PersistentVolumeClaim

GetClaims get claims

func (*AppService) GetClaimsManually Uses

func (a *AppService) GetClaimsManually() []*corev1.PersistentVolumeClaim

GetClaimsManually get claims

func (*AppService) GetCommonLabels Uses

func (a *AppService) GetCommonLabels(labels ...map[string]string) map[string]string

GetCommonLabels get common labels

func (*AppService) GetConfigMaps Uses

func (a *AppService) GetConfigMaps() []*corev1.ConfigMap

GetConfigMaps get configmaps

func (*AppService) GetCurrentReplicaSet Uses

func (a *AppService) GetCurrentReplicaSet() *v1.ReplicaSet

GetCurrentReplicaSet get current replicaset

func (*AppService) GetDelHPAs Uses

func (a *AppService) GetDelHPAs() []*autoscalingv2.HorizontalPodAutoscaler

GetDelHPAs -

func (*AppService) GetDelIngs Uses

func (a *AppService) GetDelIngs() []*extensions.Ingress

GetDelIngs gets delIngs which need to be deleted

func (*AppService) GetDelSecrets Uses

func (a *AppService) GetDelSecrets() []*corev1.Secret

GetDelSecrets get delSecrets which need to be deleted

func (*AppService) GetDelServices Uses

func (a *AppService) GetDelServices() []*corev1.Service

GetDelServices returns services that need to be deleted.

func (AppService) GetDeployment Uses

func (a AppService) GetDeployment() *v1.Deployment

GetDeployment get kubernetes deployment model

func (*AppService) GetEndpoints Uses

func (a *AppService) GetEndpoints(canCopy bool) []*corev1.Endpoints

GetEndpoints returns endpoints in AppService

func (*AppService) GetEndpointsByName Uses

func (a *AppService) GetEndpointsByName(name string) *corev1.Endpoints

GetEndpointsByName returns endpoints in AppService

func (*AppService) GetHPAs Uses

func (a *AppService) GetHPAs() []*autoscalingv2.HorizontalPodAutoscaler

GetHPAs -

func (*AppService) GetIngress Uses

func (a *AppService) GetIngress(canCopy bool) []*extensions.Ingress

GetIngress get ingress

func (*AppService) GetMemoryRequest Uses

func (a *AppService) GetMemoryRequest() (res int64)

GetMemoryRequest get component memory request

func (*AppService) GetNewestReplicaSet Uses

func (a *AppService) GetNewestReplicaSet() (newest *v1.ReplicaSet)

GetNewestReplicaSet returns the newest replica set.

func (*AppService) GetPodTemplate Uses

func (a *AppService) GetPodTemplate() *corev1.PodTemplateSpec

GetPodTemplate get pod template

func (*AppService) GetPods Uses

func (a *AppService) GetPods(canCopy bool) []*corev1.Pod

GetPods get pods

func (*AppService) GetPodsByName Uses

func (a *AppService) GetPodsByName(podname string) *corev1.Pod

GetPodsByName returns the pod based on podname.

func (*AppService) GetReadyReplicas Uses

func (a *AppService) GetReadyReplicas() int32

GetReadyReplicas get already ready pod number

func (*AppService) GetReplicaSets Uses

func (a *AppService) GetReplicaSets() []*v1.ReplicaSet

GetReplicaSets get replicaset

func (*AppService) GetRunningVersion Uses

func (a *AppService) GetRunningVersion() string

GetRunningVersion get running version

func (*AppService) GetSecrets Uses

func (a *AppService) GetSecrets(canCopy bool) []*corev1.Secret

GetSecrets get secrets

func (*AppService) GetServiceMonitors Uses

func (a *AppService) GetServiceMonitors(canCopy bool) []*monitorv1.ServiceMonitor

GetServiceMonitors -

func (*AppService) GetServiceStatus Uses

func (a *AppService) GetServiceStatus() string

GetServiceStatus get service status

func (*AppService) GetServices Uses

func (a *AppService) GetServices(canCopy bool) []*corev1.Service

GetServices get services

func (AppService) GetStatefulSet Uses

func (a AppService) GetStatefulSet() *v1.StatefulSet

GetStatefulSet get kubernetes statefulset model

func (*AppService) GetTenant Uses

func (a *AppService) GetTenant() *corev1.Namespace

GetTenant get tenant namespace

func (*AppService) IsClosed Uses

func (a *AppService) IsClosed() bool

IsClosed is closed

func (*AppService) IsEmpty Uses

func (a *AppService) IsEmpty() bool

IsEmpty is empty

func (*AppService) IsWaitting Uses

func (a *AppService) IsWaitting() bool

IsWaitting service status is waitting init container init-probe is running

func (*AppService) Ready Uses

func (a *AppService) Ready() bool

Ready Whether ready

func (*AppService) SetAllSecrets Uses

func (a *AppService) SetAllSecrets(secrets []*corev1.Secret)

SetAllSecrets sets secrets

func (*AppService) SetClaim Uses

func (a *AppService) SetClaim(claim *corev1.PersistentVolumeClaim)

SetClaim set claim

func (*AppService) SetClaimManually Uses

func (a *AppService) SetClaimManually(claim *corev1.PersistentVolumeClaim)

SetClaimManually sets claim that needs to be created manually.

func (*AppService) SetConfigMap Uses

func (a *AppService) SetConfigMap(d *corev1.ConfigMap)

SetConfigMap set kubernetes configmap model

func (*AppService) SetDeletedResources Uses

func (a *AppService) SetDeletedResources(old *AppService)

SetDeletedResources sets the resources that need to be deleted

func (*AppService) SetDeployment Uses

func (a *AppService) SetDeployment(d *v1.Deployment)

SetDeployment set kubernetes deployment model

func (*AppService) SetHPA Uses

func (a *AppService) SetHPA(hpa *autoscalingv2.HorizontalPodAutoscaler)

SetHPA -

func (*AppService) SetHPAs Uses

func (a *AppService) SetHPAs(hpas []*autoscalingv2.HorizontalPodAutoscaler)

SetHPAs -

func (*AppService) SetIngress Uses

func (a *AppService) SetIngress(d *extensions.Ingress)

SetIngress set kubernetes ingress model

func (*AppService) SetIngresses Uses

func (a *AppService) SetIngresses(i []*extensions.Ingress)

SetIngresses sets k8s ingress list

func (*AppService) SetPodTemplate Uses

func (a *AppService) SetPodTemplate(d corev1.PodTemplateSpec)

SetPodTemplate set pod template spec

func (*AppService) SetPods Uses

func (a *AppService) SetPods(d *corev1.Pod)

SetPods set pod

func (*AppService) SetReplicaSets Uses

func (a *AppService) SetReplicaSets(d *v1.ReplicaSet)

SetReplicaSets set kubernetes replicaset

func (*AppService) SetSecret Uses

func (a *AppService) SetSecret(d *corev1.Secret)

SetSecret set srcrets

func (*AppService) SetSecrets Uses

func (a *AppService) SetSecrets(s []*corev1.Secret)

SetSecrets sets k8s secret list

func (*AppService) SetService Uses

func (a *AppService) SetService(d *corev1.Service)

SetService set kubernetes service model

func (*AppService) SetServiceMonitor Uses

func (a *AppService) SetServiceMonitor(sm *monitorv1.ServiceMonitor)

SetServiceMonitor -

func (*AppService) SetServices Uses

func (a *AppService) SetServices(svcs []*corev1.Service)

SetServices set set k8s service model list

func (*AppService) SetStatefulSet Uses

func (a *AppService) SetStatefulSet(d *v1.StatefulSet)

SetStatefulSet set kubernetes statefulset model

func (*AppService) SetStorageClass Uses

func (a *AppService) SetStorageClass(sc *storagev1.StorageClass)

SetStorageClass set storageclass

func (*AppService) SetTenant Uses

func (a *AppService) SetTenant(d *corev1.Namespace)

SetTenant set tenant

func (*AppService) SetUpgradePatch Uses

func (a *AppService) SetUpgradePatch(new *AppService) error

SetUpgradePatch create and set upgrade pathch for deployment and statefulset

func (*AppService) String Uses

func (a *AppService) String() string

func (*AppService) UpgradeComlete Uses

func (a *AppService) UpgradeComlete() bool

UpgradeComlete upgrade comlete

type AppServiceBase Uses

type AppServiceBase struct {
    TenantID         string
    TenantName       string
    AppID            string
    ServiceID        string
    ServiceAlias     string
    ServiceType      AppServiceType
    ServiceKind      model.ServiceKind
    DeployVersion    string
    ContainerCPU     int
    ContainerMemory  int
    UpgradeMethod    TypeUpgradeMethod
    Replicas         int
    NeedProxy        bool
    IsWindowsService bool
    CreaterID        string
    //depend all service id
    Dependces    []string
    ExtensionSet map[string]string

AppServiceBase app service base info

type AppServiceStatus Uses

type AppServiceStatus string

AppServiceStatus the status of service, calculate in real time from kubernetes

type AppServiceType Uses

type AppServiceType string

AppServiceType the deploy type of service.

var TypeDeployment AppServiceType = "deployment"

TypeDeployment deployment

var TypeReplicationController AppServiceType = "replicationcontroller"

TypeReplicationController rc

var TypeStatefulSet AppServiceType = "statefulset"

TypeStatefulSet statefulset

type CacheKey Uses

type CacheKey string

CacheKey app cache key

func GetCacheKeyOnlyServiceID Uses

func GetCacheKeyOnlyServiceID(serviceID string) CacheKey

GetCacheKeyOnlyServiceID get cache key only service id

func (CacheKey) Equal Uses

func (c CacheKey) Equal(end CacheKey) bool

Equal cache key serviceid and version and createID Equal

type EncodeNode Uses

type EncodeNode struct {
    Field map[string]EncodeNode
    // contains filtered or unexported fields

EncodeNode encode node

func (*EncodeNode) Contrast Uses

func (e *EncodeNode) Contrast(endpoint *EncodeNode) bool

Contrast Compare value

func (*EncodeNode) GetChange Uses

func (e *EncodeNode) GetChange(endpoint *EncodeNode) *EncodeNode

GetChange get change fields

func (*EncodeNode) MarshalJSON Uses

func (e *EncodeNode) MarshalJSON() ([]byte, error)

MarshalJSON custom marshal json

func (*EncodeNode) UnmarshalJSON Uses

func (e *EncodeNode) UnmarshalJSON(code []byte) error

UnmarshalJSON custom yaml decoder

type Event Uses

type Event struct {
    Type    EventType
    Sid     string // service id
    Port    int
    IsInner bool

Event holds the context of a start event.

type EventType Uses

type EventType string

EventType type of event

const (
    // StartEvent event about to start third-party service
    StartEvent EventType = "START"
    // StopEvent event about to stop third-party service
    StopEvent EventType = "STOP"

type K8sResources Uses

type K8sResources struct {
    Services  []*corev1.Service
    Secrets   []*corev1.Secret
    Ingresses []*extensions.Ingress

K8sResources holds kubernetes resources(svc, sercert, ep, ing).

type PodResource Uses

type PodResource struct {
    MemoryRequest int64
    MemoryLimit   int64
    CPURequest    int64
    CPULimit      int64
    NodeName      string

PodResource resource struct

func CalculatePodResource Uses

func CalculatePodResource(pod *corev1.Pod) *PodResource

CalculatePodResource calculate pod resource

type RbdEndpoint Uses

type RbdEndpoint struct {
    UUID     string `json:"uuid"`
    Sid      string `json:"sid"`
    IP       string `json:"ip"`
    Port     int    `json:"port"`
    Status   string `json:"status"`
    IsOnline bool   `json:"is_online"`
    Action   string `json:"action"`
    IsDomain bool   `json:"is_domain"`

RbdEndpoint hold information to create k8s endpoints.

func (*RbdEndpoint) Equal Uses

func (l1 *RbdEndpoint) Equal(l2 *RbdEndpoint) bool

Equal tests for equality between two RbdEndpoint types

type RbdEndpoints Uses

type RbdEndpoints struct {
    Port        int      `json:"port"`
    IPs         []string `json:"ips"`
    NotReadyIPs []string `json:"not_ready_ips"`

RbdEndpoints is a collection of RbdEndpoint.

type TenantResource Uses

type TenantResource struct {
    TenantID         string `json:"tenant_id,omitempty"`
    CPURequest       int64  `json:"cpu_request,omitempty"`
    CPULimit         int64  `json:"cpu_limit,omitempty"`
    MemoryRequest    int64  `json:"memory_request,omitempty"`
    MemoryLimit      int64  `json:"memory_limit,omitempty"`
    UnscdCPUReq      int64  `json:"unscd_cpu_req,omitempty"`
    UnscdCPULimit    int64  `json:"unscd_cpu_limit,omitempty"`
    UnscdMemoryReq   int64  `json:"unscd_memory_req,omitempty"`
    UnscdMemoryLimit int64  `json:"unscd_memory_limit,omitempty"`

TenantResource tenant resource statistical models

type TypeUpgradeMethod Uses

type TypeUpgradeMethod string

TypeUpgradeMethod upgrade service method type

var OnDelete TypeUpgradeMethod = "OnDelete"

OnDelete Stop the old version before starting the new version the upgrade

var Rolling TypeUpgradeMethod = "Rolling"

Rolling Start the new version before stoping the old version the rolling upgrade

Package v1 imports 20 packages (graph) and is imported by 15 packages. Updated 2020-10-25. Refresh now. Tools for package owners.