cisco-open / cluster-registry-controller

An operator that automatically synchronizes Kubernetes resources across multiple clusters
Apache License 2.0
22 stars 8 forks source link

Mutating namespace #50

Closed BEvgeniyS closed 1 year ago

BEvgeniyS commented 1 year ago

Is your feature request related to a problem? Please describe. I am trying to sync VirtualServices for our istio MultiCluster mesh. We need to mutate the namespace of the virtualService while synchronising.

Describe the solution you'd like to see Currently, if we mutate object's namespace like so:

apiVersion: clusterregistry.k8s.cisco.com/v1alpha1
kind: ResourceSyncRule
metadata:
  name: istio-sync
spec:
  groupVersionKind:
    group: networking.istio.io
    kind: VirtualService
    version: v1beta1
  rules:
    - match:
      - labels:
        - matchLabels:
            published: "true"
      mutations:
        overrides:
          # Can't handle namespace change - controller deletes it. TODO: Raise the issue
          - path: /metadata/namespace
            type: replace
            value: edge
          - path: /spec/gateways/0
            type: replace
            value: edge/ingressgateway

the object is created and then immediately deleted.

Describe alternatives you've considered The workaround could be to mirror all the namespaces, but then we have a policy that prevents istio gateways to consider virtualServices from foreign namespaces, so it's a no-go

Additional context Not sure if this a bug or a feature request. I am planning to link PR with potential solution to this issue