Skip to content

feat: make the webhook port configurable #301

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 3 commits into
base: main
Choose a base branch
from

Conversation

Argannor
Copy link

Description of your changes

As outlined in the issue below, when running Crossplane in certain environments (like EKS using Calico CNI), where the control plane resides outside the workload network it is necessary to run webhooks in the host network. This calls for the need to make the port configurable to avoid conflicts.

I opened crossplane/crossplane!5540 to allow a DeploymentRuntimeConfig to overwrite the ports of the crossplane managed services created for each provider / function.

Fixes #208

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

I deployed my fork of this and crossplane in our test cluster running EKS and Calico. With this I was able to run both Crossplane and provider-kubernetes inside the host network with custom ports.

This change only makes sense if my other PR gets accepted.

@@ -63,6 +63,7 @@ func main() {
leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").Envar("LEADER_ELECTION").Bool()
maxReconcileRate = app.Flag("max-reconcile-rate", "The number of concurrent reconciliations that may be running at one time.").Default("100").Int()
sanitizeSecrets = app.Flag("sanitize-secrets", "when enabled, redacts Secret data from Object status").Default("false").Envar("SANITIZE_SECRETS").Bool()
webhookPort = app.Flag("webhook-port", "The port the webhook listens on").Default("9443").Envar("WEBHOOK_PORT").Int()
Copy link
Contributor

Choose a reason for hiding this comment

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

for all providers, also allow configuring metrics bind address which gets passed onto sigs.k8s.io/controller-runtime/pkg/metrics/server.Options ?
we can standardize on --webhook-port and --metrics-bind-address flags across all providers, similar to crossplane core flags..

Copy link
Author

Choose a reason for hiding this comment

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

+1 for standardizing. I added the --metrics-bind-address as well as requested. Thank you for the feedback!

Copy link
Member

Choose a reason for hiding this comment

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

by the time we finished crossplane/crossplane#5540, we ended up with:

      --webhook-port=9443                                     The port the webhook server listens on ($WEBHOOK_PORT).
      --metrics-port=8080                                     The port the metrics server listens on ($METRICS_PORT).

So we should update this PR to those values too, so we keep with the intended standardization. Let's try not ship a version of this provider and then change the flag later on 🤓

@Argannor are you still up for driving this PR to completion?

Copy link
Contributor

@ravilr ravilr May 7, 2025

Choose a reason for hiding this comment

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

@jbw976 please see crossplane/crossplane#5540 (comment)

the argument towards keeping the metrics port configuration as address string is: Some Security focussed setups would not want to expose the metrics port on all interfaces, instead only on 127.0.0.1:8080 and then front it with a rbac-proxy sidecar which requires auth for the prometheus scrapers to be able to reach it.

Intaking it as metrics-port int arg, will take away above ability.

the webhook port being passed in as int arg is fine because, the webhook server is TLS enabled and requires the client(Kuberntes API Server) to have access to self-signed CA for verification.

@ctenberge-oneid
Copy link

I could really use this sooner rather than later. @ravilr is there anyway this can be prioritized? Really appreciate your work either way.

@ctenberge-oneid
Copy link

What is stopping this from being merged? Thanks for the work by the way.

Copy link
Contributor

@erhancagirici erhancagirici left a comment

Choose a reason for hiding this comment

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

LGTM in general. nit would be whether it would be feasible to enforce standardization of those flag names consistently across all providers. That can be a follow-up though.

Copy link
Member

@jbw976 jbw976 left a comment

Choose a reason for hiding this comment

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

feasible to enforce standardization

enforcement, probably not across the entire ecosystem i suppose, but let's try to keep them standard for all the providers we can, including this one 😉

see https://github.com/crossplane-contrib/provider-kubernetes/pull/301/files#r2077361313

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.

Conversion Webhook breaks deployment on clusters with seperate control plane
6 participants