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 dfebc764 [operator] fix install wait
dfebc764 is described below
commit dfebc7646f218fb782847bcf8bd860bfaea16656
Author: mfordjody <[email protected]>
AuthorDate: Mon Dec 30 16:22:35 2024 +0800
[operator] fix install wait
---
operator/cmd/cluster/install.go | 7 +++++--
operator/pkg/apis/types.go | 4 ----
operator/pkg/component/component.go | 19 ++++++++++---------
operator/pkg/install/installer.go | 1 -
operator/pkg/util/progress/progress.go | 2 +-
5 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/operator/cmd/cluster/install.go b/operator/cmd/cluster/install.go
index 9fd1a95f..68ed1bfe 100644
--- a/operator/cmd/cluster/install.go
+++ b/operator/cmd/cluster/install.go
@@ -15,6 +15,7 @@ import (
"io"
"os"
"strings"
+ "time"
)
var installerScope = log.RegisterScope("installer")
@@ -24,20 +25,21 @@ type installArgs struct {
sets []string
manifestPath string
skipConfirmation bool
+ waitTimeout time.Duration
}
func (i *installArgs) String() string {
var b strings.Builder
b.WriteString("files: " + (fmt.Sprint(i.files) + "\n"))
b.WriteString("sets: " + (fmt.Sprint(i.sets) + "\n"))
- b.WriteString("manifestPath: " + (fmt.Sprint(i.manifestPath) + "\n"))
+ b.WriteString("waitTimeout: " + fmt.Sprint(i.waitTimeout) + "\n")
return b.String()
}
func addInstallFlags(cmd *cobra.Command, args *installArgs) {
cmd.PersistentFlags().StringSliceVarP(&args.files, "files", "f", nil,
`Path to the file containing the dubboOperator's custom resources`)
cmd.PersistentFlags().StringArrayVarP(&args.sets, "set", "s", nil,
`Override dubboOperator values, such as selecting profiles, etc`)
-
+ cmd.PersistentFlags().DurationVar(&args.waitTimeout, "wait-timeout",
300*time.Second, "Maximum time to wait for Dubbo resources in each component to
be ready")
}
func InstallCmd(ctx cli.Context) *cobra.Command {
@@ -95,6 +97,7 @@ func Install(kubeClient kube.CLIClient, rootArgs *RootArgs,
iArgs *installArgs,
SkipWait: false,
Kube: kubeClient,
Values: vals,
+ WaitTimeout: iArgs.waitTimeout,
ProgressInfo: progress.NewInfo(),
Logger: cl,
}
diff --git a/operator/pkg/apis/types.go b/operator/pkg/apis/types.go
index e5c2f60a..f5288f01 100644
--- a/operator/pkg/apis/types.go
+++ b/operator/pkg/apis/types.go
@@ -35,8 +35,6 @@ type DubboOperator struct {
type DubboOperatorSpec struct {
Profile string `json:"profile,omitempty"`
- Namespace string `json:"namespace,omitempty"`
- Revision string `json:"revision,omitempty"`
Components *DubboComponentSpec `json:"components,omitempty"`
Values json.RawMessage `json:"values,omitempty"`
}
@@ -58,8 +56,6 @@ type ComponentSpec struct {
type MetadataCompSpec struct {
ComponentSpec
- Name string `json:"name,omitempty"`
- Label map[string]string `json:"label,omitempty"`
}
type BoolValue struct {
diff --git a/operator/pkg/component/component.go
b/operator/pkg/component/component.go
index 37c665bd..6b6dda39 100644
--- a/operator/pkg/component/component.go
+++ b/operator/pkg/component/component.go
@@ -13,15 +13,6 @@ const (
AdminComponentName Name = "Admin"
)
-type Component struct {
- UserFacingName Name
- SpecName string
- Default bool
- HelmSubDir string
- HelmTreeRoot string
- FlattenValues bool
-}
-
var AllComponents = []Component{
{
UserFacingName: BaseComponentName,
@@ -39,6 +30,15 @@ var AllComponents = []Component{
},
}
+type Component struct {
+ UserFacingName Name
+ SpecName string
+ Default bool
+ HelmSubDir string
+ HelmTreeRoot string
+ FlattenValues bool
+}
+
var (
userFacingCompNames = map[Name]string{
BaseComponentName: "Dubbo Core",
@@ -78,6 +78,7 @@ func (c Component) Get(merged values.Map)
([]apis.MetadataCompSpec, error) {
if spec.Namespace == "" {
spec.Namespace = defaultNamespace
+ } else {
spec.Namespace = "dubbo-system"
}
spec.Raw = m
diff --git a/operator/pkg/install/installer.go
b/operator/pkg/install/installer.go
index 8bdd23a8..23504639 100644
--- a/operator/pkg/install/installer.go
+++ b/operator/pkg/install/installer.go
@@ -49,7 +49,6 @@ func (i Installer) install(manifests []manifest.ManifestSet)
error {
)...)
dependencyWaitCh := dependenciesChs()
for _, mfs := range manifests {
- mfs := mfs
c := mfs.Components
m := mfs.Manifests
disabledComponents.Delete(c)
diff --git a/operator/pkg/util/progress/progress.go
b/operator/pkg/util/progress/progress.go
index bae4b3f1..fae9fbad 100644
--- a/operator/pkg/util/progress/progress.go
+++ b/operator/pkg/util/progress/progress.go
@@ -19,7 +19,7 @@ const (
StateUninstallComplete
)
-const inProgress = `{{ yellow (cycle . "-" "-" " ") }}`
+const inProgress = `{{ yellow (cycle . "-" "-" "-" " ") }} `
type Info struct {
components map[string]*ManifestInfo