From d029f62f8955f4f522f6757ebad76bd73183ab41 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Thu, 12 Dec 2024 10:18:49 +0100 Subject: [PATCH] Reverting the change to use as user arg: dev-mode instead of staticPassword which is only used internally Signed-off-by: cmoulliard --- api/v1alpha1/localbuild_types.go | 14 +++++++------- pkg/build/build.go | 2 +- pkg/cmd/create/root.go | 18 +++++++++--------- pkg/controllers/gitrepository/controller.go | 2 +- pkg/controllers/localbuild/controller.go | 8 ++++---- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/api/v1alpha1/localbuild_types.go b/api/v1alpha1/localbuild_types.go index cb27b30d..074e9afb 100644 --- a/api/v1alpha1/localbuild_types.go +++ b/api/v1alpha1/localbuild_types.go @@ -47,13 +47,13 @@ type PackageConfigsSpec struct { // BuildCustomizationSpec fields cannot change once a cluster is created type BuildCustomizationSpec struct { - Protocol string `json:"protocol,omitempty"` - Host string `json:"host,omitempty"` - IngressHost string `json:"ingressHost,omitempty"` - Port string `json:"port,omitempty"` - UsePathRouting bool `json:"usePathRouting,omitempty"` - SelfSignedCert string `json:"selfSignedCert,omitempty"` - StaticPasswords bool `json:"staticPasswords,omitempty"` + Protocol string `json:"protocol,omitempty"` + Host string `json:"host,omitempty"` + IngressHost string `json:"ingressHost,omitempty"` + Port string `json:"port,omitempty"` + UsePathRouting bool `json:"usePathRouting,omitempty"` + SelfSignedCert string `json:"selfSignedCert,omitempty"` + StaticPassword bool `json:"staticPasswords,omitempty"` } type LocalbuildSpec struct { diff --git a/pkg/build/build.go b/pkg/build/build.go index 2a49f8dd..c4e7026d 100644 --- a/pkg/build/build.go +++ b/pkg/build/build.go @@ -280,5 +280,5 @@ func isBuildCustomizationSpecEqual(s1, s2 v1alpha1.BuildCustomizationSpec) bool s1.Port == s2.Port && s1.UsePathRouting == s2.UsePathRouting && s1.SelfSignedCert == s2.SelfSignedCert && - s1.StaticPasswords == s2.StaticPasswords + s1.StaticPassword == s2.StaticPassword } diff --git a/pkg/cmd/create/root.go b/pkg/cmd/create/root.go index 05f0d806..06d75995 100644 --- a/pkg/cmd/create/root.go +++ b/pkg/cmd/create/root.go @@ -20,7 +20,7 @@ import ( const ( recreateClusterUsage = "Delete cluster first if it already exists." buildNameUsage = "Name for build (Prefix for kind cluster name, pod names, etc)." - staticPasswordsUsage = "Set a static password: developer to the applications: argocd and gitea." + devModeUsage = "Set the password \"developer\" for the admin user of the applications: argocd & gitea." kubeVersionUsage = "Version of the kind kubernetes cluster to create." extraPortsMappingUsage = "List of extra ports to expose on the docker container and kubernetes cluster as nodePort " + "(e.g. \"22:32222,9090:39090,etc\")." @@ -41,7 +41,7 @@ var ( // Flags recreateCluster bool buildName string - staticPasswords bool + devMode bool kubeVersion string extraPortsMapping string kindConfigPath string @@ -69,7 +69,7 @@ func init() { CreateCmd.PersistentFlags().StringVar(&buildName, "build-name", "localdev", buildNameUsage) CreateCmd.PersistentFlags().MarkDeprecated("build-name", "use --name instead.") CreateCmd.PersistentFlags().StringVar(&buildName, "name", "localdev", buildNameUsage) - CreateCmd.PersistentFlags().BoolVar(&staticPasswords, "static-passwords", false, staticPasswordsUsage) + CreateCmd.PersistentFlags().BoolVar(&devMode, "dev-mode", false, devModeUsage) CreateCmd.PersistentFlags().StringVar(&kubeVersion, "kube-version", "v1.30.3", kubeVersionUsage) CreateCmd.PersistentFlags().StringVar(&extraPortsMapping, "extra-ports", "", extraPortsMappingUsage) CreateCmd.PersistentFlags().StringVar(&kindConfigPath, "kind-config", "", kindConfigPathUsage) @@ -141,12 +141,12 @@ func create(cmd *cobra.Command, args []string) error { ExtraPortsMapping: extraPortsMapping, TemplateData: v1alpha1.BuildCustomizationSpec{ - Protocol: protocol, - Host: host, - IngressHost: ingressHost, - Port: port, - UsePathRouting: pathRouting, - StaticPasswords: staticPasswords, + Protocol: protocol, + Host: host, + IngressHost: ingressHost, + Port: port, + UsePathRouting: pathRouting, + StaticPassword: devMode, }, CustomPackageDirs: absDirPaths, diff --git a/pkg/controllers/gitrepository/controller.go b/pkg/controllers/gitrepository/controller.go index 829ec657..45ef84d2 100644 --- a/pkg/controllers/gitrepository/controller.go +++ b/pkg/controllers/gitrepository/controller.go @@ -143,7 +143,7 @@ func (r *RepositoryReconciler) reconcileGitRepo(ctx context.Context, repo *v1alp return ctrl.Result{}, fmt.Errorf("getting git provider credentials: %w", err) } - if r.Config.StaticPasswords { + if r.Config.StaticPassword { creds.password = "developer" } diff --git a/pkg/controllers/localbuild/controller.go b/pkg/controllers/localbuild/controller.go index 6c1c5994..a30faa31 100644 --- a/pkg/controllers/localbuild/controller.go +++ b/pkg/controllers/localbuild/controller.go @@ -104,8 +104,8 @@ func (r *LocalbuildReconciler) Reconcile(ctx context.Context, req ctrl.Request) } } - if r.Config.StaticPasswords { - logger.V(1).Info("StaticPasswords is enabled") + if r.Config.StaticPassword { + logger.V(1).Info("Dev mode is enabled") // Check if the Argocd Initial admin secret exists argocdInitialAdminPassword, err := r.extractArgocdInitialAdminSecret(ctx) @@ -123,7 +123,7 @@ func (r *LocalbuildReconciler) Reconcile(ctx context.Context, req ctrl.Request) if err != nil { return ctrl.Result{}, err } else { - logger.Info(fmt.Sprintf("Argocd admin password change %s !", argocdPasswordChangeStatus)) + logger.V(1).Info(fmt.Sprintf("Argocd admin password change %s !", argocdPasswordChangeStatus)) } } @@ -141,7 +141,7 @@ func (r *LocalbuildReconciler) Reconcile(ctx context.Context, req ctrl.Request) if err != nil { return ctrl.Result{}, err } else { - logger.Info(fmt.Sprintf("Gitea admin password change %s !", giteaPasswordChangeStatus)) + logger.V(1).Info(fmt.Sprintf("Gitea admin password change %s !", giteaPasswordChangeStatus)) } } }