Skip to content

add basic plumbing for provider startup checks - #1818

Merged
jeanduplessis merged 2 commits into
crossplane-contrib:mainfrom
jastang:bootcheck
Jul 17, 2025
Merged

add basic plumbing for provider startup checks#1818
jeanduplessis merged 2 commits into
crossplane-contrib:mainfrom
jastang:bootcheck

Conversation

@jastang

@jastang jastang commented Jul 15, 2025

Copy link
Copy Markdown
Member

Description of your changes

This PR proposes a simple approach to enable custom startup checks on the provider by updating the main.go.tmpl. As a concrete example, users may run their workloads in highly regulated environments where the provider should not start if the environment is not properly configured.

This implements the default path, which is a no-op. It uses a combination of an init() hook and go build tags to:

  • minimize code branching (build-time isolation)
  • ensure critical checks run before anything else (fail fast)
  • not require access to additional flags, env, or setup

A (simplified) example of an alternative implementation is building images with a compliance check (e.g. running in a FIPS-enabled host). What that would look like is:

  • add internal/bootcheck/fips.go
    • add the build tags and adjust the default as needed.
         //go:build fips
         // +build fips
    
  • build the images as before with GO_TAGS=fips to produce images targeting that specific compliance check.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make generate and committed the results (ideally in a separate commit).
  • Not made any manual changes to generated files, and verified this with make check-diff.

How has this code been tested

Locally building and installing the xpkg.

Signed-off-by: Jason Tang <jason@upbound.io>
@jastang
jastang marked this pull request as draft July 15, 2025 20:54
@jastang
jastang marked this pull request as ready for review July 16, 2025 15:04

@sergenyalcin sergenyalcin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @jastang LGTM!

Comment thread internal/bootcheck/default.go
Signed-off-by: Jason Tang <jason@upbound.io>
@jeanduplessis
jeanduplessis merged commit 41778ff into crossplane-contrib:main Jul 17, 2025
7 of 8 checks passed
@jastang
jastang deleted the bootcheck branch July 17, 2025 19:52
ctenberge-oneid pushed a commit to ctenberge-oneid/provider-upjet-aws that referenced this pull request Jul 18, 2025
* add basic plumbing for provider startup checks

Signed-off-by: Jason Tang <jason@upbound.io>

* Add SPDX license header

Signed-off-by: Jason Tang <jason@upbound.io>

---------

Signed-off-by: Jason Tang <jason@upbound.io>
sergenyalcin pushed a commit to sergenyalcin/official-provider-aws that referenced this pull request Dec 4, 2025
* add basic plumbing for provider startup checks

Signed-off-by: Jason Tang <jason@upbound.io>

* Add SPDX license header

Signed-off-by: Jason Tang <jason@upbound.io>

---------

Signed-off-by: Jason Tang <jason@upbound.io>
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.

3 participants