Skip to content

✨ Networking config for default mode webhooks #379

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bhperry
Copy link
Contributor

@bhperry bhperry commented Jun 12, 2025

Summary

API changes to support customizing webhook ports and hostNetwork in Default installation mode

Related issue(s)

open-cluster-management-io/ocm#1035

@openshift-ci openshift-ci bot requested review from mdelder and qiujian16 June 12, 2025 23:22
Copy link
Contributor

openshift-ci bot commented Jun 12, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bhperry
Once this PR has been reviewed and has the lgtm label, please assign qiujian16 for approval. For more information see the Code Review Process.

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

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

// Metrics may be disabled by setting a value of "0" or "".
// +optional
// +kubebuilder:default=":8080"
MetricsBindAddress string `json:"metricsBindAddress"`
Copy link
Member

Choose a reason for hiding this comment

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

this is and health check are commonly the same address and port with different paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think controller-runtime supports that

Copy link
Member

Choose a reason for hiding this comment

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

I see, but do we need different addresses? Could we update exiting webhookConfiguration struct by adding healthinessPort and metricsPort into it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opted to use *BindAddress because:

  1. This is the format expected by controller-runtime. Kubebuilder generates CLI args in this same format as well.
  2. When HostNetwork: true is set, it may be desirable to bind healthcheck or metrics to localhost in order to prevent exposing those listeners externally

I did also consider simply adding new fields to WebhhokConfiguration, but they don't apply to Hosted options so I did not think it made sense to have extra fields in the public facing API that can only be used in some cases.

Copy link
Member

Choose a reason for hiding this comment

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

hrm, I think it might. Is to expose the address so another apiserver could access it. In some case, hostnetwork might be needed. Actually hosted mode is not quite used anyway, I just feel we do not need another configuration for the webhook.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding of hosted mode was that it's a remote webhook not directly controlled by OCM. And the webhook configuration is just an address/port to reach it. So while metrics/health/hostNet might be used in that remote location, they would not be controlled by this API config.

Is that not correct?

Copy link
Member

Choose a reason for hiding this comment

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

it is not quite correct, the address/port is still the setting on the webhook server to be exposed. The hosted mode means the controller/webhook server is running in cluster1, while hub cluster is cluster2. So the hub cluster needs to wire to the webhook server in cluster1 with an accessible address/port

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.

2 participants