# Two clusters in same namespace

**URL:** <https://forums.percona.com/t/two-clusters-in-same-namespace/8302>\
**Category:** Percona Operator for MySQL\
**Created:** [November 24, 2020, 6:45am UTC](https://forums.percona.com/t/two-clusters-in-same-namespace/8302 "2020-11-24T06:45:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laimis](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/laimis/32/1410_2.png) [@Laimis](https://forums.percona.com/u/Laimis)\
**Post date:** [November 24, 2020, 6:45am UTC](https://forums.percona.com/t/two-clusters-in-same-namespace/8302/1 "2020-11-24T06:45:29Z")

</div>

my question is simple

I have one working cluster and I created another one. The only issue is visible that operators are conflicting between each other.

So second operator is:

```auto
apiVersion: apps/v1

kind: Deployment

metadata:

 name: percona-xtradb-cluster-operator-2

 namespace: ptest

spec:

 replicas: 1

 selector:

  matchLabels:

   name: percona-xtradb-cluster-operator-2

 template:

  metadata:

   labels:

    name: percona-xtradb-cluster-operator-2

  spec:

   serviceAccountName: percona-xtradb-cluster-operator-2

   containers:

    - name: percona-xtradb-cluster-operator-2

     image: percona/percona-xtradb-cluster-operator:1.4.0

     ports:

     - containerPort: 60000

      name: metrics

     command:

     - percona-xtradb-cluster-operator

     imagePullPolicy: Always

     env:

      - name: WATCH_NAMESPACE

       valueFrom:

        fieldRef:

         fieldPath: metadata.namespace

      - name: OPERATOR_NAME

       value: "percona-xtradb-cluster-operator-2"

```

Any way to specify that it should use cluster2 instead of cluster1?

```auto
$ k get pods -n ptest

NAME READY STATUS RESTARTS AGE

cluster1-proxysql-0 3/3 Running 0 45m

cluster1-proxysql-1 3/3 Running 0 46m

cluster1-proxysql-2 3/3 Running 0 46m

cluster1-pxc-0 1/1 Running 0 44m

cluster1-pxc-1 1/1 Running 0 46m

cluster1-pxc-2 1/1 Running 0 45m

cluster2-proxysql-0 3/3 Running 0 7m23s

cluster2-proxysql-1 3/3 Running 0 8m11s

cluster2-proxysql-2 3/3 Running 0 13m

cluster2-pxc-0 1/1 Running 0 15m

cluster2-pxc-1 1/1 Running 0 16m

cluster2-pxc-2 1/1 Running 0 17m

percona-xtradb-cluster-operator-2-556564484-pwdj9 1/1 Running 0 26m

percona-xtradb-cluster-operator-7f96c796d7-tpmk8 1/1 Running 0 48m

```

In operator’s log I can see that these names of “cluster1” and “cluster2” are conflicting. So not right name used in first or second operator.

```auto
{"level":"error","ts":1605774801.487967,"logger":"controller_perconaxtradbcluster","caller":"pxc/controller.go:124","msg":"Update status","error":"send update: Operation cannot be fulfilled on perconaxtradbclusters.pxc.percona.com \"cluster2\": the object has been modified; please apply your changes to the latest version and try again","stacktrace":"github.com/percona/percona-xtradb-cluster-operator/vendor/github.com/go-logr/zapr.(*zapLogger).Error
\t/go/src/github.com/percona/percona-xtradb-cluster-operator/vendor/github.com/go-logr/zapr/zapr.go:128
github.com/percona/percona-xtradb-cluster-operator/pkg/controller/pxc.(*ReconcilePerconaXtraDBCluster).Reconcile.func1
\t/go/src/github.com/percona/percona-xtradb-cluster-operator/pkg/controller/pxc/controller.go:124
github.com/percona/percona-xtradb-cluster-operator/pkg/controller/pxc.(*ReconcilePerconaXtraDBCluster).Reconcile
\t/go/src/github.com/percona/percona-xtradb-cluster-operator/pkg/controller/pxc/controller.go:254
github.com/percona/percona-xtradb-cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
\t/go/src/github.com/percona/percona-xtradb-cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:207
github.com/percona/percona-xtradb-cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1
\t/go/src/github.com/percona/percona-xtradb-cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:157
github.com/percona/percona-xtradb-cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1
\t/go/src/github.com/percona/percona-xtradb-cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133
github.com/percona/percona-xtradb-cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil
\t/go/src/github.com/percona/percona-xtradb-cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134
github.com/percona/percona-xtradb-cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait.Until\n\t/go/src/github.com/percona/percona-xtradb-cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88"}

```

---

<div class="post-metadata">

**Author:** ![vadimtk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadimtk/32/9528_2.png) [@vadimtk](https://forums.percona.com/u/vadimtk)\
**Post date:** [November 24, 2020, 6:49am UTC](https://forums.percona.com/t/two-clusters-in-same-namespace/8302/2 "2020-11-24T06:49:11Z")

</div>

You only need one operator per namespace.

With one operator you can start multiple cluster instances in that namespace.
