Skip to content

Commit

Permalink
Remove flags and documentation for removed contour-ingressroute source
Browse files Browse the repository at this point in the history
  • Loading branch information
johngmyers committed Jul 4, 2023
1 parent 92824f4 commit 4a40346
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 67 deletions.
1 change: 0 additions & 1 deletion charts/external-dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ If `namespaced` is set to `true`, please ensure that `sources` my only contains
| `ingress` || |
| `istio-gateway` || |
| `istio-virtualservice` || |
| `contour-ingressroute` || |
| `crd` || |
| `kong-tcpingress` || |
| `openshift-route` || |
Expand Down
5 changes: 0 additions & 5 deletions charts/external-dns/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ rules:
resources: ["httpproxies"]
verbs: ["get","watch","list"]
{{- end }}
{{- if has "contour-ingressroute" .Values.sources }}
- apiGroups: ["contour.heptio.com"]
resources: ["ingressroutes"]
verbs: ["get","watch","list"]
{{- end }}
{{- if has "crd" .Values.sources }}
- apiGroups: ["externaldns.k8s.io"]
resources: ["dnsendpoints"]
Expand Down
41 changes: 4 additions & 37 deletions docs/tutorials/contour.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Setting up External DNS with Contour

This tutorial describes how to configure External DNS to use either the Contour `IngressRoute` or `HTTPProxy` source.
The `IngressRoute` CRD is deprecated but still in-use in many clusters however it's recommended that you migrate to the `HTTPProxy` resource.
This tutorial describes how to configure External DNS to use the Contour `HTTPProxy` source.
Using the `HTTPProxy` resource with External DNS requires Contour version 1.5 or greater.

### Example manifests for External DNS
#### Without RBAC
Note that you don't need to enable both of the sources and if you don't enable `contour-ingressroute` you also don't need to configure the `contour-load-balancer` setting.

```yaml
apiVersion: apps/v1
Expand All @@ -30,9 +28,7 @@ spec:
args:
- --source=service
- --source=ingress
- --source=contour-ingressroute # To enable IngressRoute support
- --source=contour-httpproxy # To enable HTTPProxy support
- --contour-load-balancer=custom-contour-namespace/custom-contour-lb # For IngressRoute ONLY: load balancer service to be used. Omit to use the default (heptio-contour/contour)
- --source=contour-httpproxy
- --domain-filter=external-dns-test.my-org.com # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
- --provider=aws
- --policy=upsert-only # would prevent ExternalDNS from deleting any records, omit to enable full synchronization
Expand Down Expand Up @@ -62,11 +58,6 @@ rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list"]
# This section is only for IngressRoute
- apiGroups: ["contour.heptio.com"]
resources: ["ingressroutes"]
verbs: ["get","watch","list"]
# This section is only for HTTPProxy
- apiGroups: ["projectcontour.io"]
resources: ["httpproxies"]
verbs: ["get","watch","list"]
Expand Down Expand Up @@ -106,9 +97,7 @@ spec:
args:
- --source=service
- --source=ingress
- --source=contour-ingressroute # To enable IngressRoute support
- --source=contour-httpproxy # To enable HTTPProxy support
- --contour-load-balancer=custom-contour-namespace/custom-contour-lb # For IngressRoute ONLY: load balancer service to be used. Omit to use the default (heptio-contour/contour)
- --source=contour-httpproxy
- --domain-filter=external-dns-test.my-org.com # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
- --provider=aws
- --policy=upsert-only # would prevent ExternalDNS from deleting any records, omit to enable full synchronization
Expand Down Expand Up @@ -162,9 +151,8 @@ spec:
EOF
```

Then create either a `HTTPProxy` or an `IngressRoute`
Then create an `HTTPProxy`:

#### HTTPProxy
```
$ kubectl apply -f - <<EOF
apiVersion: projectcontour.io/v1
Expand All @@ -186,27 +174,6 @@ spec:
EOF
```

#### IngressRoute
```
$ kubectl apply -f - <<EOF
apiVersion: contour.heptio.com/v1beta1
kind: IngressRoute
metadata:
labels:
app: kuard
name: kuard
namespace: default
spec:
virtualhost:
fqdn: kuard.example.com
routes:
- match: /
services:
- name: kuard
port: 80
EOF
```

#### Access the sample service using `curl`
```bash
$ curl -i http://kuard.example.com/healthy
Expand Down
1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ func main() {
CFAPIEndpoint: cfg.CFAPIEndpoint,
CFUsername: cfg.CFUsername,
CFPassword: cfg.CFPassword,
ContourLoadBalancerService: cfg.ContourLoadBalancerService,
GlooNamespace: cfg.GlooNamespace,
SkipperRouteGroupVersion: cfg.SkipperRouteGroupVersion,
RequestTimeout: cfg.RequestTimeout,
Expand Down
7 changes: 1 addition & 6 deletions pkg/apis/externaldns/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type Config struct {
KubeConfig string
RequestTimeout time.Duration
DefaultTargets []string
ContourLoadBalancerService string
GlooNamespace string
SkipperRouteGroupVersion string
Sources []string
Expand Down Expand Up @@ -214,7 +213,6 @@ var defaultConfig = &Config{
KubeConfig: "",
RequestTimeout: time.Second * 30,
DefaultTargets: []string{},
ContourLoadBalancerService: "heptio-contour/contour",
GlooNamespace: "gloo-system",
SkipperRouteGroupVersion: "zalando.org/v1",
Sources: nil,
Expand Down Expand Up @@ -408,17 +406,14 @@ func (cfg *Config) ParseFlags(args []string) error {
app.Flag("cf-username", "The username to log into the cloud foundry API").Default(defaultConfig.CFUsername).StringVar(&cfg.CFUsername)
app.Flag("cf-password", "The password to log into the cloud foundry API").Default(defaultConfig.CFPassword).StringVar(&cfg.CFPassword)

// Flags related to Contour
app.Flag("contour-load-balancer", "The fully-qualified name of the Contour load balancer service. (default: heptio-contour/contour)").Default("heptio-contour/contour").StringVar(&cfg.ContourLoadBalancerService)

// Flags related to Gloo
app.Flag("gloo-namespace", "Gloo namespace. (default: gloo-system)").Default("gloo-system").StringVar(&cfg.GlooNamespace)

// Flags related to Skipper RouteGroup
app.Flag("skipper-routegroup-groupversion", "The resource version for skipper routegroup").Default(source.DefaultRoutegroupVersion).StringVar(&cfg.SkipperRouteGroupVersion)

// Flags related to processing source
app.Flag("source", "The resource types that are queried for endpoints; specify multiple times for multiple sources (required, options: service, ingress, node, fake, connector, gateway-httproute, gateway-grpcroute, gateway-tlsroute, gateway-tcproute, gateway-udproute, istio-gateway, istio-virtualservice, cloudfoundry, contour-ingressroute, contour-httpproxy, gloo-proxy, crd, empty, skipper-routegroup, openshift-route, ambassador-host, kong-tcpingress, f5-virtualserver, traefik-proxy)").Required().PlaceHolder("source").EnumsVar(&cfg.Sources, "service", "ingress", "node", "pod", "gateway-httproute", "gateway-grpcroute", "gateway-tlsroute", "gateway-tcproute", "gateway-udproute", "istio-gateway", "istio-virtualservice", "cloudfoundry", "contour-ingressroute", "contour-httpproxy", "gloo-proxy", "fake", "connector", "crd", "empty", "skipper-routegroup", "openshift-route", "ambassador-host", "kong-tcpingress", "f5-virtualserver", "traefik-proxy")
app.Flag("source", "The resource types that are queried for endpoints; specify multiple times for multiple sources (required, options: service, ingress, node, fake, connector, gateway-httproute, gateway-grpcroute, gateway-tlsroute, gateway-tcproute, gateway-udproute, istio-gateway, istio-virtualservice, cloudfoundry, contour-httpproxy, gloo-proxy, crd, empty, skipper-routegroup, openshift-route, ambassador-host, kong-tcpingress, f5-virtualserver, traefik-proxy)").Required().PlaceHolder("source").EnumsVar(&cfg.Sources, "service", "ingress", "node", "pod", "gateway-httproute", "gateway-grpcroute", "gateway-tlsroute", "gateway-tcproute", "gateway-udproute", "istio-gateway", "istio-virtualservice", "cloudfoundry", "contour-httpproxy", "gloo-proxy", "fake", "connector", "crd", "empty", "skipper-routegroup", "openshift-route", "ambassador-host", "kong-tcpingress", "f5-virtualserver", "traefik-proxy")
app.Flag("openshift-router-name", "if source is openshift-route then you can pass the ingress controller name. Based on this name external-dns will select the respective router from the route status and map that routerCanonicalHostname to the route host while creating a CNAME record.").StringVar(&cfg.OCPRouterName)
app.Flag("namespace", "Limit sources of endpoints to a specific namespace (default: all namespaces)").Default(defaultConfig.Namespace).StringVar(&cfg.Namespace)
app.Flag("annotation-filter", "Filter sources managed by external-dns via annotation using label selector semantics (default: all sources)").Default(defaultConfig.AnnotationFilter).StringVar(&cfg.AnnotationFilter)
Expand Down
3 changes: 0 additions & 3 deletions pkg/apis/externaldns/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ var (
APIServerURL: "",
KubeConfig: "",
RequestTimeout: time.Second * 30,
ContourLoadBalancerService: "heptio-contour/contour",
GlooNamespace: "gloo-system",
SkipperRouteGroupVersion: "zalando.org/v1",
Sources: []string{"service"},
Expand Down Expand Up @@ -136,7 +135,6 @@ var (
APIServerURL: "http://127.0.0.1:8080",
KubeConfig: "/some/path",
RequestTimeout: time.Second * 77,
ContourLoadBalancerService: "heptio-contour-other/contour-other",
GlooNamespace: "gloo-not-system",
SkipperRouteGroupVersion: "zalando.org/v2",
Sources: []string{"service", "ingress", "connector"},
Expand Down Expand Up @@ -267,7 +265,6 @@ func TestParseFlags(t *testing.T) {
"--server=http://127.0.0.1:8080",
"--kubeconfig=/some/path",
"--request-timeout=77s",
"--contour-load-balancer=heptio-contour-other/contour-other",
"--gloo-namespace=gloo-not-system",
"--skipper-routegroup-groupversion=zalando.org/v2",
"--source=service",
Expand Down
1 change: 0 additions & 1 deletion source/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ type Config struct {
CFAPIEndpoint string
CFUsername string
CFPassword string
ContourLoadBalancerService string
GlooNamespace string
SkipperRouteGroupVersion string
RequestTimeout time.Duration
Expand Down
22 changes: 9 additions & 13 deletions source/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (suite *ByNamesTestSuite) TestAllInitialized() {
}: "IngressRouteUDPList",
}), nil)

sources, err := ByNames(context.TODO(), mockClientGenerator, []string{"service", "ingress", "istio-gateway", "contour-httpproxy", "kong-tcpingress", "f5-virtualserver", "traefik-proxy", "fake"}, minimalConfig)
sources, err := ByNames(context.TODO(), mockClientGenerator, []string{"service", "ingress", "istio-gateway", "contour-httpproxy", "kong-tcpingress", "f5-virtualserver", "traefik-proxy", "fake"}, &Config{})
suite.NoError(err, "should not generate errors")
suite.Len(sources, 8, "should generate all eight sources")
}
Expand All @@ -171,7 +171,7 @@ func (suite *ByNamesTestSuite) TestOnlyFake() {
mockClientGenerator := new(MockClientGenerator)
mockClientGenerator.On("KubeClient").Return(fakeKube.NewSimpleClientset(), nil)

sources, err := ByNames(context.TODO(), mockClientGenerator, []string{"fake"}, minimalConfig)
sources, err := ByNames(context.TODO(), mockClientGenerator, []string{"fake"}, &Config{})
suite.NoError(err, "should not generate errors")
suite.Len(sources, 1, "should generate fake source")
suite.Nil(mockClientGenerator.kubeClient, "client should not be created")
Expand All @@ -181,7 +181,7 @@ func (suite *ByNamesTestSuite) TestSourceNotFound() {
mockClientGenerator := new(MockClientGenerator)
mockClientGenerator.On("KubeClient").Return(fakeKube.NewSimpleClientset(), nil)

sources, err := ByNames(context.TODO(), mockClientGenerator, []string{"foo"}, minimalConfig)
sources, err := ByNames(context.TODO(), mockClientGenerator, []string{"foo"}, &Config{})
suite.Equal(err, ErrSourceNotFound, "should return source not found")
suite.Len(sources, 0, "should not returns any source")
}
Expand All @@ -190,16 +190,16 @@ func (suite *ByNamesTestSuite) TestKubeClientFails() {
mockClientGenerator := new(MockClientGenerator)
mockClientGenerator.On("KubeClient").Return(nil, errors.New("foo"))

_, err := ByNames(context.TODO(), mockClientGenerator, []string{"service"}, minimalConfig)
_, err := ByNames(context.TODO(), mockClientGenerator, []string{"service"}, &Config{})
suite.Error(err, "should return an error if kubernetes client cannot be created")

_, err = ByNames(context.TODO(), mockClientGenerator, []string{"ingress"}, minimalConfig)
_, err = ByNames(context.TODO(), mockClientGenerator, []string{"ingress"}, &Config{})
suite.Error(err, "should return an error if kubernetes client cannot be created")

_, err = ByNames(context.TODO(), mockClientGenerator, []string{"istio-gateway"}, minimalConfig)
_, err = ByNames(context.TODO(), mockClientGenerator, []string{"istio-gateway"}, &Config{})
suite.Error(err, "should return an error if kubernetes client cannot be created")

_, err = ByNames(context.TODO(), mockClientGenerator, []string{"kong-tcpingress"}, minimalConfig)
_, err = ByNames(context.TODO(), mockClientGenerator, []string{"kong-tcpingress"}, &Config{})
suite.Error(err, "should return an error if kubernetes client cannot be created")
}

Expand All @@ -209,17 +209,13 @@ func (suite *ByNamesTestSuite) TestIstioClientFails() {
mockClientGenerator.On("IstioClient").Return(nil, errors.New("foo"))
mockClientGenerator.On("DynamicKubernetesClient").Return(nil, errors.New("foo"))

_, err := ByNames(context.TODO(), mockClientGenerator, []string{"istio-gateway"}, minimalConfig)
_, err := ByNames(context.TODO(), mockClientGenerator, []string{"istio-gateway"}, &Config{})
suite.Error(err, "should return an error if istio client cannot be created")

_, err = ByNames(context.TODO(), mockClientGenerator, []string{"contour-httpproxy"}, minimalConfig)
_, err = ByNames(context.TODO(), mockClientGenerator, []string{"contour-httpproxy"}, &Config{})
suite.Error(err, "should return an error if contour client cannot be created")
}

func TestByNames(t *testing.T) {
suite.Run(t, new(ByNamesTestSuite))
}

var minimalConfig = &Config{
ContourLoadBalancerService: "heptio-contour/contour",
}

0 comments on commit 4a40346

Please sign in to comment.