MCPcopy Index your code
hub / github.com/cloudtty/cloudtty / ensureCloudShell

Method ensureCloudShell

pkg/controllers/cloudshell_controller.go:519–534  ·  view source on GitHub ↗
(_ context.Context, cloudshell *cloudshellv1alpha1.CloudShell)

Source from the content-addressed store, hash-verified

517}
518
519func (c *Controller) ensureCloudShell(_ context.Context, cloudshell *cloudshellv1alpha1.CloudShell) error {
520 updated := ctrlutil.AddFinalizer(cloudshell, CloudshellControllerFinalizer)
521
522 older := cloudshell.DeepCopy()
523
524 if len(cloudshell.Spec.Image) == 0 {
525 cloudshell.Spec.Image = c.cloudshellImage
526 }
527 gclient.NewSchema().Default(cloudshell)
528
529 if updated || !reflect.DeepEqual(cloudshell.Spec, older.Spec) {
530 return c.Client.Update(context.TODO(), cloudshell)
531 }
532
533 return nil
534}
535
536// CreateRouteRule create a service resource in the same namespace of cloudshell no matter what expose model.
537// if the expose model is ingress or virtualService, it will create additional resources, e.g: ingress or virtualService.

Callers 1

syncHandlerMethod · 0.95

Calls 3

NewSchemaFunction · 0.92
UpdateMethod · 0.65
DeepCopyMethod · 0.45

Tested by

no test coverage detected