OPRUN-4541,OPRUN-4544: add lifecycle-server for serving FBC catalog lifecycle metadata#1284
OPRUN-4541,OPRUN-4544: add lifecycle-server for serving FBC catalog lifecycle metadata#1284perdasilva wants to merge 1 commit intoopenshift:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (9)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (4)
WalkthroughAdds a new lifecycle-server binary and CLI that loads Filesystem-based Catalog (FBC) JSON blobs, indexes them by schema-version and package, and serves them over HTTPS with health endpoints, TLS reloading, authn/authz wiring, tests, build rules, and container image inclusion. Changeslifecycle-server: load → serve → ship
Sequence Diagram(s)sequenceDiagram
participant CLI as "lifecycle-server CLI"
participant FS as "FBC Filesystem"
participant K8s as "Kubernetes (REST Client / Auth)"
participant Index as "LifecycleIndex"
participant Handler as "HTTP Handlers"
participant APISrv as "API Server (TLS)"
participant HealthSrv as "Health Server"
CLI->>FS: LoadLifecycleData(fbcPath)
FS-->>Index: LifecycleIndex (version→package→blob)
CLI->>K8s: Build REST client and authn/authz filter
CLI->>Handler: NewHandler(Index, log)
CLI->>Handler: NewHealthHandler(Index)
CLI->>APISrv: Start TLS API server (uses TLSConfig with GetCertificate)
CLI->>HealthSrv: Start health server (no TLS)
Note right of APISrv: Serve GET /api/{version}/lifecycles/{package}
Note right of HealthSrv: Serve /healthz and /readyz
CLI->>CLI: Wait for cancellation signal
CLI->>APISrv: Shutdown with timeout
CLI->>HealthSrv: Shutdown with timeout
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (10 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 8/10 reviews remaining, refill in 9 minutes and 14 seconds. Comment |
|
@perdasilva: This pull request references OPRUN-4541 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: perdasilva The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
5e0ca42 to
80575fd
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cmd/lifecycle-server/start.go`:
- Around line 127-131: The code currently swallows a hard error from
server.LoadLifecycleData by logging and replacing data with an empty
server.LifecycleIndex, which masks startup failures; instead, when
server.LoadLifecycleData returns a non-nil err, fail fast: log the error with
context and terminate startup (e.g., return the error or call os.Exit/ctrl-c
handler) so the process does not start in a degraded state. Update the block
around server.LoadLifecycleData(fbcPath, log) to propagate/terminate on error
rather than assigning an empty data map, keeping successful return handling
unchanged.
- Around line 151-164: Add explicit connection timeouts to both http.Server
instances to harden against slow clients: in the primary server literal (the
&http.Server{ Addr: listenAddr, Handler: apiHandler, TLSConfig: tlsConfig, ...
}) and in the healthServer inside cancelableServer, set at minimum
ReadHeaderTimeout (e.g. a few seconds) and also add sensible ReadTimeout,
WriteTimeout and IdleTimeout values; update those &http.Server initializers
rather than leaving defaults so both the main server and healthServer enforce
timeouts.
In `@pkg/lifecycle-server/fbc.go`:
- Around line 73-79: Detect and fail on duplicate lifecycle blobs instead of
overwriting: inside the critical section guarded by mu (around result,
schemaVersion, meta.Package), check whether result[schemaVersion][meta.Package]
already exists before assigning meta.Blob; if it does, return or propagate a
clear error (e.g., fmt.Errorf("duplicate lifecycle blob for schemaVersion %s
package %s", schemaVersion, meta.Package)) so the caller can fail fast rather
than silently overwrite, otherwise create the map as now and assign meta.Blob.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 777c8237-1587-42b8-a3fa-f723f3d61d06
⛔ Files ignored due to path filters (3)
go.sumis excluded by!**/*.sumvendor/github.com/openshift/library-go/pkg/crypto/crypto.gois excluded by!**/vendor/**,!vendor/**vendor/modules.txtis excluded by!**/vendor/**,!vendor/**
📒 Files selected for processing (29)
Makefilecmd/lifecycle-server/main.gocmd/lifecycle-server/start.gogo.modmanifests/0000_50_olm_00-catalogsources.crd.yamlmanifests/0000_50_olm_00-clusterserviceversions.crd.yamlmanifests/0000_50_olm_00-installplans.crd.yamlmanifests/0000_50_olm_00-olmconfigs.crd.yamlmanifests/0000_50_olm_00-operatorconditions.crd.yamlmanifests/0000_50_olm_00-operatorgroups.crd.yamlmanifests/0000_50_olm_00-operators.crd.yamlmanifests/0000_50_olm_00-subscriptions.crd.yamlmanifests/0000_50_olm_09-lifecycle-server.rbac.yamlmicroshift-manifests/0000_50_olm_00-catalogsources.crd.yamlmicroshift-manifests/0000_50_olm_00-clusterserviceversions.crd.yamlmicroshift-manifests/0000_50_olm_00-installplans.crd.yamlmicroshift-manifests/0000_50_olm_00-olmconfigs.crd.yamlmicroshift-manifests/0000_50_olm_00-operatorconditions.crd.yamlmicroshift-manifests/0000_50_olm_00-operatorgroups.crd.yamlmicroshift-manifests/0000_50_olm_00-operators.crd.yamlmicroshift-manifests/0000_50_olm_00-subscriptions.crd.yamlmicroshift-manifests/0000_50_olm_09-lifecycle-server.rbac.yamlmicroshift-manifests/kustomization.yamloperator-lifecycle-manager.Dockerfilepkg/lifecycle-server/fbc.gopkg/lifecycle-server/fbc_test.gopkg/lifecycle-server/server.gopkg/lifecycle-server/server_test.goscripts/generate_crds_manifests.sh
92a405c to
4c24bd3
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pkg/lifecycle-server/fbc_test.go`:
- Around line 129-134: The test cases titled "non-existent path returns empty
index" (around the shown diff) and the corrupted-JSON case (lines ~253-277) must
be updated to reflect the fail-fast FBC contract: instead of asserting an empty
LifecycleIndex, call the loader entrypoint used in tests (the test harness that
invokes the FBC loader, e.g., LoadFBC/LoadLifecycleIndex or the test helper that
calls NewLifecycleLoader) and assert it returns an error (or panics/fails) for
missing catalog paths and for corrupted JSON; update the test names/expectations
accordingly (replace expectedIndex: LifecycleIndex{} with an assertion that the
loader returned a non-nil error) so the tests fail when FBC load errors occur at
startup.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: daff8487-c31b-441f-8d4a-e897a380e513
⛔ Files ignored due to path filters (3)
go.sumis excluded by!**/*.sumvendor/github.com/openshift/library-go/pkg/crypto/crypto.gois excluded by!**/vendor/**,!vendor/**vendor/modules.txtis excluded by!**/vendor/**,!vendor/**
📒 Files selected for processing (13)
Makefilecmd/lifecycle-server/main.gocmd/lifecycle-server/start.gogo.modmanifests/0000_50_olm_09-lifecycle-server.rbac.yamlmicroshift-manifests/0000_50_olm_09-lifecycle-server.rbac.yamlmicroshift-manifests/kustomization.yamloperator-lifecycle-manager.Dockerfilepkg/lifecycle-server/fbc.gopkg/lifecycle-server/fbc_test.gopkg/lifecycle-server/server.gopkg/lifecycle-server/server_test.goscripts/generate_crds_manifests.sh
✅ Files skipped from review due to trivial changes (3)
- operator-lifecycle-manager.Dockerfile
- microshift-manifests/kustomization.yaml
- microshift-manifests/0000_50_olm_09-lifecycle-server.rbac.yaml
🚧 Files skipped from review as they are similar to previous changes (6)
- manifests/0000_50_olm_09-lifecycle-server.rbac.yaml
- Makefile
- pkg/lifecycle-server/server.go
- go.mod
- pkg/lifecycle-server/fbc.go
- cmd/lifecycle-server/start.go
|
|
||
| // NewHealthHandler creates an HTTP handler for health and readiness probes. | ||
| // The /healthz endpoint always returns 200. The /readyz endpoint returns 200 | ||
| // if lifecycle data is loaded, or 503 if the index is empty. |
There was a problem hiding this comment.
Given that it might be a frequent thing that a catalog does not carry lifecycle metadata, do we want to 503 on /readyz when there's no data?
There was a problem hiding this comment.
Like the idea to get a not 200 HTTP code when no data!
Regarding which code to use, aren't 50x HTTP codes to mean Server errors? 🤔
In this case wouldn't be more appropriate something like 403 (Not Found)?
I have no strong opinions btw.
4c24bd3 to
a44464c
Compare
|
/jira refresh |
|
@perdasilva: This pull request references OPRUN-4541 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@perdasilva: This pull request references OPRUN-4541 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/generate_crds_manifests.sh`:
- Around line 556-571: The manifest creates a ClusterRole named
operator-lifecycle-manager-lifecycle-server but never binds it; add a
ClusterRoleBinding that references this ClusterRole (roleRef.name:
operator-lifecycle-manager-lifecycle-server) and includes a subject of kind
ServiceAccount with the lifecycle-server service account name and its namespace
(the same service account used by the lifecycle-server deployment). Name the
binding clearly (e.g., operator-lifecycle-manager-lifecycle-server-binding) so
the lifecycle-server can perform TokenReview and SubjectAccessReview operations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 5973e75c-fb97-4047-9632-8710b5a25ca8
⛔ Files ignored due to path filters (3)
go.sumis excluded by!**/*.sumvendor/github.com/openshift/library-go/pkg/crypto/crypto.gois excluded by!**/vendor/**,!vendor/**vendor/modules.txtis excluded by!**/vendor/**,!vendor/**
📒 Files selected for processing (13)
Makefilecmd/lifecycle-server/main.gocmd/lifecycle-server/start.gogo.modmanifests/0000_50_olm_09-lifecycle-server.rbac.yamlmicroshift-manifests/0000_50_olm_09-lifecycle-server.rbac.yamlmicroshift-manifests/kustomization.yamloperator-lifecycle-manager.Dockerfilepkg/lifecycle-server/fbc.gopkg/lifecycle-server/fbc_test.gopkg/lifecycle-server/server.gopkg/lifecycle-server/server_test.goscripts/generate_crds_manifests.sh
✅ Files skipped from review due to trivial changes (8)
- operator-lifecycle-manager.Dockerfile
- cmd/lifecycle-server/main.go
- microshift-manifests/kustomization.yaml
- manifests/0000_50_olm_09-lifecycle-server.rbac.yaml
- Makefile
- pkg/lifecycle-server/server_test.go
- pkg/lifecycle-server/fbc.go
- pkg/lifecycle-server/fbc_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
- microshift-manifests/0000_50_olm_09-lifecycle-server.rbac.yaml
- go.mod
a44464c to
0a610f4
Compare
|
@perdasilva: This pull request references OPRUN-4541 which is a valid jira issue. This pull request references OPRUN-4444 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@perdasilva: This pull request references OPRUN-4541 which is a valid jira issue. This pull request references OPRUN-4444 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@perdasilva: This pull request references OPRUN-4541 which is a valid jira issue. This pull request references OPRUN-4544 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
0a610f4 to
d12eea3
Compare
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
fgiudici
left a comment
There was a problem hiding this comment.
just found a couple of nits
Overall looks great! 🚀
|
/lgtm |
d12eea3 to
80c1b9d
Compare
80c1b9d to
788aca4
Compare
…ream NO-ISSUE: Synchronize From Upstream Repositories Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
788aca4 to
3da12b3
Compare
|
/lgtm |
|
@perdasilva: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
lifecycle-serverbinary that serves lifecycle metadata from FBC (File-Based Catalog) content via a versioned REST API (GET /api/{version}/lifecycles/{package})/healthzand/readyzendpointslibrary-goto remove cipher suites no longer supported by Go's crypto/tls (DHE-RSA suites, SHA384 CBC suites,ECDHE-RSA-DES-CBC3-SHA), which the lifecycle-server's TLS configuration depends on viacrypto.TLSVersion()andcrypto.CipherSuite()Key Components
cmd/lifecycle-server/— CLI entrypoint with TLS cert hot-reload, graceful shutdown, health/readiness probes, connection timeout hardeningpkg/lifecycle-server/— FBC loading/indexing (fbc.go), HTTP API handler and health handler (server.go)Test plan
TestSchemaVersionRegex)TestLoadLifecycleData,TestLoadLifecycleData_Subdirectory)TestNewHandler*)TestNewHealthHandler)go build ./cmd/lifecycle-server/...succeedsgo test ./pkg/lifecycle-server/...passesgo mod verifyclean🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores
Tests