(_ context.Context, cloudshell *cloudshellv1alpha1.CloudShell)
| 517 | } |
| 518 | |
| 519 | func (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. |
no test coverage detected