Skip to content

Conversation

@NiJuFirenzia
Copy link

@NiJuFirenzia NiJuFirenzia commented Dec 10, 2025

Prow currently requires SSL connections to be terminated before connecting to the deck and hook pods. This does not enable users to run prow with backend https enabled on their ingress. This PR adds the option to enable backend https on ingresses by passing in specific flags to the hook and deck pods. The argument flags will look like as below:

hook:

- --enable-ssl=true
- --server-cert-file=/etc/prow/tls.crt
- --server-key-file=/etc/prow/tls.key

deck:

- --enable-ssl=true
- --server-cert-file=/etc/prow/tls.crt
- --server-key-file=/etc/prow/tls.key
- --client-cert-file=etc/prow/deck-client.crt

In the example above, a secret containing the cert file and key file was mounted to the deck and hook pods. Additionally this has been tested to continue working as is with ingress backend to be set to just HTTP if the flags are not passed in.

@netlify
Copy link

netlify bot commented Dec 10, 2025

Deploy Preview for k8s-prow ready!

Name Link
🔨 Latest commit 2ad6fa1
🔍 Latest deploy log https://app.netlify.com/projects/k8s-prow/deploys/696a3c89be577c00085419a4
😎 Deploy Preview https://deploy-preview-573--k8s-prow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added area/deck Issues or PRs related to prow's deck component area/hook Issues or PRs related to prow's hook component labels Dec 10, 2025
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 10, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: NiJuFirenzia / name: Nikhil Jiju (2ad6fa1)

@k8s-ci-robot
Copy link
Contributor

Welcome @NiJuFirenzia!

It looks like this is your first PR to kubernetes-sigs/prow 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/prow has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 10, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @NiJuFirenzia. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 10, 2025
@NiJuFirenzia
Copy link
Author

NiJuFirenzia commented Dec 10, 2025

This PR addresses Issue #328

@matthyx
Copy link
Contributor

matthyx commented Dec 10, 2025

@NiJuFirenzia thanks for your PR, can you check the CLA and sign it?

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 10, 2025
@matthyx
Copy link
Contributor

matthyx commented Dec 10, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 10, 2025
@kayhern kayhern force-pushed the add-option-for-ssl branch 2 times, most recently from b32381d to 2cfbae6 Compare December 16, 2025 15:12
cmd/hook/main.go Outdated
Comment on lines 76 to 78
enableSSL bool
certFile string
keyFile string
Copy link
Contributor

Choose a reason for hiding this comment

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

let's group this into a small struct that we can embed at both places, we can share validation etc. similarly to how the ThingOptions bits above

cmd/hook/main.go Outdated
Comment on lines 292 to 295
httpServer := &http.Server{
Addr: ":" + strconv.Itoa(o.port),
Handler: hookMux,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems identical in both branches, so can be extracted before the condition

// cacheLife is the time that we keep a pluginhelp.Help struct before considering it stale.
// We consider help valid for a minute to prevent excessive calls to hook.
const cacheLife = time.Minute
const tlsEnabledScehma = "https"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const tlsEnabledScehma = "https"
const tlsEnabledSchema = "https"

transport.TLSClientConfig = &tls.Config{
RootCAs: caCertPool,
}
http.DefaultTransport = transport
Copy link
Contributor

Choose a reason for hiding this comment

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

helpAgent should get a custom client member with this transport instead of modifying the global default transport (this would affect anything else in deck that is a http client and relies on the default)

Comment on lines 68 to 73
caCert, err := os.ReadFile(ha.cert)
if err != nil {
return nil, fmt.Errorf("error decoding cert file: %w", err)
}
caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM(caCert)
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not entirely sure I like this coupling. This essentially reuses Deck's server cert as a CA cert to establish trust with Hook's server cert for this behavior where Deck is a client to hook's pluginhelp endpoint? That's a bit hacky and suprising.

Copy link
Author

Choose a reason for hiding this comment

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

That would require having to add another option flag to take in a client cert right? I had been trying to limit the options that we would need

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: NiJuFirenzia
Once this PR has been reviewed and has the lgtm label, please ask for approval from petr-muller. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: Nikhil Jiju <Nikhil.Jiju@fmr.com>
@kayhern kayhern force-pushed the add-option-for-ssl branch from 9865cdd to 2ad6fa1 Compare January 16, 2026 13:26
@NiJuFirenzia
Copy link
Author

All change requests have been addressed and this PR is ready for a re-review

Copy link
Contributor

@petr-muller petr-muller left a comment

Choose a reason for hiding this comment

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

There's a flag name mismatch between error message and actual names. I have pointed out some opportunities to reduce stuttering (sslEnablement.EnableSSL and verbosity sslEnablement vs ssl) but treat them as non-blocking nits.

func (o *SSLEnablementOptions) Validate(_ bool) error {
if o.EnableSSL {
if o.ServerCertFile == "" {
return errors.New("flag --enable-ssl was set to true but required flag --cert-file was not set")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return errors.New("flag --enable-ssl was set to true but required flag --cert-file was not set")
return errors.New("flag --enable-ssl was set to true but required flag --server-cert-file was not set")

actual flags are different

return errors.New("flag --enable-ssl was set to true but required flag --cert-file was not set")
}
if o.ServerKeyFile == "" {
return errors.New("flag --enable-ssl was set to true but required flag --key-file was not set")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return errors.New("flag --enable-ssl was set to true but required flag --key-file was not set")
return errors.New("flag --enable-ssl was set to true but required flag --server-key-file was not set")

}

func (o *SSLEnablementOptions) Validate(_ bool) error {
if o.EnableSSL {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should either check also the opposite case (enabled is false but cert was passed, possibly confusing the admin they are using SSL when they are not), or make this an implied field from the presence of at least one file flags (if at least one is set, assume the user wants to have it enabled and validate both are set).

bugzilla prowflagutil.BugzillaOptions
instrumentationOptions prowflagutil.InstrumentationOptions
jira prowflagutil.JiraOptions
sslEnablement prowflagutil.SSLEnablementOptions
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
sslEnablement prowflagutil.SSLEnablementOptions
ssl prowflagutil.SSLEnablementOptions

// HTTPS backend. If enableSSL is true, both certFile and keyFile must be set
// to the location of the cert and key files respectively.

type SSLEnablementOptions struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

tbh I'd call this just SSLOptions or SSLServerOptions and the package flagutil/ssl

Comment on lines +30 to +32
EnableSSL bool
ServerCertFile string
ServerKeyFile string
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
EnableSSL bool
ServerCertFile string
ServerKeyFile string
Enabled bool
CertFile string
KeyFile string

the instance of this struct will typically called ssl or something so meaning is typically provided by that context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/deck Issues or PRs related to prow's deck component area/hook Issues or PRs related to prow's hook component cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants