Documentation ¶
Index ¶
- Constants
- func CalcActiveDeploymentCount(deployments []*appsv1.Deployment) int32
- func CalcActivePodCount(pods []*v1.Pod) int32
- func ConvertK8SValidName(name string) string
- func ConvertMapToMetrics(metric map[string]interface{}) []sednav1.Metric
- func CreateDeploymentWithTemplate(client kubernetes.Interface, object CommonInterface, ...) (*appsv1.Deployment, error)
- func CreateEdgeMeshService(kubeClient kubernetes.Interface, object CommonInterface, workerType string, ...) (string, error)
- func CreateKubernetesService(kubeClient kubernetes.Interface, object CommonInterface, workerType string, ...) (int32, error)
- func CreatePodWithTemplate(client kubernetes.Interface, object CommonInterface, spec *v1.PodTemplateSpec, ...) (*v1.Pod, error)
- func GenerateSelector(object CommonInterface) (labels.Selector, error)
- func GenerateWorkerSelector(object CommonInterface, workerType string) (labels.Selector, error)
- func GetBackoff(queue workqueue.RateLimitingInterface, key interface{}) time.Duration
- func GetModelHotUpdateConfigFile(object CommonInterface, prefix string) string
- func GetNodeIPByName(kubeClient kubernetes.Interface, name string) (string, error)
- func InjectSecretAnnotations(client kubernetes.Interface, obj CommonInterface, secretName string) (err error)
- func InjectStorageInitializer(pod *v1.Pod, workerParam *WorkerParam)
- func InjectStorageInitializerDeployment(deployment *appsv1.Deployment, workerParam *WorkerParam)
- func MergeSecretEnvs(nowE, newE []v1.EnvVar, overwrite bool) []v1.EnvVar
- func PrepareHostPath(workerParam *WorkerParam) ([]v1.Volume, []v1.VolumeMount, []v1.VolumeMount)
- func PrepareInitContainer(workerParam *WorkerParam) ([]v1.Volume, []v1.VolumeMount, *v1.Container)
- func PrepareSecret(workerParam *WorkerParam) []v1.EnvVar
- func PrepareStorage(workerParam *WorkerParam)
- func RetryUpdateStatus(name, namespace string, updateStatusFunc func() error) error
- type BaseControllerI
- type CommonInterface
- type ControllerContext
- type DownstreamSendFunc
- type FeatureControllerI
- type Model
- type ModelHotUpdate
- type MountURL
- type UpstreamHandler
- type UpstreamHandlerAddFunc
- type WorkerMount
- type WorkerParam
Constants ¶
const ( S3EndpointKey = "s3-endpoint" S3UseHTTPSKey = "s3-usehttps" // env name S3EndpointURLEnv = "S3_ENDPOINT_URL" AccessKeyID = "ACCESS_KEY_ID" // env name AccessKeyIDEnv = "ACCESS_KEY_ID" SecretAccessKey = "SECRET_ACCESS_KEY" // env name SecretAccessKeyEnv = "SECRET_ACCESS_KEY" SecretAnnotationKey = "sedna.io/credential" )
const ( // DefaultBackOff is the default backoff period DefaultBackOff = 10 * time.Second // MaxBackOff is the max backoff period MaxBackOff = 360 * time.Second // TrainPodType is type of train pod TrainPodType = "train" // EvalPodType is type of eval pod EvalPodType = "eval" // InferencePodType is type of inference pod InferencePodType = "inference" // AnnotationsKeyPrefix defines prefix of key in annotations AnnotationsKeyPrefix = "sedna.io/" ModelHotUpdateHostPrefix = "/var/lib/sedna/model-hot-update" ModelHotUpdateContainerPrefix = "/model-hot-update" ModelHotUpdateVolumeName = "sedna-model-hot-update-volume" ModelHotUpdateConfigFile = "model_config.json" ModelHotUpdateAnnotationsKey = "sedna.io/model-hot-update-config" )
Variables ¶
This section is empty.
Functions ¶
func CalcActiveDeploymentCount ¶ added in v0.4.2
func CalcActiveDeploymentCount(deployments []*appsv1.Deployment) int32
func CalcActivePodCount ¶
func ConvertK8SValidName ¶
ConvertK8SValidName converts to the k8s valid name
func ConvertMapToMetrics ¶
ConvertMapToMetrics converts the metric map to list of resource Metric
func CreateDeploymentWithTemplate ¶ added in v0.4.2
func CreateDeploymentWithTemplate(client kubernetes.Interface, object CommonInterface, spec *appsv1.DeploymentSpec, workerParam *WorkerParam, port int32) (*appsv1.Deployment, error)
CreateDeploymentWithTemplate creates and returns a deployment object given a crd object, deployment template
func CreateEdgeMeshService ¶ added in v0.4.2
func CreateEdgeMeshService(kubeClient kubernetes.Interface, object CommonInterface, workerType string, servicePort int32) (string, error)
CreateEdgeMeshService creates a kubeedge edgemesh service for an object, and returns an edgemesh service URL. Since edgemesh can realize Cross-Edge-Cloud communication, the service can be created both on the cloud or edge side.
func CreateKubernetesService ¶
func CreateKubernetesService(kubeClient kubernetes.Interface, object CommonInterface, workerType string, inputPort int32, inputIP string) (int32, error)
CreateKubernetesService creates a k8s service for an object given ip and port
func CreatePodWithTemplate ¶
func CreatePodWithTemplate(client kubernetes.Interface, object CommonInterface, spec *v1.PodTemplateSpec, workerParam *WorkerParam) (*v1.Pod, error)
CreatePodWithTemplate creates and returns a pod object given a crd object, pod template, and workerParam
func GenerateSelector ¶
func GenerateSelector(object CommonInterface) (labels.Selector, error)
GenerateSelector generates the selector of an object for worker
func GenerateWorkerSelector ¶ added in v0.4.2
func GenerateWorkerSelector(object CommonInterface, workerType string) (labels.Selector, error)
GenerateWorkerSelector generates the selector of an object for specific worker type
func GetBackoff ¶
func GetBackoff(queue workqueue.RateLimitingInterface, key interface{}) time.Duration
GetBackoff calc the next wait time for the key
func GetModelHotUpdateConfigFile ¶ added in v0.4.0
func GetModelHotUpdateConfigFile(object CommonInterface, prefix string) string
func GetNodeIPByName ¶
func GetNodeIPByName(kubeClient kubernetes.Interface, name string) (string, error)
GetNodeIPByName get node ip by node name
func InjectSecretAnnotations ¶
func InjectSecretAnnotations(client kubernetes.Interface, obj CommonInterface, secretName string) (err error)
func InjectStorageInitializer ¶
func InjectStorageInitializer(pod *v1.Pod, workerParam *WorkerParam)
InjectStorageInitializer injects these storage related volumes and envs into pod in-place
func InjectStorageInitializerDeployment ¶ added in v0.5.1
func InjectStorageInitializerDeployment(deployment *appsv1.Deployment, workerParam *WorkerParam)
InjectStorageInitializer injects these storage related volumes and envs into deployment in-place
func MergeSecretEnvs ¶
MergeSecretEnvs merges two EnvVar list
func PrepareHostPath ¶ added in v0.5.1
func PrepareHostPath(workerParam *WorkerParam) ([]v1.Volume, []v1.VolumeMount, []v1.VolumeMount)
func PrepareInitContainer ¶ added in v0.5.1
func PrepareInitContainer(workerParam *WorkerParam) ([]v1.Volume, []v1.VolumeMount, *v1.Container)
func PrepareSecret ¶ added in v0.5.1
func PrepareSecret(workerParam *WorkerParam) []v1.EnvVar
func PrepareStorage ¶ added in v0.5.1
func PrepareStorage(workerParam *WorkerParam)
func RetryUpdateStatus ¶
RetryUpdateStatus simply retries to call the status update func
Types ¶
type BaseControllerI ¶
type BaseControllerI interface {
Run(stopCh <-chan struct{})
}
BaseControllerI defines the interface of an controller
type CommonInterface ¶
type CommonInterface interface { metav1.Object schema.ObjectKind k8sruntime.Object }
CommonInterface describes the commom interface of CRs
type ControllerContext ¶
type ControllerContext struct { Config *config.ControllerConfig KubeClient kubernetes.Interface KubeInformerFactory kubeinformers.SharedInformerFactory SednaClient sednaclientset.Interface SednaInformerFactory sednainformers.SharedInformerFactory }
ControllerContext defines the context that all feature controller share and belong to
type DownstreamSendFunc ¶
DownstreamSendFunc is the send function for feature controllers to sync the resource updates(spec and status) to LC
type FeatureControllerI ¶
type FeatureControllerI interface { BaseControllerI // SetDownstreamSendFunc sets up the downstream send function in the feature controller SetDownstreamSendFunc(f DownstreamSendFunc) error // SetUpstreamHandler sets up the upstream handler function for the feature controller SetUpstreamHandler(add UpstreamHandlerAddFunc) error }
FeatureControllerI defines the interface of an AI Feature controller
type Model ¶
type ModelHotUpdate ¶ added in v0.4.0
type MountURL ¶
type MountURL struct { // URL is the url of dataset/model URL string // Indirect indicates the url is indirect, need to parse its content and download all, // and is used in dataset which has index url. // // when Indirect = true, URL could be in host path filesystem. // default: false Indirect bool // DownloadByInitializer indicates whether the url need to be download by initializer. DownloadByInitializer bool // IsDir indicates that url is directory IsDir bool // if true, only mounts when url is hostpath EnableIfHostPath bool // the container path ContainerPath string // indicates the path this url will be mounted into container. // can be ContainerPath or its parent dir MountPath string // for host path, we just need to mount without downloading HostPath string // for download DownloadSrcURL string DownloadDstDir string // if true, then no mount Disable bool // the relevant secret Secret *v1.Secret SecretEnvs []v1.EnvVar // contains filtered or unexported fields }
type UpstreamHandler ¶
UpstreamHandler is the function definition for handling the upstream updates, i.e. resource updates(mainly status) from LC(running at edge)
type UpstreamHandlerAddFunc ¶
type UpstreamHandlerAddFunc = func(kind string, updateHandler UpstreamHandler) error
UpstreamHandlerAddFunc defines the upstream controller register function for adding handler
type WorkerMount ¶
type WorkerParam ¶
type WorkerParam struct { Mounts []WorkerMount Env map[string]string WorkerType string // if true, force to use hostNetwork HostNetwork bool ModelHotUpdate ModelHotUpdate RestartPolicy v1.RestartPolicy DNSPolicy v1.DNSPolicy }
WorkerParam describes the system-defined parameters of worker