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

adds tls reconciler #155

Merged
merged 13 commits into from
Mar 22, 2024
Merged

adds tls reconciler #155

merged 13 commits into from
Mar 22, 2024

Conversation

OliverMKing
Copy link
Collaborator

@OliverMKing OliverMKing commented Jan 23, 2024

Description

Adds a tls reconciler that adds the TLS portion to Ingresses that have the keyvault tls cert managed by us. We reconcile the Ingress object to point to the managed secret that contains the cert pulled from keyvault if the Ingress contains a specific annotation.

To use this feature, users will need to add the kubernetes.azure.com/tls-cert-keyvault-managed: true annotation to their Ingress.

Essentially, the reconcile logic is as follows:

  • Do nothing if the Ingress' IngressClass is not an App Routing IngressClass
  • Do nothing if the Ingress doesn't contain the kubernetes.azure.com/tls-cert-keyvault-managed: true annotation
  • If the Ingress has the kubernetes.azure.com/tls-cert-keyvault-managed: true annotation but doesn't contain the kubernetes.azure.com/tls-cert-keyvault-uri: <uri> annotation then we push an Event to the Ingress informing them that we can't manage TLS without that.
  • If the Ingress contains both required annotations we always set the TLS section of the Ingress to point to the App Routing managed Secret. We also update the TLS hosts to exactly match the hosts section of the rules part of the Ingress spec. We do this regardless of if the TLS section was empty before. This is a truly "managed" experience. If we chose not to reconcile if the TLS section was non-empty then we wouldn't be able to handle the case of a user adding a new Rule and hostname to the spec of the Ingress.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

unit

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@coveralls
Copy link
Collaborator

coveralls commented Jan 23, 2024

Pull Request Test Coverage Report for Build 8391179182

Details

  • 49 of 78 (62.82%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.4%) to 79.45%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller/controller.go 0 4 0.0%
pkg/controller/keyvault/ingress_tls.go 44 69 63.77%
Totals Coverage Status
Change from base Build 8391177511: -0.4%
Covered Lines: 2656
Relevant Lines: 3343

💛 - Coveralls

jaiveerk
jaiveerk previously approved these changes Jan 25, 2024
@OliverMKing
Copy link
Collaborator Author

/ok-to-test sha=8177500

@sabbour sabbour self-requested a review January 30, 2024 20:01
sabbour
sabbour previously approved these changes Jan 30, 2024
Copy link

@sabbour sabbour left a comment

Choose a reason for hiding this comment

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

Approving the logic. Looks good, thank you.

@OliverMKing
Copy link
Collaborator Author

/ok-to-test sha=b886254

@OliverMKing OliverMKing dismissed stale reviews from jaiveerk and sabbour via 0f31414 January 30, 2024 21:12
@OliverMKing
Copy link
Collaborator Author

/ok-to-test sha=0f31414

@OliverMKing
Copy link
Collaborator Author

/ok-to-test sha=cec8cd3

@OliverMKing
Copy link
Collaborator Author

/ok-to-test sha=acfd433

aamgayle
aamgayle previously approved these changes Feb 1, 2024
Copy link
Contributor

@aamgayle aamgayle left a comment

Choose a reason for hiding this comment

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

LGTM

@OliverMKing
Copy link
Collaborator Author

/ok-to-test sha=28adffb

@davidgamero
Copy link
Contributor

davidgamero commented Mar 21, 2024

in the description,

If the Ingress contains both required Ingresses

this is referring to annotations right?

@OliverMKing
Copy link
Collaborator Author

in the description,

If the Ingress contains both required Ingresses

this is referring to annotations right?

yes

Copy link
Contributor

@davidgamero davidgamero left a comment

Choose a reason for hiding this comment

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

lgtm

@OliverMKing OliverMKing merged commit 3e4979e into Azure:main Mar 22, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants