Documentation ¶
Index ¶
- Constants
- func GenerateKubeconfigInCluster() ([]byte, error)
- func IngressNamespacedName(cloudshell *cloudshellv1alpha1.CloudShell) types.NamespacedName
- func IsCloudShellReady(cloudshell *cloudshellv1alpha1.CloudShell) bool
- func IsCloudshellFinished(cloudsehll *cloudshellv1alpha1.CloudShell) bool
- func IsJobFinished(job *batchv1.Job) (bool, batchv1.JobConditionType)
- func SetRouteRulePath(cloudshell *cloudshellv1alpha1.CloudShell) string
- func VsNamespacedName(cloudshell *cloudshellv1alpha1.CloudShell) types.NamespacedName
- type Controller
- func (c *Controller) CreateCloudShellService(cloudshell *cloudshellv1alpha1.CloudShell, worker *corev1.Pod) (*corev1.Service, error)
- func (c *Controller) CreateIngressForCloudshell(ctx context.Context, service string, cloudshell *cloudshellv1alpha1.CloudShell) error
- func (c *Controller) CreateRouteRule(ctx context.Context, cloudshell *cloudshellv1alpha1.CloudShell, ...) (string, error)
- func (c *Controller) CreateServiceFor(_ context.Context, worker *corev1.Pod) error
- func (c *Controller) CreateVirtualServiceForCloudshell(ctx context.Context, service string, cloudshell *cloudshellv1alpha1.CloudShell) error
- func (c *Controller) GetBindingWorkerFor(cloudshell *cloudshellv1alpha1.CloudShell) (*corev1.Pod, error)
- func (c *Controller) GetMasterNodeIP(ctx context.Context) (string, error)
- func (c *Controller) ResetWorker(_ context.Context, cloudshell *cloudshellv1alpha1.CloudShell) error
- func (c *Controller) Run(workers int, stopCh <-chan struct{})
- func (c *Controller) StartupWorker(_ context.Context, cloudshell *cloudshellv1alpha1.CloudShell, ...) error
- func (c *Controller) StartupWorkerFor(ctx context.Context, cloudshell *cloudshellv1alpha1.CloudShell) error
- func (c *Controller) UpdateCloudshellStatus(ctx context.Context, cloudshell *cloudshellv1alpha1.CloudShell, phase string) error
Constants ¶
const ( // CloudshellControllerFinalizer is added to cloudshell to ensure Work as well as the // execution space (namespace) is deleted before itself is deleted. CloudshellControllerFinalizer = "cloudtty.io/cloudshell-controller" // DefaultCloudShellBackOff is the default backoff period. Exported for tests. DefaultCloudShellBackOff = 2 * time.Second // MaxCloudShellBackOff is the max backoff period. Exported for tests. MaxCloudShellBackOff = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func GenerateKubeconfigInCluster ¶
GenerateKubeconfigInCluster load serviceaccount info under "/var/run/secrets/kubernetes.io/serviceaccount" and generate kubeconfig str.
func IngressNamespacedName ¶
func IngressNamespacedName(cloudshell *cloudshellv1alpha1.CloudShell) types.NamespacedName
IngressNamespacedName return a namespacedName according to ingressConfig.
func IsCloudShellReady ¶ added in v0.5.8
func IsCloudShellReady(cloudshell *cloudshellv1alpha1.CloudShell) bool
func IsCloudshellFinished ¶
func IsCloudshellFinished(cloudsehll *cloudshellv1alpha1.CloudShell) bool
IsCloudshellFinished checks whether the given cloudshell has finished execution. It does not discriminate between successful and failed terminations.
func IsJobFinished ¶
func IsJobFinished(job *batchv1.Job) (bool, batchv1.JobConditionType)
IsJobFinished checks whether the given Job has finished execution. It does not discriminate between successful and failed terminations.
func SetRouteRulePath ¶
func SetRouteRulePath(cloudshell *cloudshellv1alpha1.CloudShell) string
SetRouteRulePath return access url according to cloudshell.
func VsNamespacedName ¶
func VsNamespacedName(cloudshell *cloudshellv1alpha1.CloudShell) types.NamespacedName
VsNamespacedName return a namespacedName according to virtaulServiceConfig.
Types ¶
type Controller ¶ added in v0.6.0
type Controller struct { client.Client Scheme *runtime.Scheme // contains filtered or unexported fields }
Controller reconciles a CloudShell object
func New ¶ added in v0.5.8
func New(client client.Client, config *rest.Config, wp *worerkpool.WorkerPool, cloudshellImage string, cloudshellInformer cloudshellinformers.CloudShellInformer, podInformer informercorev1.PodInformer, ) *Controller
func (*Controller) CreateCloudShellService ¶ added in v0.6.0
func (c *Controller) CreateCloudShellService(cloudshell *cloudshellv1alpha1.CloudShell, worker *corev1.Pod) (*corev1.Service, error)
CreateCloudShellService Create service resource for cloudshell, the service type is either ClusterIP, NodePort, Ingress or virtualService. if the expose model is ingress or virtualService. it will create clusterIP type service.
func (*Controller) CreateIngressForCloudshell ¶ added in v0.6.0
func (c *Controller) CreateIngressForCloudshell(ctx context.Context, service string, cloudshell *cloudshellv1alpha1.CloudShell) error
CreateIngressForCloudshell create ingress for cloudshell, if there isn't an ingress controller server in the cluster, the ingress is still not working. before create ingress, there's must a service as the ingress backend service. all of services should be loaded in an ingress "cloudshell-ingress".
func (*Controller) CreateRouteRule ¶ added in v0.6.0
func (c *Controller) CreateRouteRule(ctx context.Context, cloudshell *cloudshellv1alpha1.CloudShell, worker *corev1.Pod) (string, error)
CreateRouteRule create a service resource in the same namespace of cloudshell no matter what expose model. if the expose model is ingress or virtualService, it will create additional resources, e.g: ingress or virtualService. and the accressUrl will be update.
func (*Controller) CreateServiceFor ¶ added in v0.6.0
func (*Controller) CreateVirtualServiceForCloudshell ¶ added in v0.6.0
func (c *Controller) CreateVirtualServiceForCloudshell(ctx context.Context, service string, cloudshell *cloudshellv1alpha1.CloudShell) error
CreateVirtualServiceForCloudshell create a virtualService resource in the cluster. if there is no istio server be deployed in the cluster. will not create the resource.
func (*Controller) GetBindingWorkerFor ¶ added in v0.6.0
func (c *Controller) GetBindingWorkerFor(cloudshell *cloudshellv1alpha1.CloudShell) (*corev1.Pod, error)
func (*Controller) GetMasterNodeIP ¶ added in v0.6.0
func (c *Controller) GetMasterNodeIP(ctx context.Context) (string, error)
GetMasterNodeIP could find the one master node IP.
func (*Controller) ResetWorker ¶ added in v0.6.2
func (c *Controller) ResetWorker(_ context.Context, cloudshell *cloudshellv1alpha1.CloudShell) error
ResetWorker cleanup the kubeConfig and kill ttyd
func (*Controller) Run ¶ added in v0.6.0
func (c *Controller) Run(workers int, stopCh <-chan struct{})
func (*Controller) StartupWorker ¶ added in v0.6.0
func (c *Controller) StartupWorker(_ context.Context, cloudshell *cloudshellv1alpha1.CloudShell, kubeConfigByte []byte) error
func (*Controller) StartupWorkerFor ¶ added in v0.6.0
func (c *Controller) StartupWorkerFor(ctx context.Context, cloudshell *cloudshellv1alpha1.CloudShell) error
StartupWorkerFor copy kubeConfig and start ttyd
func (*Controller) UpdateCloudshellStatus ¶ added in v0.6.0
func (c *Controller) UpdateCloudshellStatus(ctx context.Context, cloudshell *cloudshellv1alpha1.CloudShell, phase string) error
UpdateCloudshellStatus update the clodushell status.