Skip to content

fix: unify webhook listeners on path based endpoints#304

Open
pepordev wants to merge 6 commits into
external-secrets:mainfrom
pepordev:fix/unify-webhook-listeners
Open

fix: unify webhook listeners on path based endpoints#304
pepordev wants to merge 6 commits into
external-secrets:mainfrom
pepordev:fix/unify-webhook-listeners

Conversation

@pepordev

@pepordev pepordev commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

fixes #242

I've test it out in our environments with multiples configurations using our keeper-security integration and it is working fine

Signed-off-by: Pedro Parra Ortega <parraortega.pedro@gmail.com>
Signed-off-by: Pedro Parra Ortega <parraortega.pedro@gmail.com>
@Skarlso Skarlso self-requested a review April 16, 2026 07:20

@Skarlso Skarlso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Initial round done. I know this is mostly borrowed code. I tried to flag only criticals. Let's leave it off a bit better than we found it. :)

Comment thread internal/listener/manager.go Outdated
Comment thread internal/listener/webhook/server.go Outdated
Comment thread internal/listener/webhook/route.go
Comment thread internal/listener/webhook/route.go Outdated
Comment thread internal/listener/webhook/route.go Outdated
Comment thread api/v1alpha1/source_webhook_types.go
Comment thread internal/listener/webhook/route.go Outdated
Comment thread internal/listener/webhook/server.go
Comment thread internal/controller/reloader_controller.go Outdated
Comment thread docs/sources/webhook.md Outdated
pepordev added 3 commits June 22, 2026 07:40
Signed-off-by: Pedro <parraortega.pedro@gmail.com>
Signed-off-by: Pedro Parra Ortega <parraortega.pedro@gmail.com>
Signed-off-by: Pedro Parra Ortega <parraortega.pedro@gmail.com>
@Skarlso

Skarlso commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

I'll fix the cve thing.

@Skarlso

Skarlso commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Done :) Should be on main.

@pepordev

Copy link
Copy Markdown
Contributor Author

Done :) Should be on main.

updated! thanks!

@Skarlso

Skarlso commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

will take a look at this today afternoon! Thanks

@Skarlso Skarlso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Couple of more issues, but it's getting there! :) Nice! :)

Comment on lines +97 to +105
eventListener := webhook.NewWebhookListener(
lm.webhookServer,
manifestName.Name,
lm.context,
webhookCfg,
lm.client,
lm.eventChan,
lm.logger,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Multiple configs with the same name are overwritten.

@pepordev pepordev Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Multiple configs with the same name are overwritten.

configs are cluster wide resources no name colision possible as the api would reject any duplication. The only option for override would be the case were a config have multiples webhook configurations as source. Which is something that does not make too much sense to me. I see 2 options:

  1. Not allow multiples wehookConfig for a config.
  2. add a optional field in the WebhookConfig to add a suffix to the webhook path. so we would allow multiples webhooks in 1 config.
  • /webhook/keeper/config1
  • /webhook/keeper/config2

What do you think?

message.retryAt = getNextRetryAt(r.config.RetryPolicy.Algorithm, message.currentRun)
}
select {
case r.retryQueue <- message:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You are self-sending here... This will deadlock 🤔 Your only receiver is the same go routine. I'm wondering how this even works in any tests. 🤔 This should effectively die after like... the first retry.

}

// NewWebhookServer constructs a server; call Start to listen.
func NewWebhookServer(addr string, logger logr.Logger) *WebhookServer {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You also need to implement the Leader election function otherwise only the leader can run this. 🤔

Comment on lines +70 to +72
# When true, /metrics is served over HTTPS (and requires Kubernetes auth for scrapers).
# When false, /metrics is plain HTTP — matches default Prometheus ServiceMonitor scraping.
secure: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nope. Can't have false as default. Sorry.

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.

webhook source in configurations create new servers per config

2 participants