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

zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new 30d9bd01 [operator] fix install wait v2
30d9bd01 is described below

commit 30d9bd01a11a15c43b4fa298fd7178802c28d87f
Author: mfordjody <[email protected]>
AuthorDate: Mon Dec 30 18:06:31 2024 +0800

    [operator] fix install wait v2
---
 operator/pkg/install/installer.go      | 27 ++++++++++++---------------
 operator/pkg/util/progress/progress.go |  3 ++-
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/operator/pkg/install/installer.go 
b/operator/pkg/install/installer.go
index 23504639..4f4209aa 100644
--- a/operator/pkg/install/installer.go
+++ b/operator/pkg/install/installer.go
@@ -41,13 +41,10 @@ func (i Installer) install(manifests 
[]manifest.ManifestSet) error {
                return err
        }
 
-       disabledComponents := sets.New(slices.Map(
-               component.AllComponents,
-               func(cc component.Component) component.Name {
-                       return cc.UserFacingName
-               },
-       )...)
-       dependencyWaitCh := dependenciesChs()
+       disabledComponents := sets.New(slices.Map(component.AllComponents, 
func(e component.Component) component.Name {
+               return e.UserFacingName
+       })...)
+       dependencyWaitCh := dependenciesChannels()
        for _, mfs := range manifests {
                c := mfs.Components
                m := mfs.Manifests
@@ -68,6 +65,7 @@ func (i Installer) install(manifests []manifest.ManifestSet) 
error {
                        for _, ch := range componentDependencies[c] {
                                dependencyWaitCh[ch] <- struct{}{}
                        }
+
                }()
        }
        for cc := range disabledComponents {
@@ -208,22 +206,21 @@ func (i Installer) prune(manifests 
[]manifest.ManifestSet) error {
 }
 
 var componentDependencies = map[component.Name][]component.Name{
-       component.BaseComponentName: {},
-       component.AdminComponentName: {
-               component.BaseComponentName,
+       component.AdminComponentName: {},
+       component.BaseComponentName: {
+               component.AdminComponentName,
        },
 }
 
-func dependenciesChs() map[component.Name]chan struct{} {
-       r := make(map[component.Name]chan struct{})
+func dependenciesChannels() map[component.Name]chan struct{} {
+       ret := make(map[component.Name]chan struct{})
        for _, parent := range componentDependencies {
                for _, child := range parent {
-                       r[child] = make(chan struct{}, 1)
+                       ret[child] = make(chan struct{}, 1)
                }
        }
-       return r
+       return ret
 }
-
 func getOwnerLabels(dop values.Map, c string) map[string]string {
        labels := make(map[string]string)
 
diff --git a/operator/pkg/util/progress/progress.go 
b/operator/pkg/util/progress/progress.go
index fae9fbad..b9eccb3b 100644
--- a/operator/pkg/util/progress/progress.go
+++ b/operator/pkg/util/progress/progress.go
@@ -126,8 +126,9 @@ func (i *Info) SetState(state InstallState) {
        }
 }
 
+var testWriter *io.Writer
+
 func createBar() *pb.ProgressBar {
-       var testWriter *io.Writer
        bar := pb.New(0)
        bar.Set(pb.Static, true)
        if testWriter != nil {

Reply via email to