Skip to content

Conversation

@alam-cloud
Copy link

Add support for configuring validation webhook timeout when installing the ATC.

  • Add ValidationWebhookTimeout field to installer Config
  • Pass timeout as VALIDATION_WEBHOOK_TIMEOUT environment variable
  • Load timeout from env var in ATC config
  • Apply timeout to all validation webhooks (default: 10s)

Fixes #129

Add support for configuring validation webhook timeout when installing the ATC.

- Add ValidationWebhookTimeout field to installer Config
- Pass timeout as VALIDATION_WEBHOOK_TIMEOUT environment variable
- Load timeout from env var in ATC config
- Apply timeout to all validation webhooks (default: 10s)

Fixes yokecd#129
@alam-cloud
Copy link
Author

Key changes:

  • Added ValidationWebhookTimeout to installer Config (optional, defaults to 10s)
  • Passed as VALIDATION_WEBHOOK_TIMEOUT env var to ATC
  • Applied to all validation webhooks (airway, resources, external-resources)
  • Dynamic webhooks created per Airway also respect this timeout

The timeout is optional - if not specified, it defaults to 10 seconds (Kubernetes default).

Let me know if you'd like any changes! 👍

DockerConfigSecretName string `json:"dockerConfigSecretName,omitzero" Description:"name of dockerconfig secret to allow atc to pull images from private registries"`
LogFormat string `json:"logFormat,omitzero" Enum:"json,text"`
Verbose bool `json:"verbose,omitzero" Description:"verbose logging"`
ValidationWebhookTimeout *int32 `json:"validationWebhookTimeout,omitzero" Description:"timeout in seconds for validation webhooks (default: 10)"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think a pointer is not necessary in this case. If the value is 0 or less than 0 we can ignore the field.

if cfg.ValidationWebhookTimeout != nil {
env = append(env, corev1.EnvVar{
Name: "VALIDATION_WEBHOOK_TIMEOUT",
Value: strconv.FormatInt(int64(*cfg.ValidationWebhookTimeout), 10),
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we use an int which is completely reasonable as the installer does not need to be optimized (its run once or once in a while) we could use the strconv.Itoa and avoid the type casts and dereferencing.

}

cfg.Service.CABundle = cfg.TLS.CA.Data
cfg.Service.ValidationWebhookTimeout = cfg.ValidationWebhookTimeout
Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont' think we need to put the timeout on the service structure. That is intended to define the k8s service that backs the atc and its tls requirements.

}

// Get timeout value, defaulting to 10 seconds if not configured
timeoutSeconds := cmp.Or(cfg.ValidationWebhookTimeout, ptr.To[int32](10))
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be a good idea to have different timeout values? Instead of one global flag for all webhooks have three different ones?

Copy link
Collaborator

@davidmdm davidmdm left a comment

Choose a reason for hiding this comment

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

Awesome start! Love to see it!

Alam Ahmad added 2 commits November 23, 2025 09:27
…viceDef

- Change ValidationWebhookTimeout from *int32 to int32 in installer Config
- Use strconv.Itoa instead of pointer dereferencing
- Remove ValidationWebhookTimeout from ServiceDef (it's for k8s service definition)
- Pass timeout as separate parameter to GetReconciler
- Add timeout field to atc struct instead

Addresses review comments from @davidmdm
- Replace single ValidationWebhookTimeout with three separate fields:
  - AirwayValidationWebhookTimeout (default: 10s) for airway instances
  - ResourceValidationWebhookTimeout (default: 5s) for event dispatching
  - ExternalResourceValidationWebhookTimeout (default: 30s) for external resources
- Update installer Config and ATC Config to support separate timeouts
- Apply appropriate timeout to each webhook type based on its purpose
- Update GetReconciler to use AirwayValidationWebhookTimeout for per-Airway webhooks
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.

atc-installer: configure validation webhook timeout

2 participants