kumahq / kuma

🐻 The multi-zone service mesh for containers, Kubernetes and VMs. Built with Envoy. CNCF Sandbox Project.
https://kuma.io/install
Apache License 2.0
3.67k stars 333 forks source link

MeshGateway should be able to select something that is not `kuma.io/service` #12041

Open lahabana opened 1 week ago

lahabana commented 1 week ago

Description

We're trying to distance ourselves from kuma.io/service on the dataplane. Currently for a gateway I do:

apiVersion: kuma.io/v1alpha1
kind: MeshGateway
mesh: default
metadata:
  name: edge-gateway
spec:
  conf:
    listeners:
    - port: 80
      protocol: HTTP
  selectors:
  - match:
      kuma.io/service: edge-gateway_kuma-demo_svc
---
apiVersion: kuma.io/v1alpha1
kind: MeshGatewayInstance
metadata:
  name: edge-gateway
  namespace: kuma-demo
spec:
  replicas: 1
  serviceType: LoadBalancer

This creates that dataplane:

apiVersion: kuma.io/v1alpha1
kind: Dataplane
mesh: default
metadata:
  annotations:
    kuma.io/display-name: edge-gateway-66bdc8cd87-j8gn9
  creationTimestamp: "2024-11-14T09:19:32Z"
  generation: 1
  labels:
    k8s.kuma.io/namespace: kuma-demo
    kuma.io/env: kubernetes
    kuma.io/mesh: default
    kuma.io/origin: zone
    kuma.io/zone: default
  name: edge-gateway-66bdc8cd87-j8gn9
  namespace: kuma-demo
  ownerReferences:
  - apiVersion: v1
    blockOwnerDeletion: true
    controller: true
    kind: Pod
    name: edge-gateway-66bdc8cd87-j8gn9
    uid: ba069337-b277-4190-b7eb-964a3002a820
  resourceVersion: "5623"
  uid: 1326e038-d0d0-4219-bb65-fec91c3142f9
spec:
  networking:
    address: 10.244.0.15
    gateway:
      tags:
        kuma.io/service: edge-gateway_kuma-demo_svc
        kuma.io/zone: default
      type: BUILTIN

Would it be worth having other kuma system tags on the gateway or more simply use labels?

Then I could do:

apiVersion: kuma.io/v1alpha1
kind: MeshGateway
mesh: default
metadata:
  name: edge-gateway
spec:
  conf:
    listeners:
    - port: 80
      protocol: HTTP
  selectors:
  - match:
      k8s.kuma.io/namespace: kuma-demo
     <aLABELThat'sMissing>