Skip to content
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

gateway-provisoner: customize the cert's lifetime #6604

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

Conversation

izturn
Copy link
Member

@izturn izturn commented Aug 8, 2024

Signed-off-by: Gang Liu gang.liu@daocloud.io

In the past, we could only use 'Certgen' to set the lifetime, this PR has added the new way to set it through provisioner

@izturn izturn requested a review from a team as a code owner August 8, 2024 10:12
@izturn izturn requested review from skriss and sunjayBhatia and removed request for a team August 8, 2024 10:12
@izturn izturn self-assigned this Aug 8, 2024
@sunjayBhatia sunjayBhatia requested review from a team, rajatvig and clayton-gonsalves and removed request for a team August 8, 2024 10:12
@izturn izturn added the release-note/minor A minor change that needs about a paragraph of explanation in the release notes. label Aug 8, 2024
Signed-off-by: gang.liu <gang.liu@daocloud.io>
Signed-off-by: gang.liu <gang.liu@daocloud.io>
Copy link

codecov bot commented Aug 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.77%. Comparing base (808864b) to head (1766f9f).
Report is 42 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #6604   +/-   ##
=======================================
  Coverage   81.76%   81.77%           
=======================================
  Files         133      133           
  Lines       15944    15947    +3     
=======================================
+ Hits        13037    13040    +3     
  Misses       2614     2614           
  Partials      293      293           
Files with missing lines Coverage Δ
internal/provisioner/controller/gateway.go 59.40% <100.00%> (+0.34%) ⬆️
internal/provisioner/model/model.go 100.00% <100.00%> (ø)
internal/provisioner/objects/secret/secret.go 48.43% <100.00%> (ø)

Copy link
Member

@tsaarni tsaarni left a comment

Choose a reason for hiding this comment

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

Looks good to me, few comments inline.

changelogs/unreleased/6604-izturn-minor.md Outdated Show resolved Hide resolved
apis/projectcontour/v1alpha1/contourdeployment.go Outdated Show resolved Hide resolved
@izturn izturn requested a review from tsaarni August 20, 2024 10:09
Copy link
Member

@tsaarni tsaarni left a comment

Choose a reason for hiding this comment

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

I tested the change and it worked great, both contourcert and envoycert were getting the configured expiry period.

I still added some more suggestion to rephrase the documentation, since I thought there might be a chance of misunderstanding what certificates are being discussed, especially for those who do not use Gateway API.

Looking at the existing docs, it seems to me we might have a gap describing the auto-generated xDS certificates in context of Gateway API and how to life-cycle manage them. Being able to set expiry via certLifetime is good but it should preferably be clearly documented that the gateway provisioner has no capability to renew every certLifetime days - we could create a new issue for that.

changelogs/unreleased/6604-izturn-minor.md Outdated Show resolved Hide resolved
apis/projectcontour/v1alpha1/contourdeployment.go Outdated Show resolved Hide resolved
@izturn izturn requested a review from tsaarni August 27, 2024 09:29
Copy link

The Contour project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 14d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the PR is closed

You can:

  • Ensure your PR is passing all CI checks. PRs that are fully green are more likely to be reviewed. If you are having trouble with CI checks, reach out to the #contour channel in the Kubernetes Slack workspace.
  • Mark this PR as fresh by commenting or pushing a commit
  • Close this PR
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 12, 2024
@izturn
Copy link
Member Author

izturn commented Sep 12, 2024

ping @tsaarni

@izturn izturn removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 12, 2024
Copy link
Member

@tsaarni tsaarni left a comment

Choose a reason for hiding this comment

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

Thanks @izturn, looks good to me!

I wonder if others want to still to comment, especially those who are actively using Gateway API in their production (unlike me)?

@izturn
Copy link
Member Author

izturn commented Sep 13, 2024

@skriss @sunjayBhatia , WDYT?

@tsaarni
Copy link
Member

tsaarni commented Sep 19, 2024

An additional thought occurred to me regarding the API changes. I'm speculating here, but imagine that in the future, the gateway-provisioner might support Cert-manager instead of certgen. It could create Cert-manager CRs for Contour and Envoy, allowing Cert-manager to handle certificate management. With that in mind, are we introducing anything in this PR that could make it harder to add support for Cert-manager in the API later on?

  • When Cert-manager support is introduced, there would likely need to be at least one additional certificate-related parameter—a field where users can choose between certgen and cert-manager.
  • Cert-manager defaults to 90 days for certificate lifetimes and supports duration down to 1 hour, while certgen defaults to 365 days.

It might be easier to support future attributes if we group certificate-related fields into a struct, rather than adding them all flat under ContourSettings.

More specifically, XDS certificates aren't purely a Contour setting since they also impact Envoy. I understand that the current field naming under ContourDeployment.spec.contour.certLifetime is a compromise, but if we anticipate more certificate-related parameters, perhaps something like ContourDeployment.spec.certificates could make sense as well?

Similar to certgen, Cert-manager allows configuring certificate lifetimes via the Certificate.spec.duration field. The certLifetime parameter could potentially control this in the future. However, Cert-manager supports Go duration units, with a minimum value of 1h, not just days. The current field in this PR uses days and defaults to 365, but since this is only documented in the comments, the default could change in the future if Cert-manager is selected.

Copy link

github-actions bot commented Oct 7, 2024

The Contour project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 14d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the PR is closed

You can:

  • Ensure your PR is passing all CI checks. PRs that are fully green are more likely to be reviewed. If you are having trouble with CI checks, reach out to the #contour channel in the Kubernetes Slack workspace.
  • Mark this PR as fresh by commenting or pushing a commit
  • Close this PR
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 7, 2024
@izturn izturn removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 8, 2024
Copy link

The Contour project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 14d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the PR is closed

You can:

  • Ensure your PR is passing all CI checks. PRs that are fully green are more likely to be reviewed. If you are having trouble with CI checks, reach out to the #contour channel in the Kubernetes Slack workspace.
  • Mark this PR as fresh by commenting or pushing a commit
  • Close this PR
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 23, 2024
@izturn izturn removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/minor A minor change that needs about a paragraph of explanation in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants