Skip to content

feat(api/consul): allow configuring identities for sidecar_task #25877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

3nprob
Copy link
Contributor

@3nprob 3nprob commented May 19, 2025

Description

Allow configuring non-default identity for sidecar_task.

Testing & Reproduction steps

Sample job spec excerpt:

job "foo" {
  group "foo" {
    consul {}
    service {
      identity {
        aud = ["consul.io"]
      }
      connect {
        sidecar_service {}
        sidecar_task {
          identity {
            aud = ["consul.io"]
          }
        }
      }
    }
    task "foo" {
      # ...
    }
  }
}

Links

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad website documentation to reflect this. Refer to
    the website README for docs guidelines. Please also consider whether the
    change requires notes within the upgrade guide.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.

Copy link

hashicorp-cla-app bot commented May 19, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


3np seems not to be a GitHub user.
You need a GitHub account to be able to sign the CLA.
If you have already a GitHub account, please add the email address used for this commit to your account.

Have you signed the CLA already but the status is still pending? Recheck it.

@3nprob 3nprob force-pushed the sidecar_task-identity branch from f905250 to 60a3d9a Compare May 19, 2025 01:51
@3nprob 3nprob force-pushed the sidecar_task-identity branch from 60a3d9a to 06bf6fa Compare May 19, 2025 01:53
@3nprob 3nprob changed the title feat: allow configuring identities for sidecar_task feat(api/consul): allow configuring identities for sidecar_task May 19, 2025
@3nprob 3nprob marked this pull request as ready for review May 19, 2025 04:56
@3nprob 3nprob requested review from a team as code owners May 19, 2025 04:56
@3nprob
Copy link
Contributor Author

3nprob commented May 19, 2025

This has been manually tested. ✔️

@aimeeu aimeeu added the theme/docs Documentation issues and enhancements label May 19, 2025
aimeeu
aimeeu previously approved these changes May 19, 2025
Copy link
Contributor

@aimeeu aimeeu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the docs. Approving the docs content only.

@3nprob
Copy link
Contributor Author

3nprob commented May 19, 2025

Rebased on main and had to resolve merge-conflict in docs. No further changes.

aimeeu
aimeeu previously approved these changes May 20, 2025
Copy link
Contributor

@aimeeu aimeeu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs approval

Copy link
Member

@jrasell jrasell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @3nprob and thanks for raising this PR.

Before I perform manual testing and thorough code review, would it be possible to add units tests for the new functionality covered? Once these are added I'll go ahead and review. Thanks.

@3nprob
Copy link
Contributor Author

3nprob commented May 28, 2025

Hi @3nprob and thanks for raising this PR.

Before I perform manual testing and thorough code review, would it be possible to add units tests for the new functionality covered?

I did add a unit test for the api change just now. In case that is insufficient, could you point me to:

  • Which additional test units you expect to be updated?
  • How to run those locally?
    • make test and make test-nomad yield a lot of unrelated failures for me (missing deps and other assumptions not holding here) and as I def won't have time to sort out the entire integration suite locally it would be helpful to know what is expected to change/pass.

@jrasell
Copy link
Member

jrasell commented May 30, 2025

Hi @3nprob; some of the initial entry points to check out:

The CopySliceWorkloadIdentity should be tested to ensure all objects are copied correctly and that we have a new object (not the same memory address). e2e testing would also be nice, but certainly something I would not block the PR on at this stage.

In order to target tests to run, Go supports a-run flag within go test that can be used: https://pkg.go.dev/cmd/go#hdr-Testing_flags

If you have any problems please let me know and I'll be happy to help. I can also work on pushing tests to this PR if you want, just let me know.

@3nprob
Copy link
Contributor Author

3nprob commented May 30, 2025

In order to target tests to run, Go supports a-run flag within go test that can be used: https://pkg.go.dev/cmd/go#hdr-Testing_flags

Probably skill issue on my end but what is the actual arguments to pass for this project? E.g. to run the test I added and/or the ones you listed above?

Attempts yield all-or-nothing so far:

$ go test -v -run '.*'
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/nomad      0.300s

Getting same for .*/.*, .*/.*/.*, etc.

go test -list just showing the one top-level:

$ go test -list
ok     github.com/hashicorp/nomad      0.203s

go test -list '.*' ./... takes ~5 min and lists a bunch but no TestSidecarTask_Canonicalize.

If you have any problems please let me know and I'll be happy to help. I can also work on pushing tests to this PR if you want, just let me know.

That would also be super helpful!

@3nprob
Copy link
Contributor Author

3nprob commented Jun 2, 2025

@jrasell PTAL

@3nprob
Copy link
Contributor Author

3nprob commented Jun 22, 2025

Realistic hoping for this to land on CE 1.10?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/docs Documentation issues and enhancements
Projects
Development

Successfully merging this pull request may close these issues.

3 participants