diff --git a/charts/external-dns/CHANGELOG.md b/charts/external-dns/CHANGELOG.md index 309452b02..f84c032bc 100644 --- a/charts/external-dns/CHANGELOG.md +++ b/charts/external-dns/CHANGELOG.md @@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add option to set `annotationPrefix` ([#5889](https://github.com/kubernetes-sigs/external-dns/pull/5889)) _@lexfrei_ +### Changed + +- Grant `networking.k8s.io/ingresses` and `gateway.solo.io/gateways` permissions when using `gloo-proxy` source. ([#5909](https://github.com/kubernetes-sigs/external-dns/pull/5909)) _@cucxabong_ + ## [v1.19.0] - 2025-09-08 ### Added diff --git a/charts/external-dns/templates/clusterrole.yaml b/charts/external-dns/templates/clusterrole.yaml index 52c525ead..b3ef006ce 100644 --- a/charts/external-dns/templates/clusterrole.yaml +++ b/charts/external-dns/templates/clusterrole.yaml @@ -26,7 +26,7 @@ rules: resources: ["endpointslices"] verbs: ["get","watch","list"] {{- end }} -{{- if or (has "ingress" .Values.sources) (has "istio-gateway" .Values.sources) (has "istio-virtualservice" .Values.sources) (has "contour-httpproxy" .Values.sources) (has "openshift-route" .Values.sources) (has "skipper-routegroup" .Values.sources) }} +{{- if or (has "ingress" .Values.sources) (has "istio-gateway" .Values.sources) (has "istio-virtualservice" .Values.sources) (has "contour-httpproxy" .Values.sources) (has "openshift-route" .Values.sources) (has "skipper-routegroup" .Values.sources) (has "gloo-proxy" .Values.sources) }} - apiGroups: ["extensions","networking.k8s.io"] resources: ["ingresses"] verbs: ["get","watch","list"] @@ -99,7 +99,7 @@ rules: {{- end }} {{- if has "gloo-proxy" .Values.sources }} - apiGroups: ["gloo.solo.io","gateway.solo.io"] - resources: ["proxies","virtualservices"] + resources: ["proxies","virtualservices","gateways"] verbs: ["get","watch","list"] {{- end }} {{- if has "kong-tcpingress" .Values.sources }} diff --git a/charts/external-dns/tests/rbac_test.yaml b/charts/external-dns/tests/rbac_test.yaml index 4658d7ee2..ab4a1576e 100644 --- a/charts/external-dns/tests/rbac_test.yaml +++ b/charts/external-dns/tests/rbac_test.yaml @@ -520,3 +520,27 @@ tests: resources: ["virtualservices"] verbs: ["get","watch","list"] template: clusterrole.yaml + - it: should create default RBAC rules for 'GlooEdge' when 'gloo-proxy' is set + set: + sources: + - gloo-proxy + asserts: + - template: clusterrole.yaml + equal: + path: rules + value: + - apiGroups: [""] + resources: ["nodes"] + verbs: ["list","watch"] + - apiGroups: [""] + resources: ["pods"] + verbs: ["get","watch","list"] + - apiGroups: [""] + resources: ["services"] + verbs: ["get","watch","list"] + - apiGroups: ["extensions","networking.k8s.io"] + resources: ["ingresses"] + verbs: ["get","watch","list"] + - apiGroups: ["gloo.solo.io","gateway.solo.io"] + resources: ["proxies","virtualservices","gateways"] + verbs: ["get","watch","list"] diff --git a/docs/annotations/annotations.md b/docs/annotations/annotations.md index 9784a3ab6..96ad1e71a 100644 --- a/docs/annotations/annotations.md +++ b/docs/annotations/annotations.md @@ -151,14 +151,108 @@ If the annotation is not present, use the domains from both the spec and annotat ## external-dns.alpha.kubernetes.io/ingress -This annotation allows ExternalDNS to work with Istio Gateways that don't have a public IP. +This annotation allows ExternalDNS to work with Istio & GlooEdge Gateways that don't have a public IP. -It can be used to address a specific architectural pattern, when a Kubernetes Ingress directs all public traffic to the Istio Gateway: +It can be used to address a specific architectural pattern, when a Kubernetes Ingress directs all public traffic to an Istio or GlooEdge Gateway: - **The Challenge**: By default, ExternalDNS sources the public IP address for a DNS record from a Service of type LoadBalancer. -However, in some service mesh setups, the Istio Gateway's Service is of type ClusterIP, with all public traffic routed to it via a separate Kubernetes Ingress object. This setup leaves the Gateway without a public IP that ExternalDNS can discover. +However, in some setups, the Gateway's Service is of type ClusterIP, with all public traffic routed to it via a separate Kubernetes Ingress object. This setup leaves the Gateway without a public IP that ExternalDNS can discover. -- **The Solution**: The annotation on the Istio Gateway tells ExternalDNS to ignore the Gateway's Service IP. Instead, it directs ExternalDNS to a specified Ingress resource to find the target LoadBalancer IP address. +- **The Solution**: The annotation on the Istio/GlooEdge Gateway tells ExternalDNS to ignore the Gateway's Service IP. Instead, it directs ExternalDNS to a specified Ingress resource to find the target LoadBalancer IP address. + +### Use Cases for `external-dns.alpha.kubernetes.io/ingress` annotation + +#### Getting target from Ingress backed Gloo Gateway + +```yml +apiVersion: gateway.solo.io/v1 +kind: Gateway +metadata: + annotations: + external-dns.alpha.kubernetes.io/ingress: gateway-proxy + labels: + app: gloo + name: gateway-proxy + namespace: gloo-system +spec: + bindAddress: '::' + bindPort: 8080 + options: {} + proxyNames: + - gateway-proxy + ssl: false + useProxyProto: false +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: gateway-proxy + namespace: gloo-system +spec: + ingressClassName: alb + rules: + - host: cool-service.example.com + http: + paths: + - backend: + service: + name: gateway-proxy + port: + name: http + path: / + pathType: Prefix +status: + loadBalancer: + ingress: + - hostname: k8s-alb-c4aa37c880-740590208.us-east-1.elb.amazonaws.com +--- +# This object is generated by GlooEdge Control Plane from Gateway and VirtualService. +# We have no direct control on this resource +apiVersion: gloo.solo.io/v1 +kind: Proxy +metadata: + labels: + created_by: gloo-gateway + name: gateway-proxy + namespace: gloo-system +spec: + listeners: + - bindAddress: '::' + bindPort: 8080 + httpListener: + virtualHosts: + - domains: + - cool-service.example.com + metadataStatic: + sources: + - observedGeneration: "6652" + resourceKind: '*v1.VirtualService' + resourceRef: + name: cool-service + namespace: gloo-system + name: cool-service + routes: + - matchers: + - prefix: / + metadataStatic: + sources: + - observedGeneration: "6652" + resourceKind: '*v1.VirtualService' + resourceRef: + name: cool-service + namespace: gloo-system + upgrades: + - websocket: {} + metadataStatic: + sources: + - observedGeneration: "6111" + resourceKind: '*v1.Gateway' + resourceRef: + name: gateway-proxy + namespace: gloo-system + name: listener-::-8080 + useProxyProto: false +``` ## external-dns.alpha.kubernetes.io/internal-hostname diff --git a/docs/sources/gloo-proxy.md b/docs/sources/gloo-proxy.md index fe60b6541..5ef6d4e9c 100644 --- a/docs/sources/gloo-proxy.md +++ b/docs/sources/gloo-proxy.md @@ -104,3 +104,52 @@ spec: - --registry=txt - --txt-owner-id=my-identifier ``` + +## Gateway Annotation + +To support setups where an Ingress resource is used to provision an external LB you can add the following annotation to your Gateway + +**Note:** The Ingress namespace can be omitted if its in the same namespace as the gateway + +```bash +$ cat <