Skip to content

Conversation

@anilvpatel
Copy link
Contributor

Description

This PR fixes an issue where default TCP checks were being re-added on service reload or agent restart, even when they were explicitly disabled or replaced with custom checks during the initial service registration.

With this change, the agent now consistently preserves the original sidecar check configuration, ensuring default checks are added only when intended.

Testing & Reproduction steps

  1. Start the consul agent
    consul agent -dev -data-dir=/tmp/consul/data

  2. Register below hello service definition
    consul services register hello-service.json

{
  "service": {
    "id": "service-hello-1",
    "name": "service-hello",
    "port": 5050,
    "address": "127.0.0.1",
    "connect": {
      "sidecar_service": {
        "checks": [{
          "alias_service": "web",
          "name": "Connect Sidecar Aliasing web"
        }],
        "proxy": {
          "upstreams": [
            {
              "destination_name": "service-response",
              "local_bind_port": 9090
            }
          ]
        }
      }
    },
    "check": {
      "http": "http://127.0.0.1:5050/health",
      "interval": "10s"
    }
  }
}
  1. As as sidecar service contains the checks, it does not added the default TCP checks
    http://127.0.0.1:8500/v1/health/service/service-hello-sidecar-proxy?dc=dc1

  2. consul reload or restart the agent
    consul reload

  3. After reload, its inconsistence and defaults TCP checks are added
    http://127.0.0.1:8500/v1/health/service/service-hello-sidecar-proxy?dc=dc1

PR Checklist

  • [x ] updated test coverage
  • external facing docs updated
  • [ x] appropriate backport labels added
  • [x ] not a security concern

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@anilvpatel anilvpatel requested review from a team as code owners December 1, 2025 13:59
@anilvpatel anilvpatel added the backport/all Apply backports for all active releases per .release/versions.hcl label Dec 2, 2025
@anilvpatel anilvpatel merged commit 9a24b24 into main Dec 9, 2025
157 of 158 checks passed
@hc-github-team-consul-core hc-github-team-consul-core added backport/1.22 Changes are backported to 1.22 backport/ent/1.18 Changes are backported to 1.18 ent backport/ent/1.20 backport to ent 1.20 backport/ent/1.21 changes are backported to 1.21 ent labels Dec 9, 2025
anilvpatel added a commit that referenced this pull request Dec 9, 2025
…art (#23088)

* fix(agent): prevents default TCP checks from being re-added on service reload when they were explicitly disabled or when custom checks were specified during initial registration.
anilvpatel added a commit that referenced this pull request Dec 9, 2025
…art (#23088)

* fix(agent): prevents default TCP checks from being re-added on service reload when they were explicitly disabled or when custom checks were specified during initial registration.
@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @anilvpatel! a backport is missing for this PR [23088] for versions [1.18,1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

2 similar comments
@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @anilvpatel! a backport is missing for this PR [23088] for versions [1.18,1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @anilvpatel! a backport is missing for this PR [23088] for versions [1.18,1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/all Apply backports for all active releases per .release/versions.hcl backport/ent/1.18 Changes are backported to 1.18 ent backport/ent/1.20 backport to ent 1.20 backport/ent/1.21 changes are backported to 1.21 ent backport/1.22 Changes are backported to 1.22

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants