Data plane proxy membership constraints let us define a set of rules that are executed when a data plane proxy is joining a mesh.
Constraints contains two lists:
Requirements - a data plane proxy has to fulfill at least one requirement to join a mesh.
Restrictions - a data plane proxy cannot fulfill any restriction to join a mesh.
Keep in mind that membership rules are enforced only on new data plane proxies.
If we put rules that existing data plane proxies violate, we need to remove them manually from the mesh.
apiVersion: kuma.io/v1alpha1
kind: Mesh
metadata:name: default
spec:constraints:dataplaneProxy:requirements:-tags:# set of required tags. You can specify '*' in value to require non-empty value of tagkuma.io/zone: east
restrictions:-tags:# set of restricted tags. You can specify '*' in value to restrict tag with any valuekuma.io/service: backend
1 2 3 4 5 6 7 8 9 10 11 12 13
type: Mesh
name: default
constraints:dataplaneProxy:requirements:-tags:# set of required tags. You can specify '*' in value to require non-empty value of tagkuma.io/zone: east
restrictions:-tags:# set of restricted tags. You can specify '*' in value to restrict tag with any valuekuma.io/service: backend
By default, any Pod can join any mesh by changing its kuma.io/mesh annotation.
We can restrict that by relying on autogenerated k8s.kuma.io/namespace tag.
In this example, only data plane proxies from ns-1 and ns-2 can join a default mesh.
If there is another mesh without any requirements, Pods from ns-1 and ns-2 namespaces can also join that mesh.
By using these constraints, we can enforce consistency of tags in Kuma deployment.
With the example above, every data plane proxy must have non-empty team and cloud tags and cannot have legacy tag.