Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Remove ExternalDNS contour ingress workaround
Browse files Browse the repository at this point in the history
- Due to upstream issue in contour projectcontour/contour#403
  address field was not setting on ingress resource.
  We introduced a workaround in 71c19e0.

- Previously we were explicily using `IngressHosts` to work with external-dns.
  Now since the upstream issue has been fixed in contour we have removed option field `IngressHosts`.

Signed-off-by: knrt10 <kautilya@kinvolk.io>
  • Loading branch information
knrt10 committed Jun 17, 2020
1 parent b7da7fd commit 17ac285
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 65 deletions.
3 changes: 0 additions & 3 deletions assets/components/contour/templates/02-service-envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ metadata:
# for information about enabling the PROXY protocol on the ELB to recover
# the original remote IP address.
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
{{- if .Values.ingressHosts }}
external-dns.alpha.kubernetes.io/hostname: '{{- join "," .Values.ingressHosts }}'
{{- end }}
spec:
externalTrafficPolicy: Local
ports:
Expand Down
2 changes: 0 additions & 2 deletions assets/components/contour/values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
monitoring:
enable: false

ingressHosts:

contour:
image: docker.io/projectcontour/contour
tag: v1.5.0
Expand Down
3 changes: 0 additions & 3 deletions ci/aks/aks-cluster.lokocfg.envsubst
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ component "prometheus-operator" {
}

component "contour" {
ingress_hosts = [
"httpbin.${var.cluster_name}.${var.aws_dns_zone}",
]
enable_monitoring = true
}

Expand Down
1 change: 0 additions & 1 deletion ci/aws/aws-cluster.lokocfg.envsubst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ component "openebs-storage-class" {
component "prometheus-operator" {}

component "contour" {
ingress_hosts = ["dex.$CLUSTER_ID.$AWS_DNS_ZONE", "gangway.$CLUSTER_ID.$AWS_DNS_ZONE"]
enable_monitoring = true
service_type = "NodePort"
}
Expand Down
1 change: 0 additions & 1 deletion ci/packet/packet-cluster.lokocfg.envsubst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ component "openebs-storage-class" {
component "prometheus-operator" {}

component "contour" {
ingress_hosts = ["dex.$CLUSTER_ID.$AWS_DNS_ZONE", "gangway.$CLUSTER_ID.$AWS_DNS_ZONE"]
enable_monitoring = true
}

Expand Down
2 changes: 0 additions & 2 deletions docs/configuration-reference/components/contour.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Contour component configuration example:
component "contour" {
# Optional arguments
enable_monitoring = false
ingress_hosts = ["*.example.lokomotive.org"]
service_type = "NodePort"
node_affinity {
Expand Down Expand Up @@ -70,7 +69,6 @@ Example:
| Argument | Description | Default | Required |
|---------------------|---------------------------------------------------------------------------------------------------------|:--------------:|:--------:|
| `enable_monitoring` | Create Prometheus Operator configs to scrape Contour and Envoy metrics. Also deploys Grafana Dashboard. | false | false |
| `ingress_hosts` | [ExternalDNS component](external-dns.md) creates DNS entries from the values provided. | "" | false |
| `node_affinity` | Node affinity for deploying the operator pod and envoy daemonset. | - | false |
| `service_type` | The type of Kubernetes service used to expose Envoy. | "LoadBalancer" | false |
| `toleration` | Tolerations that the operator and envoy pods will tolerate. | - | false |
Expand Down
3 changes: 0 additions & 3 deletions docs/configuration-reference/components/external-dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ component "external-dns" {
}
```

ExternalDNS manages DNS entries for the values in the field `ingress_hosts` of the [Contour
component](contour.md#attribute-reference).

## Attribute reference

Table of all the arguments accepted by the component.
Expand Down
8 changes: 0 additions & 8 deletions docs/how-to-guides/authentication-with-dex-gangway.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@ variable "gangway_session_key" {
# Dex component configuration.
component "dex" {
# NOTE: This name should match with the contour component configuration
# `ingress_hosts`
ingress_host = "dex.<CLUSTER_NAME>.<DOMAIN.NAME>"
issuer_host = "https://dex.<CLUSTER_NAME>.<DOMAIN_NAME>"
# GitHub connector configuration.
connector "github" {
Expand Down Expand Up @@ -310,9 +305,6 @@ Check the following:

* Check the ExternalDNS component logs for the created DNS entries matching the contour component.

* If the DNS entries are already created, ensure that `dex.<CLUSTER_NAME>.<DOMAIN_NAME>` and `gangway.<CLUSTER_NAME>.<DOMAIN_NAME>` matches
the field `ingress_hosts` in contour configuration.

* Verify the configuration in `auth.lokocfg`.

* Check if the certificates are issued.
Expand Down
8 changes: 4 additions & 4 deletions pkg/assets/generated_assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 6 additions & 15 deletions pkg/components/contour/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,14 @@ func init() {
components.Register(name, newComponent())
}

// IngressHosts field is added in order to make contour work with ExternalDNS component.
// Values provided for IngressHosts is used as value for the annotation `external-dns.alpha.kubernetes.io/hostname`
// This annotation is added to Envoy service.
type component struct {
EnableMonitoring bool `hcl:"enable_monitoring,optional"`
// IngressHosts field is added in order to make contour work with ExternalDNS component.
// Values provided for IngressHosts is used as value for the annotation `external-dns.alpha.kubernetes.io/hostname`.
// This annotation is added to Envoy Service, in order for ExternalDNS to create DNS entries.
// This solution is a workaround for projectcontour/contour#403
// More details regarding this workaround and other solutions is captured in
// https://github.com/kinvolk/PROJECT-Lokomotive-Kubernetes/issues/474
IngressHosts []string `hcl:"ingress_hosts,optional"`
NodeAffinity []util.NodeAffinity `hcl:"node_affinity,block"`
NodeAffinityRaw string
ServiceType string `hcl:"service_type,optional"`
Tolerations []util.Toleration `hcl:"toleration,block"`
TolerationsRaw string
EnableMonitoring bool `hcl:"enable_monitoring,optional"`
NodeAffinity []util.NodeAffinity `hcl:"node_affinity,block"`
NodeAffinityRaw string
ServiceType string `hcl:"service_type,optional"`
Tolerations []util.Toleration `hcl:"toleration,block"`
TolerationsRaw string
}

func newComponent() *component {
Expand Down
16 changes: 0 additions & 16 deletions pkg/components/contour/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,6 @@ func TestRenderManifest(t *testing.T) {
hcl string
wantErr bool
}{
{
desc: "With ingress hosts",
hcl: `
component "contour" {
ingress_hosts = ["test.domain.com"]
}
`,
},
{
desc: "With ingress hosts wildcard",
hcl: `
component "contour" {
ingress_hosts = ["*.domain.com"]
}
`,
},
{
desc: "With monitoring",
hcl: `
Expand Down
7 changes: 0 additions & 7 deletions pkg/components/contour/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ monitoring:
enable: {{ .EnableMonitoring }}
{{- end }}
{{- if .IngressHosts }}
ingressHosts:
{{- range .IngressHosts}}
- "{{ . }}"
{{- end }}
{{- end }}
envoy:
serviceType: {{ .ServiceType }}
Expand Down

0 comments on commit 17ac285

Please sign in to comment.