-
Notifications
You must be signed in to change notification settings - Fork 12
Add cluster/nodepool name & kind validation and remove useless endpoint compatibility #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cluster/nodepool name & kind validation and remove useless endpoint compatibility #15
Conversation
…nt compatibility gofmt
WalkthroughThis pull request removes the compatibility API endpoint and modifies Kind field handling from auto-defaulting to explicit preservation. Input validation is enhanced for cluster and node pool names (enforcing 3-63 character length, lowercase alphanumeric with hyphens) and Kind fields (requiring "Cluster" or "NodePool" respectively). The OpenAPI specification is updated with Apache 2.0 license information, HTTP bearer authentication scheme, production server URL, and tightened cluster name constraints (minLength 1 to 3). Integration tests are updated to expect 400 Bad Request responses for validation failures, and new contract tests verify synchronization between domain and OpenAPI constants. Test client configuration now targets the local test server environment. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes Areas requiring attention:
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (7)
pkg/handlers/validation.go (1)
10-11: Consider stricter pattern to disallow leading/trailing hyphens.The current pattern
^[a-z0-9-]+$allows names that start or end with hyphens (e.g.,-cluster,cluster-,---), which typically violates Kubernetes DNS-1123 naming conventions. If this API follows Kubernetes naming standards, consider using a pattern like^[a-z0-9]([a-z0-9-]*[a-z0-9])?$to require alphanumeric start/end.-// Cluster/NodePool name pattern: lowercase alphanumeric and hyphens -var namePattern = regexp.MustCompile(`^[a-z0-9-]+$`) +// Cluster/NodePool name pattern: lowercase alphanumeric and hyphens +// Must start and end with alphanumeric character (Kubernetes DNS-1123 label convention) +var namePattern = regexp.MustCompile(`^[a-z0-9]([a-z0-9-]*[a-z0-9])?$`)openapi/openapi.yaml (1)
35-36: 400 responses are missing error schema references.The 400 Bad Request responses added throughout the spec don't include a response body schema. For consistency with the
defaulterror responses and to help clients handle validation errors, consider adding theErrorschema reference.'400': description: The server could not understand the request due to invalid syntax. + content: + application/json: + schema: + $ref: '#/components/schemas/Error'pkg/handlers/cluster_nodepools.go (1)
124-161: NodePool Create validation is sensible; consider centralizing name length constraintsUsing
validateName(&req, "Name", "name", 1, 255)andvalidateKind(&req, "Kind", "kind", "NodePool")brings NodePool creation in line with the new validation approach and happens before any conversion or DB operations, which is good.If cluster/nodepool name limits are meant to stay in sync with OpenAPI/DB constraints long‑term, consider extracting these min/max values into shared constants (e.g.,
ClusterNameMinLen,ClusterNameMaxLen,NodePoolNameMaxLen) to avoid silent drift between handlers, schema, and tests.test/integration/node_pools_test.go (2)
210-247: Empty kind integration test correctly validates 400 behavior
TestNodePoolPost_EmptyKindcleanly exercises the handler by:
- Creating a real cluster,
- Sending raw JSON with
\"kind\": \"\"under an authenticated context, and- Asserting a 400 plus an error
reasoncontaining “kind is required”.This is a good end‑to‑end coverage of the new Kind validation path.
You could factor the repeated “POST raw JSON and parse error.reason” logic (here and in WrongKind) into a small helper to keep these tests DRY, but it’s not required.
249-286: Wrong kind integration test robustly checks specific validation messaging
TestNodePoolPost_WrongKindmirrors the empty‑kind test for the “wrong kind value” case, confirming 400 and areasoncontaining “kind must be 'NodePool'”. This gives good regression protection for both status code and user‑facing error text.test/integration/clusters_test.go (2)
621-654: Empty kind cluster test accurately validates 400 and message content
TestClusterPost_EmptyKind:
- Authenticates via JWT,
- Sends raw JSON with
\"kind\": \"\"to bypass client struct constraints, and- Verifies 400 plus an error
reasoncontaining “kind is required”.This is a solid end‑to‑end check of the new Kind validation for clusters.
As with the nodepool tests, you might consider a small helper for “POST invalid payload and assert error.reason substring” to reduce repetition, but current code is clear enough.
656-689: Wrong kind cluster test mirrors nodepool coverage and looks good
TestClusterPost_WrongKindcomplements the empty‑kind case by asserting a 400 and areasoncontaining “kind must be 'Cluster'” when an incorrect kind is supplied. Together, these tests meaningfully lock in the new Kind API contract.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (25)
cmd/hyperfleet-api/server/routes.go(0 hunks)openapi/openapi.yaml(14 hunks)pkg/api/cluster_types.go(0 hunks)pkg/api/cluster_types_test.go(2 hunks)pkg/api/node_pool_types.go(0 hunks)pkg/api/node_pool_types_test.go(2 hunks)pkg/api/openapi_embed.go(0 hunks)pkg/api/presenters/adapter_status_test.go(2 hunks)pkg/auth/auth_middleware.go(0 hunks)pkg/dao/mocks/generic.go(1 hunks)pkg/handlers/cluster.go(1 hunks)pkg/handlers/cluster_nodepools.go(2 hunks)pkg/handlers/compatibility.go(0 hunks)pkg/handlers/node_pool.go(1 hunks)pkg/handlers/validation.go(2 hunks)pkg/handlers/validation_test.go(1 hunks)pkg/logger/logger.go(1 hunks)plugins/clusters/plugin.go(0 hunks)plugins/nodePools/plugin.go(0 hunks)test/helper.go(1 hunks)test/integration/api_contract_test.go(1 hunks)test/integration/clusters_test.go(7 hunks)test/integration/compatibility_test.go(0 hunks)test/integration/integration_test.go(1 hunks)test/integration/node_pools_test.go(4 hunks)
💤 Files with no reviewable changes (9)
- cmd/hyperfleet-api/server/routes.go
- plugins/clusters/plugin.go
- pkg/handlers/compatibility.go
- pkg/auth/auth_middleware.go
- pkg/api/openapi_embed.go
- plugins/nodePools/plugin.go
- pkg/api/node_pool_types.go
- pkg/api/cluster_types.go
- test/integration/compatibility_test.go
🧰 Additional context used
📓 Path-based instructions (9)
**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
Use Go 1.24.9 with FIPS-compliant crypto enabled (CGO_ENABLED=1, GOEXPERIMENT=boringcrypto)
Files:
pkg/handlers/cluster.gopkg/handlers/node_pool.gotest/integration/api_contract_test.gotest/integration/node_pools_test.gopkg/api/presenters/adapter_status_test.gotest/helper.gopkg/handlers/validation.gopkg/api/cluster_types_test.gopkg/dao/mocks/generic.gotest/integration/clusters_test.gopkg/handlers/validation_test.gopkg/api/node_pool_types_test.gotest/integration/integration_test.gopkg/handlers/cluster_nodepools.gopkg/logger/logger.go
pkg/{handlers,services}/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
Always retrieve database session from context via db.NewContext() instead of creating new connections
Files:
pkg/handlers/cluster.gopkg/handlers/node_pool.gopkg/handlers/validation.gopkg/handlers/validation_test.gopkg/handlers/cluster_nodepools.go
pkg/handlers/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
Implement all HTTP handlers following the pattern: parse request → call service/DAO → handle errors → send response
Files:
pkg/handlers/cluster.gopkg/handlers/node_pool.gopkg/handlers/validation.gopkg/handlers/validation_test.gopkg/handlers/cluster_nodepools.go
pkg/{handlers,services,dao}/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
pkg/{handlers,services,dao}/**/*.go: Use structured logging via pkg/logger/logger.go with context propagation including opid, accountID, and tx_id
Return errors using the structured ServiceError type from pkg/errors/ with HttpCode, Code, and Reason fields
Files:
pkg/handlers/cluster.gopkg/handlers/node_pool.gopkg/handlers/validation.gopkg/dao/mocks/generic.gopkg/handlers/validation_test.gopkg/handlers/cluster_nodepools.go
pkg/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
Implement JWT authentication middleware that validates tokens and extracts account ID and username from claims
Files:
pkg/handlers/cluster.gopkg/handlers/node_pool.gopkg/api/presenters/adapter_status_test.gopkg/handlers/validation.gopkg/api/cluster_types_test.gopkg/dao/mocks/generic.gopkg/handlers/validation_test.gopkg/api/node_pool_types_test.gopkg/handlers/cluster_nodepools.gopkg/logger/logger.go
test/integration/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
test/integration/**/*.go: Create integration tests using Testcontainers for isolated PostgreSQL instances per test
All API endpoints must be integrated tested in test/integration/ covering CRUD operations, pagination, search, and error cases
Files:
test/integration/api_contract_test.gotest/integration/node_pools_test.gotest/integration/clusters_test.gotest/integration/integration_test.go
pkg/api/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
Use //go:embed directive to embed the OpenAPI specification at compile time from pkg/api/openapi/api/openapi.yaml
Files:
pkg/api/presenters/adapter_status_test.gopkg/api/cluster_types_test.gopkg/api/node_pool_types_test.go
pkg/dao/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
pkg/dao/**/*.go: Use context.Context as the first parameter in all DAO methods for transaction propagation
Increment generation field on each spec update to enable optimistic concurrency control
All DAO methods must support context-based session access for transaction participation
Files:
pkg/dao/mocks/generic.go
openapi/openapi.yaml
📄 CodeRabbit inference engine (CLAUDE.md)
TypeSpec definitions are maintained separately in hyperfleet-api-spec repository; only edit openapi/openapi.yaml in this repository for spec changes
Files:
openapi/openapi.yaml
🧠 Learnings (12)
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to pkg/db/migrations/**/*.go : Store cluster and nodepool specifications as JSONB in PostgreSQL schema, never as separate columns
Applied to files:
pkg/handlers/node_pool.gotest/integration/node_pools_test.gopkg/handlers/cluster_nodepools.go
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to test/integration/**/*.go : All API endpoints must be integrated tested in test/integration/ covering CRUD operations, pagination, search, and error cases
Applied to files:
test/integration/api_contract_test.gotest/integration/node_pools_test.gotest/integration/clusters_test.gotest/integration/integration_test.go
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to pkg/api/**/*.go : Use //go:embed directive to embed the OpenAPI specification at compile time from pkg/api/openapi/api/openapi.yaml
Applied to files:
test/integration/api_contract_test.gotest/integration/node_pools_test.gotest/integration/integration_test.go
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to test/integration/**/*.go : Create integration tests using Testcontainers for isolated PostgreSQL instances per test
Applied to files:
test/integration/api_contract_test.gotest/integration/node_pools_test.go
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to test/factories/**/*.go : Use test data factories in test/factories/ to provide consistent test data instead of hardcoding values
Applied to files:
test/integration/api_contract_test.go
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to pkg/**/*.go : Implement JWT authentication middleware that validates tokens and extracts account ID and username from claims
Applied to files:
test/integration/node_pools_test.go
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to pkg/db/migrations/**/*.go : Use polymorphic adapter_statuses table with owner_type and owner_id columns instead of separate status tables per resource type
Applied to files:
pkg/api/presenters/adapter_status_test.go
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to pkg/services/**/*.go : Implement adapter status aggregation: phase is Ready if all adapters report Ready=True, Failed if any report Ready=False, NotReady otherwise
Applied to files:
pkg/api/presenters/adapter_status_test.go
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to pkg/dao/**/*.go : Increment generation field on each spec update to enable optimistic concurrency control
Applied to files:
pkg/dao/mocks/generic.go
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to pkg/dao/**/*.go : Use context.Context as the first parameter in all DAO methods for transaction propagation
Applied to files:
pkg/dao/mocks/generic.go
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: Applies to openapi/openapi.yaml : TypeSpec definitions are maintained separately in hyperfleet-api-spec repository; only edit openapi/openapi.yaml in this repository for spec changes
Applied to files:
openapi/openapi.yaml
📚 Learning: 2025-12-03T15:47:39.989Z
Learnt from: CR
Repo: openshift-hyperfleet/hyperfleet-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:47:39.989Z
Learning: HyperFleet API contains no business logic and creates no events; it is purely a data persistence and retrieval service
Applied to files:
openapi/openapi.yaml
🧬 Code graph analysis (6)
test/integration/api_contract_test.go (1)
pkg/api/status_types.go (6)
PhaseNotReady(10-10)PhaseReady(11-11)PhaseFailed(12-12)ConditionTrue(20-20)ConditionFalse(21-21)ConditionUnknown(22-22)
test/integration/node_pools_test.go (1)
test/registration.go (1)
RegisterIntegration(13-24)
pkg/handlers/validation.go (1)
pkg/errors/errors.go (2)
ServiceError(100-109)Validation(214-216)
pkg/api/cluster_types_test.go (1)
pkg/api/cluster_types.go (1)
Cluster(11-34)
test/integration/clusters_test.go (1)
test/registration.go (1)
RegisterIntegration(13-24)
pkg/api/node_pool_types_test.go (1)
pkg/api/node_pool_types.go (1)
NodePool(12-40)
🔇 Additional comments (27)
pkg/api/presenters/adapter_status_test.go (2)
197-197: ****
364-364: ****pkg/dao/mocks/generic.go (1)
26-76: Update mock methods to include context.Context as the first parameter per DAO guidelines.The coding guidelines require "context.Context as the first parameter in all DAO methods for transaction propagation." This mock currently implements
Fetch,Count,Validate,Preload,OrderBy,Joins,Group,Where,GetTableName, andGetTableRelationwithout context parameters. OnlyGetInstanceDaoincludes context. Update these methods to acceptcontext.Contextas the first parameter to comply with the documented guidelines and enable transaction propagation through the mock.test/integration/integration_test.go (1)
30-32: LGTM!Comment alignment adjustments only; the path computation logic remains correct.
test/helper.go (1)
244-255: LGTM!The API client configuration now explicitly targets the local test server, consistent with the pattern used in
RestURL(). This ensures integration tests properly route requests to the test server.pkg/handlers/validation.go (2)
45-80: LGTM!The
validateNamefunction properly handles pointer dereferencing and validates in the correct order: nil → empty → min length → max length → pattern. Error messages are clear and informative.
82-107: LGTM!The
validateKindfunction correctly validates that the kind field matches the expected value, with proper pointer handling and clear error messages.openapi/openapi.yaml (4)
7-9: LGTM!Proper license information added to the API specification.
710-714: LGTM!The
minLength: 3constraint aligns with thevalidateNamefunction in Go code that enforces a minimum of 3 characters for cluster names.
1204-1206: Verify that removing the development server URL is intentional.The server configuration was changed from a localhost development URL to a production URL. This may affect local development and testing workflows that rely on the OpenAPI spec for client generation or documentation.
364-368: BearerAuth security scheme is defined but not applied to operations.The
BearerAuthsecurity scheme is added undercomponents.securitySchemes, but it's not applied to any operations viasecurityrequirements (either globally or per-operation). If authentication is intended to be enforced, you'll need to add a globalsecuritysection or per-operation security requirements.pkg/handlers/node_pool.go (1)
118-130: LGTM!Formatting alignment adjustments only; the struct definition and response logic remain unchanged.
pkg/handlers/cluster.go (1)
30-55: Create handler validation for Name/Kind looks correct and consistentAdding
validateName(&req, "Name", "name", 3, 63)andvalidateKind(&req, "Kind", "kind", "Cluster")in theCreatehandler cleanly enforces the new constraints before conversion and service calls, and matches the documented 3–63 length and specific kind requirement. No issues from the handler side.pkg/handlers/cluster_nodepools.go (1)
64-76: List response struct change is cosmetic onlyThe
nodePoolListstruct alignment changes are whitespace-only; JSON tags and field types are unchanged, so behavior remains identical.pkg/api/cluster_types_test.go (2)
70-83: Kind preservation tests correctly reflect new BeforeCreate semantics
TestCluster_BeforeCreate_KindPreservationnow asserts that a pre‑setKind: "Cluster"survivesBeforeCreateunchanged, which matches the intent of removing Kind defaulting logic. The test is focused and clear.
191-202: Complete defaults test now properly includes explicit KindUpdating
TestCluster_BeforeCreate_Completeto setKind: "Cluster"and assert that it’s preserved (instead of auto‑set) keeps this “all defaults” test consistent with the new Kind behavior while still checking the other defaulted fields.test/integration/node_pools_test.go (2)
3-4: encoding/json import is appropriate and usedThe added
encoding/jsonimport is required for the new error‑response parsing and has no unused‑import risk.
60-73: Adding Kind to NodePool create requests aligns tests with API requirementsSetting
Kind: openapi.PtrString("NodePool")in bothTestNodePoolPostandTestGetNodePoolByClusterIdAndNodePoolIdensures the happy‑path tests respect the new Kind requirement and still verify the returned Kind field.pkg/handlers/validation_test.go (1)
1-147: Validation tests provide solid coverage of name and kind edge casesThese tests thoroughly exercise
validateNameandvalidateKind:
- Valid and invalid patterns,
- Min/max length boundaries,
- Distinguishing “required” from “too short/too long” and “wrong kind”.
They should give good confidence that handler‑level validations behave as intended; no issues spotted.
test/integration/api_contract_test.go (1)
1-40: API contract tests are a good guardrail against constant driftBoth
TestAPIContract_ResourcePhaseConstantsandTestAPIContract_ConditionStatusConstantssuccinctly assert that domain constants match the generated OpenAPI enums. This is a low‑maintenance way to detect spec/code divergence early.pkg/api/node_pool_types_test.go (2)
71-85: NodePool Kind preservation tests correctly reflect new behavior
TestNodePool_BeforeCreate_KindPreservationnow verifies that a pre‑setKind: "NodePool"is left untouched byBeforeCreate, which aligns with the removal of defaulting logic and the expectation that handlers validate/set Kind before persistence.
231-243: Complete NodePool defaults test now properly treats Kind as input, not defaultIn
TestNodePool_BeforeCreate_Complete, explicitly settingKind: "NodePool"and asserting it’s preserved (while other defaults are applied) keeps this aggregate test consistent with the new Kind semantics without weakening existing coverage of OwnerKind, StatusPhase, Href, etc.test/integration/clusters_test.go (5)
225-247: Cluster name boundary tests now correctly assert 400 responsesUpdating the “too long” and “empty” name cases in
TestClusterBoundaryValuesto expecthttp.StatusBadRequest(and an error for empty) matches the new handler‑level validation and OpenAPI constraints on cluster name length and non‑emptiness. This is the right behavior shift away from 5xxs.
269-279: Unicode name rejection test aligns with stricter name patternThe new Unicode test case in
TestClusterBoundaryValuesasserting a 400 for names outside[a-z0-9-]+gives good coverage for the pattern enforcement and ensures non‑ASCII names don’t slip through inadvertently.
483-485: Lowercasing ID prefix stabilizes name-based sorting testsUsing
strings.ToLower(h.NewID())inTestClusterList_DefaultSortingensures the randomly generated ID fragment doesn’t introduce case‑sensitivity quirks into lexicographic ordering, making the name‑based assertions more robust.
531-538: OrderBy name test prefix change improves determinismThe
testPrefix := fmt.Sprintf("name-sort-%s", strings.ToLower(h.NewID()))change inTestClusterList_OrderByNamefollows the same idea: consistently lowercased prefixes reduce the chance of flaky ordering tests due to mixed case.
581-586: Descending name sort test benefits from lowercased prefix as wellSimilarly, in
TestClusterList_OrderByNameDesc, using a lowercased random suffix fortestPrefixkeeps the desc‑ordering assertions deterministic across runs.
| // TODO username is unused, should we be logging it? Could be pii | ||
| username string | ||
| extra extra | ||
| username string | ||
| extra extra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Remove the unused username field or resolve its TODO.
The username field is never populated in NewOCMLogger(), copied but unused in the logging logic, and has a TODO questioning whether it should be logged due to PII concerns. Either remove this dead code or implement proper username handling if it's genuinely needed.
Consider removing the unused field:
type logger struct {
context context.Context
level int32
accountID string
- // TODO username is unused, should we be logging it? Could be pii
- username string
extra extra
}And remove it from the V() method:
func (l *logger) V(level int32) OCMLogger {
return &logger{
context: l.context,
accountID: l.accountID,
- username: l.username,
level: level,
}
}Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In pkg/logger/logger.go around lines 30-32, the struct field `username` is
unused and flagged by a TODO; remove the dead `username string` field from the
logger struct, delete any references or assignments to it (including in
NewOCMLogger and any copy/clone logic), and update the V() method
signature/implementation to omit handling of username so the code compiles
cleanly; if username must be retained later, replace the field with an explicit,
documented decision (e.g., a nullable/scrubbed identity or a separate opt-in
metadata map) and adjust NewOCMLogger and V() to properly populate/handle it
with PII safeguards, but for now remove the unused field and associated code and
run `go build`/tests to ensure nothing else references it.
| ) | ||
|
|
||
| // Cluster/NodePool name pattern: lowercase alphanumeric and hyphens | ||
| var namePattern = regexp.MustCompile(`^[a-z0-9-]+$`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeRabbit suggest to use a stricter regex to have names compatible with Kubernetes.
Even though we will use Ids as kubernetes object names, I think it makes sense to have that stricter rule.
And change it also in the spec.
wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with that. Let us make it stricter to comply with the RFC 1123 guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix in #16
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rh-amarin, yasun1 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 |
9ffd6d0
into
openshift-hyperfleet:main
Close HYPERFLEET-22
Summary by CodeRabbit
Breaking Changes
/api/hyperfleet/v1/compatibilityendpointImprovements
✏️ Tip: You can customize this high-level summary in your review settings.
I still leave
securitySchemeshere; otherwise, we need to make a significant change to remove auth, and we actually want authorization in the future, and currently, settingEnableJWT=falseis met the MVP requirement.