Skip to content

feat: add configurable HTTP client timeouts via config file#1882

Closed
piotrjanik wants to merge 1 commit intoopen-component-model:mainfrom
piotrjanik:feat/timeout
Closed

feat: add configurable HTTP client timeouts via config file#1882
piotrjanik wants to merge 1 commit intoopen-component-model:mainfrom
piotrjanik:feat/timeout

Conversation

@piotrjanik
Copy link
Copy Markdown
Contributor

@piotrjanik piotrjanik commented Mar 25, 2026

Introduce the http.config.ocm.software/v1alpha1 config type for
controlling HTTP client timeouts (dial, TLS handshake, response header,
idle connection, keep-alive, and overall timeout). Timeouts are configured exclusively through the OCM config. When not set, http.DefaultTransport values are preserved unchanged.

  • Add api/utils/httpclient transport factory (clones DefaultTransport,
    selectively overrides from config)
  • Wire HTTP settings into docker daemon and OCI registry clients
  • Add integration tests using toxiproxy for timeout verification
  • Update docs with new config type documentation

Fixes: #1731

@github-actions github-actions Bot added area/documentation Documentation related component/ocm-cli OCM Command Line Interface kind/dependency dependency update, etc. kind/feature new feature, enhancement, improvement, extension size/l Large labels Mar 25, 2026
Comment thread api/datacontext/attrs/httpcfgattr/config.go Outdated
Comment thread api/datacontext/attrs/httpcfgattr/config.go Outdated
Comment thread api/datacontext/attrs/httpcfgattr/config.go Outdated
Comment thread api/oci/extensions/repositories/docker/client.go
Comment thread api/datacontext/attrs/httpcfgattr/config.go
Comment thread api/utils/httpclient/transport.go
@piotrjanik piotrjanik marked this pull request as ready for review March 26, 2026 21:28
@piotrjanik piotrjanik requested a review from a team as a code owner March 26, 2026 21:28
)

const (
ATTR_KEY = "ocm.software/ocm/api/datacontext/attrs/httptimeout"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: if this is an attribute config and not a normal config its impossible for us to use in v2, so im wondering if an attr should even be included

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.

@jakobmoellerdev I followed the rootcertsattr implementation and replicated it here. Why could this be a problem for v2?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

because attribute configs by design are problematic in v2 due to our plugin nature so we do not support any attribtue configuration in v2 atm

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.

@jakobmoellerdev I have created this PR with different approach: https://github.com/open-component-model/ocm/pull/1887/changes
This one should use config file only.

Copy link
Copy Markdown
Member

@jakobmoellerdev jakobmoellerdev left a comment

Choose a reason for hiding this comment

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

2 nits on parsing, apart from that LGTM

Comment thread api/datacontext/attrs/httpcfgattr/config.go Outdated
Copy link
Copy Markdown
Contributor

@matthiasbruns matthiasbruns left a comment

Choose a reason for hiding this comment

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

lgtm now - only the nits from jakob

@piotrjanik piotrjanik force-pushed the feat/timeout branch 2 times, most recently from c7fcbcc to 2ed48d4 Compare March 30, 2026 07:23
<!-- markdownlint-disable MD041 -->

Introduce the `http.config.ocm.software/v1alpha1` config type for
controlling HTTP client timeouts (dial, TLS handshake, response header,
idle connection, keep-alive, and overall timeout). Timeouts are configured
exclusively through the OCM config file using Go duration strings. When
not set, `http.DefaultTransport` values are preserved unchanged.

- Add `httpcfgattr` package with Duration type
- Add `api/utils/httpclient` transport factory (clones DefaultTransport,
  selectively overrides from config)
- Wire HTTP settings into docker daemon and OCI registry clients
- Add integration tests using toxiproxy for timeout verification
- Update docs with new config type documentation

Fixes: open-component-model#1731

Signed-off-by: Piotr Janik <piotr.janik@sap.com>
@matthiasbruns
Copy link
Copy Markdown
Contributor

so this can be closed for the other pr? #1887

@piotrjanik piotrjanik closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation Documentation related component/ocm-cli OCM Command Line Interface kind/dependency dependency update, etc. kind/feature new feature, enhancement, improvement, extension size/l Large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add timeout configuration flag to OCM CLI

3 participants