Fix newdeploy doesn't handle error properly (#1316)

This commit is contained in:
Ta-Ching Chen
2019-09-16 15:43:36 +08:00
committed by GitHub
parent 5d2d65f05c
commit c94e02b302
2 changed files with 14 additions and 24 deletions
+6 -2
View File
@@ -187,10 +187,12 @@ func (deploy *NewDeploy) initEnvController() (k8sCache.Store, k8sCache.Controlle
function, err := deploy.fissionClient.Functions(f.Metadata.Namespace).Get(f.Metadata.Name)
if err != nil {
deploy.logger.Error("Error getting function", zap.Error(err), zap.Any("function", function))
continue
}
err = deploy.updateFuncDeployment(function, newEnv)
if err != nil {
deploy.logger.Error("Error updating function", zap.Error(err), zap.Any("function", function))
continue
}
}
}
@@ -312,9 +314,10 @@ func (deploy *NewDeploy) fnCreate(fn *fv1.Function, firstcreate bool) (*fscache.
if !firstcreate {
// retrieve back the previous obj name for later use.
fsvc, err := deploy.fsCache.GetByFunctionUID(fn.Metadata.UID)
if err == nil {
objName = fsvc.Name
if err != nil {
return nil, err
}
objName = fsvc.Name
}
deployLabels := deploy.getDeployLabels(fn.Metadata, env.Metadata)
@@ -337,6 +340,7 @@ func (deploy *NewDeploy) fnCreate(fn *fv1.Function, firstcreate bool) (*fscache.
return nil, errors.Wrapf(err, "error creating service %v", objName)
}
svcAddress := fmt.Sprintf("%v.%v", svc.Name, svc.Namespace)
depl, err := deploy.createOrGetDeployment(fn, env, objName, deployLabels, ns, firstcreate)
if err != nil {
deploy.logger.Error("error creating deployment", zap.Error(err), zap.String("deployment", objName))