Repository: argoproj/argo (go)

Issue:
Argo server should start without configmap

**What happened**:
If the workflow-controller is running in a cluster scope, the user can submit the workflow from their namespace. The user wants to run the argo server in hosted/local mode for their namespace. They don't enable persistence and they don't have permission for Argo namespace. Argo server is throwing below error.
```
error: “FATA[0000] configmaps “workflow-controller-configmap” not found”
```

**What you expected to happen**:
Argo server can start without `workflow-controller-configmap`
**How to reproduce it (as minimally and precisely as possible)**:

**Anything else we need to know?**:

**Environment**:
- Argo version:
```
$ argo version
```
- Kubernetes version :
```
$ kubectl version -o yaml
```

**Other debugging information (if applicable)**:
- workflow result:
```
argo get <workflowname>
```
- executor logs:
```
kubectl logs <failedpodname> -c init
kubectl logs <failedpodname> -c wait
```
- workflow-controller logs:
```
kubectl logs -n argo $(kubectl get pods -l app=workflow-controller -n argo -o name)
```

**Logs**

```
argo get <workflowname>
kubectl logs <failedpodname> -c init
kubectl logs <failedpodname> -c wait
kubectl logs -n argo $(kubectl get pods -l app=workflow-controller -n argo -o name)
```

---
<!-- Issue Author: Don't delete this message to ecourage other users to support your issue! -->
**Message from the maintainers**:

If you are impacted by this bug please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.


Pull request description:
fix: Fixes empty/missing CM. Fixes #2285
Checklist:

* [x] Either (a) I've created an [enhancement proposal](https://github.com/argoproj/argo/issues/new/choose) and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
* [x] The title of the PR is (a) [conventional](https://www.conventionalcommits.org/en/v1.0.0/), (b) states what changed, and (c) suffixes the related issues number. E.g. `"fix(controller): Updates such and such. Fixes #1234"`.  
* [x] I have written unit and/or e2e tests for my change. PRs without these are unlike to be merged.
* [x] Optional. I've added My organization is added to the USERS.md.
* [ ] I've signed the CLA and required builds are green. 


Patch:
diff --git a/config/config.go b/config/config.go
index 0f33f2906..a5b63a3e4 100644
--- a/config/config.go
+++ b/config/config.go
@@ -6,6 +6,8 @@ import (
 	wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
 )
 
+var emptyConfig = Config{}
+
 // Config contain the configuration settings for the workflow controller
 type Config struct {
 	// ExecutorImage is the image name of the executor to use when running pods
diff --git a/config/controller.go b/config/controller.go
index cb7bb0ad8..75f797cd4 100644
--- a/config/controller.go
+++ b/config/controller.go
@@ -5,6 +5,7 @@ import (
 	"strings"
 
 	apiv1 "k8s.io/api/core/v1"
+	apierr "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/fields"
 	"k8s.io/apimachinery/pkg/runtime"
@@ -46,12 +47,15 @@ func (cc *controller) updateConfig(cm *apiv1.ConfigMap, onChange func(config Con
 }
 
 func parseConfigMap(cm *apiv1.ConfigMap) (Config, error) {
+	if cm == nil {
+		return emptyConfig, nil
+	}
 	// The key in the configmap to retrieve workflow configuration from.
 	// Content encoding is expected to be YAML.
 	var config Config
 	rawConfig, ok := cm.Data["config"]
 	if ok && len(cm.Data) != 1 {
-		return Config{}, fmt.Errorf("if you have an item in your config map named 'config', you must only have one item")
+		return emptyConfig, fmt.Errorf("if you have an item in your config map named 'config', you must only have one item")
 	}
 	if !ok {
 		for name, value := range cm.Data {
@@ -65,7 +69,7 @@ func parseConfigMap(cm *apiv1.ConfigMap) (Config, error) {
 	}
 	err := yaml.Unmarshal([]byte(rawConfig), &config)
 	if err != nil {
-		return Config{}, err
+		return emptyConfig, err
 	}
 	return config, nil
 }
@@ -119,8 +123,8 @@ func (cc *controller) Run(stopCh <-chan struct{}, onChange func(config Config) e
 func (cc *controller) Get() (Config, error) {
 	cmClient := cc.kubeclientset.CoreV1().ConfigMaps(cc.namespace)
 	cm, err := cmClient.Get(cc.configMap, metav1.GetOptions{})
-	if err != nil {
-		return Config{}, err
+	if err != nil && !apierr.IsNotFound(err) {
+		return emptyConfig, err
 	}
 	return parseConfigMap(cm)
 }
diff --git a/docs/workflow-templates.md b/docs/workflow-templates.md
index e440b43f4..47f97ac3d 100644
--- a/docs/workflow-templates.md
+++ b/docs/workflow-templates.md
@@ -209,8 +209,8 @@ Using `kubectl apply -f` and `kubectl get wftmpl`
 
 ### GitOps via Argo CD
 
-`WorkflowTempalte` resources can be managed with GitOps by using [Argo CD](https://github.com/argoproj/argo-cd)
+`WorkflowTemplate` resources can be managed with GitOps by using [Argo CD](https://github.com/argoproj/argo-cd)
 
 ### UI
 
-`WorkflowTempalte` resources can also be managed by the UI
\ No newline at end of file
+`WorkflowTemplate` resources can also be managed by the UI


Test patch:
diff --git a/config/controller_test.go b/config/controller_test.go
index 2b379242d..cbd66694d 100644
--- a/config/controller_test.go
+++ b/config/controller_test.go
@@ -5,6 +5,7 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	apiv1 "k8s.io/api/core/v1"
+	"k8s.io/client-go/kubernetes/fake"
 )
 
 func Test_parseConfigMap(t *testing.T) {
@@ -40,3 +41,12 @@ func Test_parseConfigMap(t *testing.T) {
 		assert.NoError(t, err)
 	})
 }
+
+func Test_controller_Get(t *testing.T) {
+	kube := fake.NewSimpleClientset()
+	c := controller{configMap: "my-config-map", kubeclientset: kube}
+	config, err := c.Get()
+	if assert.NoError(t, err) {
+		assert.Empty(t, config)
+	}
+}