Skip to content

Commit

Permalink
fix(api-server): use correct client to delete bentodeployment resource
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone committed Jan 10, 2023
1 parent df3d157 commit eaa27ec
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions api-server/services/deployment_revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,21 @@ func (s *deploymentRevisionService) Terminate(ctx context.Context, deploymentRev
err = errors.Wrap(err, "get yatai deployment component")
return err
}
if yataiDeploymentComp.Manifest == nil && yataiDeploymentComp.Manifest.LatestCRDVersion == "v1alpha3" {
cli, err := DeploymentService.GetKubeBentoDeploymentV1alpha3Cli(ctx, deployment)
if err != nil {
return err
if yataiDeploymentComp.Manifest != nil {
if yataiDeploymentComp.Manifest.LatestCRDVersion == "v2alpha1" {
cli, err := DeploymentService.GetKubeBentoDeploymentV2alpha1Cli(ctx, deployment)
if err != nil {
return err
}
return cli.Delete(ctx, deployment.Name, metav1.DeleteOptions{})
}
if yataiDeploymentComp.Manifest.LatestCRDVersion == "v1alpha3" {
cli, err := DeploymentService.GetKubeBentoDeploymentV1alpha3Cli(ctx, deployment)
if err != nil {
return err
}
return cli.Delete(ctx, deployment.Name, metav1.DeleteOptions{})
}
return cli.Delete(ctx, deployment.Name, metav1.DeleteOptions{})
}
cli, err := DeploymentService.GetKubeBentoDeploymentV1alpha2Cli(ctx, deployment)
if err != nil {
Expand Down

0 comments on commit eaa27ec

Please sign in to comment.