Skip to content

Add tls pkg#2

Merged
damdo merged 1 commit into
openshift:mainfrom
damdo:add-tls-pkg
Feb 4, 2026
Merged

Add tls pkg#2
damdo merged 1 commit into
openshift:mainfrom
damdo:add-tls-pkg

Conversation

@damdo

@damdo damdo commented Jan 29, 2026

Copy link
Copy Markdown
Member

Stacked PR on top of #1

/hold

For #1 to merge first

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 29, 2026

@joelanford joelanford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need for this repo to have a vendor directory. That's only needed in repos that build images for OCP.

Comment thread pkg/tls/tls.go Outdated
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 2, 2026
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 2, 2026
Comment thread pkg/tls/controller.go Outdated
Comment on lines +44 to +46
// Shutdown is a function that will be called to trigger a graceful shutdown
// when the TLS profile changes.
Shutdown context.CancelFunc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WDYT about changing this to a general-purpose callback function that includes context about the old and new TLS profile?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah that's a good idea, so the consumers can tweak their own logging if needed.
I've pushed a change for this. PTAL

Comment thread pkg/tls/controller_test.go Outdated
Eventually(shutdownCnt.Load).Should(Equal(int32(1)), "shutdown count should be 1 (shutdown triggered)")
})

It("should trigger a shutdown when switching to custom profile", func() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if the custom profile definition is identical to the pre-defined profile they were switching from? Seems like we may want to do a comparison of the actual TLS settings?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Seems like we may want to do a comparison of the actual TLS settings?

That's what we do already.

I've now added a test to cover this use case and demonstrate correct behaviour.

Comment thread pkg/tls/controller_test.go Outdated
Eventually(shutdownCnt.Load).Should(Equal(int32(1)), "shutdown count should be 1 (shutdown triggered)")
})

It("should trigger a shutdown when switching from custom to predefined profile", func() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same question as above, just in the reverse.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's what we do already.

I've now added a test to cover this use case and demonstrate correct behaviour.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems unrelated to controller-runtime and TLS?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is needed to achieve the CRD loading for envtest based tests given we want to drop the vendor folder.
I had a chat with Joel about this, and we settled on looking those CRDs up from the gomod cache's folder, hence the package to do that. I can always do it inline but that's going to be copy-pasta in almost all the integration tests.

@damdo damdo Feb 2, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ack, makes sense. And that's a good justification for including here because envtest is so pervasive and needing to install CRDs from repos is a fairly common thing.

Maybe this turns into a nit-level suggestion then of making it obvious this is a test utility. Maybe like pkg/testutils/envtest? But totally a nit. Naming is hard ™️.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, cool, I've moved this to said pkg. TY

@damdo

damdo commented Feb 3, 2026

Copy link
Copy Markdown
Member Author

@joelanford I've addressed all comments, this is ready for a second pass review.

@joelanford

Copy link
Copy Markdown
Member

/lgtm
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Feb 4, 2026
@damdo damdo merged commit 9b165b4 into openshift:main Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants