hashicorp / hashicorp/nomad

Ingress Gateway Config not purged from Consul when job is purged

Open
#9,874 0 comments 3 reactions 0 assignees View on GitHub
hcc/cst stage/needs-investigation theme/consul/connect type/bug
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

Ingress gateway config auto-generated by Nomad is not removed from Consul after job is purged:

```
~$ consul config list -kind "ingress-gateway"
consul-ingress
ig2-ingress
```

**To Reproduce**

1 - Create the following ingress gateway job:

```hcl
job "ig2" {
datacenters = ["dc1"]

group "ingress-group2" {

network {
mode = "bridge"

port "inbound" {
static = 7070
to = 7070
}
}

service {
name = "ig2-ingress"
port = "10000"

connect {
gateway {

proxy {
}

ingress {
listener {
port = 7070
protocol = "http"
service {
name = "foo"
hosts = ["some-ip","foo.ingress.dc1.consul"]
}
}
}
}
}
}
}
}
```

2 - Run the job.

3 - Run the following Consul command: `consul config list -kind "ingress-gateway":

```
~$ consul config list -kind "ingress-gateway"
ig2-ingress
```

Nomad created the config in Consul

4 - Purge the job by running `nomad stop -purge ig2`.

5 - Run `consul config list -kind "ingress-gateway"` command again:

```
~$ consul config list -kind "ingress-gateway"
ig2-ingress
```

**Expected behavior**

Configuration should have been cleaned-up since it's no longer used. Ingress gateway service is deregistered from Consul when job is purged but configuration in Consul is not deleted.

**Impact**

Over time we may end up with a lot of stale configuration in Consul

**Environment:**:

- Nomad version: 1.0.0
- Consul 1.9.0
- Envoy 1.16.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the lifecycle with the ingress gateway job, `nomad stop -purge ig2`, and `consul config list -kind "ingress-gateway"`. Trace Nomad's Consul integration for ingress gateway configuration cleanup; done means the generated `ig2-ingress` configuration is absent from Consul after the job is purged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.