Skip to content

Commit

Permalink
fix 'dealErr' and update Dockerfile, kustomization.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
rainzm committed May 12, 2020
1 parent dbe77e4 commit 6c0c072
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RUN go mod download
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY provider/ provider/
COPY util/ util/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
Expand Down
6 changes: 6 additions & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
resources:
- manager.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: registry.cn-beijing.aliyuncs.com/rainzm/onecloud-service-operator
newTag: dev
2 changes: 1 addition & 1 deletion controllers/ansibleplaybook_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (r *AnsiblePlaybookReconciler) Reconcile(req ctrl.Request) (ctrl.Result, er
if err := r.apClear(ctx, &ansiblePlaybook); err != nil {
return dealErr(err)
}
return ctrl.Result{}, nil
return ctrl.Result{RequeueAfter: time.Second, Requeue: true}, nil
}

var playbookTemplate onecloudv1.AnsiblePlaybookTemplate
Expand Down
2 changes: 1 addition & 1 deletion controllers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func dealErr(ctx context.Context, logger logr.Logger, sclient client.StatusClien
if reErr.IsClientErr() {
re.SetResourcePhase(onecloudv1.ResourcePending, reErr.Error())
}
if reErr.IsClientErr() {
if reErr.IsServerErr() {
re.SetResourcePhase(onecloudv1.ResourceUnkown, reErr.Error())
}
return ctrl.Result{}, sclient.Status().Update(ctx, re)
Expand Down
2 changes: 1 addition & 1 deletion provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (re SRequestErr) IsNotFound(resource Resource) bool {
}

func (re SRequestErr) IsClientErr() bool {
return re.Code >= 400 && re.Code < 500
return re.Code >= 400 && re.Code != 404 && re.Code < 500
}

func (re SRequestErr) IsServerErr() bool {
Expand Down

0 comments on commit 6c0c072

Please sign in to comment.