Skip to content

Commit

Permalink
Fix applying resource error lead to undefined behavior during install…
Browse files Browse the repository at this point in the history
…ation (istio#46901)

* fix applying failed lead to undefined behavior

* add releasenote
  • Loading branch information
hanxiaop committed Sep 11, 2023
1 parent 2ac4054 commit 347e10f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 2 additions & 9 deletions operator/pkg/helmreconciler/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const fieldOwnerOperator = "istio-operator"
func (h *HelmReconciler) ApplyManifest(manifest name.Manifest, serverSideApply bool) (object.K8sObjects, int, error) {
var processedObjects object.K8sObjects
var deployedObjects int
var errs util.Errors
cname := string(manifest.Name)
crHash, err := h.getCRHash(cname)
if err != nil {
Expand Down Expand Up @@ -100,9 +99,8 @@ func (h *HelmReconciler) ApplyManifest(manifest name.Manifest, serverSideApply b
return nil, 0, err
}
if err := h.ApplyObject(obj.UnstructuredObject(), serverSideApply); err != nil {
scope.Error(err.Error())
errs = util.AppendErr(errs, err)
continue
plog.ReportError(err.Error())
return processedObjects, 0, err
}
plog.ReportProgress()
metrics.AddResource(obj.FullName(), obj.GroupVersionKind().GroupKind())
Expand All @@ -125,11 +123,6 @@ func (h *HelmReconciler) ApplyManifest(manifest name.Manifest, serverSideApply b
}

if len(changedObjectKeys) > 0 {
if len(errs) != 0 {
plog.ReportError(util.ToString(errs.Dedup(), "\n"))
return processedObjects, 0, errs.ToError()
}

err := WaitForResources(processedObjects, h.kubeClient,
h.opts.WaitTimeout, h.opts.DryRun, plog)
if err != nil {
Expand Down
8 changes: 8 additions & 0 deletions releasenotes/notes/46901.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: release-notes/v2
kind: bug-fix
area: installation
issue:
- 43312
releaseNotes:
- |
**Fixed** an issue where the installation process continued even if a resource failed to be applied, causing unexpected behavior.

0 comments on commit 347e10f

Please sign in to comment.