This is an automated email from the ASF dual-hosted git repository.

chishengliu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 42b2380  SUBMARINE-1227. Fix the operator nil error by the conflict of 
deployment name
42b2380 is described below

commit 42b23807d16d7085e56caf4d3aa91eedc56c6ef4
Author: cdmikechen <cdmikec...@hotmail.com>
AuthorDate: Sat Mar 26 10:51:30 2022 +0800

    SUBMARINE-1227. Fix the operator nil error by the conflict of deployment 
name
    
    ### What is this PR for?
    When there has been a deployment called `submarine-server` in the same 
namespace,  create a new submarine CR in this namespace will cause nil 
exception. After several crash downs of the operator, the operator will not be 
available.
    
    ### What type of PR is it?
    Bug Fix
    
    ### Todos
    * [x] - Handle the error that the object is nil when get deployment by name
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-1227
    
    ### How should this be tested?
    <!--
    * First time? Setup Travis CI as described on 
https://submarine.apache.org/contribution/contributions.html#continuous-integration
    * Strongly recommended: add automated unit tests for any new or changed 
behavior
    * Outline any manual steps to test the PR here.
    -->
    ### Screenshots (if appropriate)
    No
    
    ### Questions:
    * Do the license files need updating? No
    * Are there breaking changes for older versions? No
    * Does this need new documentation? No
    
    Author: cdmikechen <cdmikec...@hotmail.com>
    
    Signed-off-by: Chi-Sheng Liu <chisheng...@apache.org>
    
    Closes #911 from cdmikechen/SUBMARINE-1227 and squashes the following 
commits:
    
    a1737ad6 [cdmikechen] SUBMARINE-1227. Fix the operator nil error by the 
conflict of deployment name
---
 submarine-cloud-v2/pkg/controller/controller.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/submarine-cloud-v2/pkg/controller/controller.go 
b/submarine-cloud-v2/pkg/controller/controller.go
index cc69025..e2ee1cd 100644
--- a/submarine-cloud-v2/pkg/controller/controller.go
+++ b/submarine-cloud-v2/pkg/controller/controller.go
@@ -473,6 +473,8 @@ func (c *Controller) 
checkSubmarineDependentsReady(submarine *v1alpha1.Submarine
                deployment, err := c.getDeployment(submarine.Namespace, name)
                if err != nil {
                        return false, err
+               } else if deployment == nil {
+                       return false, nil
                }
                // check if deployment replicas failed
                for _, condition := range deployment.Status.Conditions {

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@submarine.apache.org
For additional commands, e-mail: dev-h...@submarine.apache.org

Reply via email to