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

Abstract the secret key names for Pinniped-generated certificates held in K8s secrets #2025

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

joshuatcasey
Copy link
Member

Abstract the secret key names for Pinniped-generated certificates held in K8s secrets.

This does change production code, but should essentially be a refactor (no change in observable behavior). It's a refactor in preparation for any changes made for #1238 .

corev1 "k8s.io/api/core/v1"
)

type RetrieveFromSecretFunc func(secret *corev1.Secret) ([]byte, []byte)
Copy link
Member Author

Choose a reason for hiding this comment

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

Should this be split into separate types? Confirm that the call sites only ever want a CA or a serving cert.

@@ -56,7 +62,7 @@ func NewCertsManagerController(
return controllerlib.New(
controllerlib.Config{
Name: "certs-manager-controller",
Copy link
Member

Choose a reason for hiding this comment

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

Missed renaming controller name string.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will be fixed with the next push

@@ -164,6 +162,7 @@ func PrepareControllers(c *Config) (controllerinit.RunnerBuilder, error) { //nol
apicerts.NewAPIServiceUpdaterController(
c.ServerInstallationInfo.Namespace,
c.NamesConfig.ServingCertificateSecret,
apicerts.RetrieveCAFromSecret,
Copy link
Member

Choose a reason for hiding this comment

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

Not sure I understand why the controllers need these new dependencies injected?

Copy link
Member Author

Choose a reason for hiding this comment

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

They are exported, global functions, so theoretically they could just be called inline.

The reason they are injected as dependencies is just so the unit tests of these controllers can provide their own implementation of this function, which means that it does not need to be aware of the specific keys used in the secret (it can make up its own keys).

@@ -42,6 +42,9 @@ func TestAPIServiceUpdaterControllerOptions(t *testing.T) {
_ = NewAPIServiceUpdaterController(
installedInNamespace,
certsSecretResourceName,
func(secret *corev1.Secret) ([]byte, []byte) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Why is this being injected here?

@joshuatcasey joshuatcasey force-pushed the jtc/externally-configured-serving-certs branch from f42af41 to bb4ef17 Compare August 1, 2024 20:56
Copy link

codecov bot commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 75.51020% with 12 lines in your changes missing coverage. Please review.

Project coverage is 31.96%. Comparing base (1571859) to head (1958bb8).

Files with missing lines Patch % Lines
internal/concierge/server/prepare_controllers.go 0.00% 8 Missing ⚠️
internal/concierge/server/server.go 0.00% 2 Missing ⚠️
...l/localuserauthenticator/localuserauthenticator.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2025      +/-   ##
==========================================
+ Coverage   31.94%   31.96%   +0.02%     
==========================================
  Files         379      380       +1     
  Lines       62087    62111      +24     
==========================================
+ Hits        19835    19856      +21     
- Misses      41723    41726       +3     
  Partials      529      529              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joshuatcasey joshuatcasey force-pushed the jtc/externally-configured-serving-certs branch from bb4ef17 to 7bf0bd2 Compare August 2, 2024 04:08
@joshuatcasey
Copy link
Member Author

Marking this as draft until we have a path forward for #2027

@joshuatcasey joshuatcasey marked this pull request as draft August 5, 2024 17:26
@joshuatcasey joshuatcasey force-pushed the jtc/externally-configured-serving-certs branch from 7bf0bd2 to c9b7e49 Compare August 9, 2024 15:59
@joshuatcasey joshuatcasey force-pushed the jtc/externally-configured-serving-certs branch from c9b7e49 to 7e433a2 Compare October 24, 2024 17:38
Copy link

netlify bot commented Oct 24, 2024

Deploy Preview for pinniped-dev canceled.

Name Link
🔨 Latest commit 1958bb8
🔍 Latest deploy log https://app.netlify.com/sites/pinniped-dev/deploys/674f4d4405318300088269ff

@joshuatcasey joshuatcasey force-pushed the jtc/externally-configured-serving-certs branch from 7e433a2 to 1958bb8 Compare December 3, 2024 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants