forked from k8gb-io/k8gb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem K8GB reads IP addresses from `Ingress.Status.LoadBalancer.Ingress` or from `Service.Status.LoadBalancer.Ingress` for ingress configured with Kubernetes Ingress and Istio Virtual Service, respectively. The IP addresses exposed by these resources are the IP addresses exposed by the Kubernetes Cluster. However, in some setups the clients do not route their traffic to these IP addresses because the cluster is behind a reverse proxy. Solution To support this setup, K8GB should expose DNS records with the IP address of the reverse proxy. Since the address is unknown to the cluster the K8GB administrator must provide it via configuration. This PR adds to K8GB the capability to read IP address from an annotation `k8gb.io/external-ips` on Ingress and Service resources. Examples ``` apiVersion: networking.k8s.io/v1 kind: Ingress metadata: labels: app: ingress annotations: k8gb.io/external-ips: "185.199.110.153" ``` ``` apiVersion: v1 kind: Service metadata: name: istio-ingressgateway namespace: istio-ingress labels: app: istio-ingressgateway annotations: k8gb.io/external-ips: "185.199.110.153,185.199.109.153" ``` Fixes k8gb-io#1275 Signed-off-by: Andre Baptista Aguas <[email protected]>
- Loading branch information
Showing
10 changed files
with
200 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
controllers/refresolver/ingress/testdata/ingress_annotation_multiple_ips.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
labels: | ||
app: ingress-referenced | ||
annotations: | ||
k8gb.io/exposed-ip-addresses: "185.199.110.153,185.199.109.153" | ||
name: ingress-referenced | ||
namespace: test-gslb | ||
resourceVersion: "999" | ||
spec: | ||
ingressClassName: nginx | ||
rules: | ||
- host: ingress-referenced.cloud.example.com | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: referenced | ||
port: | ||
name: http | ||
status: | ||
loadBalancer: | ||
ingress: | ||
- ip: 10.0.0.1 |
27 changes: 27 additions & 0 deletions
27
controllers/refresolver/ingress/testdata/ingress_annotation_no_ips.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
labels: | ||
app: ingress-referenced | ||
annotations: | ||
k8gb.io/exposed-ip-addresses: "" | ||
name: ingress-referenced | ||
namespace: test-gslb | ||
resourceVersion: "999" | ||
spec: | ||
ingressClassName: nginx | ||
rules: | ||
- host: ingress-referenced.cloud.example.com | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: referenced | ||
port: | ||
name: http | ||
status: | ||
loadBalancer: | ||
ingress: | ||
- ip: 10.0.0.1 |
27 changes: 27 additions & 0 deletions
27
controllers/refresolver/ingress/testdata/ingress_annotation_single_ip.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
labels: | ||
app: ingress-referenced | ||
annotations: | ||
k8gb.io/exposed-ip-addresses: "185.199.110.153" | ||
name: ingress-referenced | ||
namespace: test-gslb | ||
resourceVersion: "999" | ||
spec: | ||
ingressClassName: nginx | ||
rules: | ||
- host: ingress-referenced.cloud.example.com | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: referenced | ||
port: | ||
name: http | ||
status: | ||
loadBalancer: | ||
ingress: | ||
- ip: 10.0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...llers/refresolver/istiovirtualservice/testdata/istio_service_annotation_multiple_ips.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: istio-ingressgateway | ||
namespace: istio-ingress | ||
labels: | ||
app: istio-ingressgateway | ||
annotations: | ||
k8gb.io/exposed-ip-addresses: "185.199.110.153,185.199.109.153" | ||
spec: | ||
ports: | ||
- name: http | ||
port: 80 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app: istio-ingressgateway | ||
type: LoadBalancer | ||
status: | ||
loadBalancer: | ||
ingress: | ||
- ip: 10.0.0.1 |
22 changes: 22 additions & 0 deletions
22
controllers/refresolver/istiovirtualservice/testdata/istio_service_annotation_no_ips.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: istio-ingressgateway | ||
namespace: istio-ingress | ||
labels: | ||
app: istio-ingressgateway | ||
annotations: | ||
k8gb.io/exposed-ip-addresses: "" | ||
spec: | ||
ports: | ||
- name: http | ||
port: 80 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app: istio-ingressgateway | ||
type: LoadBalancer | ||
status: | ||
loadBalancer: | ||
ingress: | ||
- ip: 10.0.0.1 |
22 changes: 22 additions & 0 deletions
22
controllers/refresolver/istiovirtualservice/testdata/istio_service_annotation_single_ip.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: istio-ingressgateway | ||
namespace: istio-ingress | ||
labels: | ||
app: istio-ingressgateway | ||
annotations: | ||
k8gb.io/exposed-ip-addresses: "185.199.110.153" | ||
spec: | ||
ports: | ||
- name: http | ||
port: 80 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app: istio-ingressgateway | ||
type: LoadBalancer | ||
status: | ||
loadBalancer: | ||
ingress: | ||
- ip: 10.0.0.1 |