From b3f903c6be6222f1deb6ae031e4b12a1477b49e8 Mon Sep 17 00:00:00 2001 From: Angel Misevski Date: Thu, 13 Jan 2022 14:25:08 -0500 Subject: [PATCH 1/2] Fix logging of config changes to properly format config Signed-off-by: Angel Misevski --- pkg/config/sync.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/config/sync.go b/pkg/config/sync.go index e84555a08..0f7c13a1b 100644 --- a/pkg/config/sync.go +++ b/pkg/config/sync.go @@ -270,11 +270,13 @@ func logCurrentConfig() { if internalConfig.EnableExperimentalFeatures != nil && *internalConfig.EnableExperimentalFeatures { config = append(config, "enableExperimentalFeatures=true") } + if len(config) == 0 { - log.Info("(default config)") + log.Info("Updated config to [(default config)]") } else { - log.Info("Updated config to [%s]", strings.Join(config, ",")) + log.Info(fmt.Sprintf("Updated config to [%s]", strings.Join(config, ","))) } + if internalConfig.Routing.ProxyConfig != nil { log.Info("Resolved proxy configuration", "proxy", internalConfig.Routing.ProxyConfig) } From b32141dfc66c43e35e1bbaec5f399ae85663424a Mon Sep 17 00:00:00 2001 From: Angel Misevski Date: Thu, 13 Jan 2022 14:25:37 -0500 Subject: [PATCH 2/2] Automount resources into the project-clone container to get git creds Include project-clone container in automount resources to ensure it correctly mounts any git configuration/credentials. Signed-off-by: Angel Misevski --- controllers/workspace/devworkspace_controller.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/controllers/workspace/devworkspace_controller.go b/controllers/workspace/devworkspace_controller.go index 755e377c9..1a63bf2c3 100644 --- a/controllers/workspace/devworkspace_controller.go +++ b/controllers/workspace/devworkspace_controller.go @@ -284,6 +284,13 @@ func (r *DevWorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request return r.failWorkspace(workspace, fmt.Sprintf("Failed to process workspace environment variables: %s", err), metrics.ReasonBadRequest, reqLogger, &reconcileStatus) } + // Add init container to clone projects + if projectClone, err := projects.GetProjectCloneInitContainer(&workspace.Spec.Template); err != nil { + return r.failWorkspace(workspace, fmt.Sprintf("Failed to set up project-clone init container: %s", err), metrics.ReasonInfrastructureFailure, reqLogger, &reconcileStatus) + } else if projectClone != nil { + devfilePodAdditions.InitContainers = append(devfilePodAdditions.InitContainers, *projectClone) + } + // Add automount resources into devfile containers if err := automount.ProvisionAutoMountResourcesInto(devfilePodAdditions, clusterAPI, workspace.Namespace); err != nil { var fatalErr *automount.FatalError @@ -294,13 +301,6 @@ func (r *DevWorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request } } - // Add init container to clone projects - if projectClone, err := projects.GetProjectCloneInitContainer(&workspace.Spec.Template); err != nil { - return r.failWorkspace(workspace, fmt.Sprintf("Failed to set up project-clone init container: %s", err), metrics.ReasonInfrastructureFailure, reqLogger, &reconcileStatus) - } else if projectClone != nil { - devfilePodAdditions.InitContainers = append(devfilePodAdditions.InitContainers, *projectClone) - } - err = storageProvisioner.ProvisionStorage(devfilePodAdditions, workspace, clusterAPI) if err != nil { switch storageErr := err.(type) {