<p>If I create project 'A' and want to deploy a template from inside it that creates objects in project 'A' and also in another project 'B' how would I achieve this. I tried simply specifying the namespace of project 'B' in the template but got the error</p>

<blockquote>
  <p>the namespace of the provided object does not match the namespace sent on the request</p>
</blockquote>

Richard Chester
<p>According to <a href="https://docs.openshift.com/container-platform/3.11/dev_guide/templates.html" rel="nofollow noreferrer">documentation</a>:</p>

<blockquote>
  <p>If an object definition’s metadata includes a fixed namespace field value, the field will be stripped out of the definition during template instantiation. If the namespace field contains a parameter reference, normal parameter substitution will be performed and the object will be created in whatever namespace the parameter substitution resolved the value to, assuming the user has permission to create objects in that namespace.</p>
</blockquote>

<p>So just specify required namespaces as template's parameters. Usable example:</p>

<pre><code>apiVersion: template.openshift.io/v1
kind: Template
metadata:
  name: xxx
parameters:
- name: ns1
  value: test1
- name: ns2
  value: test2
objects:
- apiVersion: v1
  data:
    key1: value1
  kind: ConfigMap
  metadata:
    namespace: ${ns1}
    name: cm1
- apiVersion: v1
  data:
    key2: value2
  kind: ConfigMap
  metadata:
    namespace: ${ns2}
    name: cm2
</code></pre>
