-
Notifications
You must be signed in to change notification settings - Fork 0
Use ID fields for internal referencing in local source #211
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
base: main
Are you sure you want to change the base?
Conversation
81c7da1
to
156ee6e
Compare
To make the tests functional again this PR has gone way beyond simple just replace the IDS. This PR now also covers #203 and outputs the IDs as well as accept them as input. |
Merged in main, resolved conflicts. |
Used a merge as a rebase caused 30x more conflitcs, before we merge this into main we should solidify the commits |
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.
Pull Request Overview
This pull request migrates local source provisioning and configuration to reference trust zones, clusters, attestation policies, and AP bindings via their unique ID fields instead of names. Key changes include modifying internal functions and data fixtures, updating CUE and YAML schemas, and adjusting CLI commands and tests to use the new ID fields.
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
internal/pkg/* | Updated internal functions to use ID-based lookups |
internal/pkg/config/* | Modified fixtures, tests, and schema to support trust zone and cluster IDs |
cmd/cofidectl/cmd/* | Updated CLI commands and flags to handle IDs for workload, trust zone, cluster, federation, attestation policy, and AP bindings |
go.mod | Upgraded dependency versions |
Comments suppressed due to low confidence (1)
cmd/cofidectl/cmd/trustzone/helm/helm.go:92
- The FIXME comment indicates an inconsistency where overrideValues receives a trust zone ID but may require the trust zone name. Consider aligning the API—either update the underlying provisioning to accept an ID or pass the expected name—and remove the FIXME comment once resolved.
// FIXME: pass the trust zone name instead of the ID.
85c8ce0
to
b6cdd98
Compare
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.
Pull Request Overview
This PR migrates internal referencing from names to unique ID fields across the codebase, updating data source filters, fixtures, configuration schemas, and CLI commands/tests.
- Switch data source calls (e.g., ListClusters, ListFederations) to use ID-based filters
- Add
Id
properties to fixtures, schema, and test data; introduceGetByID
helpers - Extend CLI commands and flags to accept
*-id
parameters alongside or in place of names
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
internal/pkg/trustzone/trustzone.go | Switch ListClusters to use TrustZoneId filter |
internal/pkg/test/fixtures/fixtures.go | Add Id fields to trust zone, federation, cluster, and policy fixtures |
internal/pkg/config/testdata/config/missing_trust_zone_field.yaml | Update federations to use trust_zone_id and remote_trust_zone_id |
internal/pkg/config/testdata/config/full.yaml | Add ID attributes for trust zones, clusters, and policies |
internal/pkg/config/schema.cue | Modify schema to require trust_zone_id , policy_id , etc. |
internal/pkg/config/config_test.go | Update tests to use ID-based trustZone values |
internal/pkg/config/config.go | Introduce Get*ByID methods and switch lookups to ID fields |
internal/pkg/attestationpolicy/attestationpolicy.go | Change cluster listing and trust zone retrieval to use IDs |
go.mod | Bump cofide-api-sdk to v0.20.0 and adjust dependencies |
cmd/cofidectl/cmd/workload/workload.go | Add --trust-zone-id flag; update List/Status/Discover logic |
cmd/cofidectl/cmd/trustzone/trustzone_test.go | Adapt tests for ID-based trust zone and cluster operations |
cmd/cofidectl/cmd/trustzone/trustzone.go | Refactor add/del/status commands to use ID flags |
cmd/cofidectl/cmd/trustzone/helm/helm.go | Support ID-based lookup in override and values commands |
cmd/cofidectl/cmd/statusspinner/statusspinner.go | Update import path to provision_plugin/v1alpha2 |
cmd/cofidectl/cmd/federation/federation.go | Migrate federation commands to ID-based filters and flags |
cmd/cofidectl/cmd/down.go | Support --trust-zone-id flag for teardown |
cmd/cofidectl/cmd/cluster/cluster.go | Update ListClusters and deletion to use trust_zone_id |
cmd/cofidectl/cmd/attestationpolicy/attestationpolicy.go | Add ID-based delete operation for attestation policies |
cmd/cofidectl/cmd/apbinding/apbinding.go | Switch APBinding list/add/del to use ID-based flags |
Comments suppressed due to low confidence (1)
cmd/cofidectl/cmd/trustzone/trustzone.go:279
- DataSource interface provides
GetTrustZone(id string)
rather thanGetTrustZoneByName
; this call will not compile. Useds.GetTrustZone(opts.name)
.
tz, err := ds.GetTrustZoneByName(opts.name)
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.
Pull Request Overview
This PR updates internal data provisioning to reference trust zones, clusters, attestation policies, and federations by their IDs rather than their names. Key changes include modifications to API calls in data source functions, updates to fixture and test definitions, and revisions to CLI commands so that both names and IDs can be used (with a focus on IDs).
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
internal/pkg/trustzone/trustzone.go | Replaces name-based cluster lookup with ID-based filtering |
internal/pkg/test/fixtures/fixtures.go | Updates fixture definitions to include new ID fields for trust zones and clusters |
internal/pkg/config/* | Schema and configuration tests are updated to expect ID fields rather than names |
cmd/cofidectl/* | Updates CLI flags and command logic across workload, trustzone, cluster, and federation commands for ID-based referencing |
Comments suppressed due to low confidence (2)
cmd/cofidectl/cmd/apbinding/apbinding.go:231
- Both the name and ID for the trust zone (and similarly for attestation policy) are bound to the same variable, which can create ambiguity in flag parsing. It is recommended to use separate variables to distinctly capture the trust zone name and trust zone ID (and similarly for attestation policy) to avoid potential misconfiguration.
f.StringVar(&opts.trustZone, "trust-zone", "", "Trust zone name")
f.StringVar(&opts.trustZone, "trust-zone-id", "", "Trust zone ID")
cmd/cofidectl/cmd/down.go:81
- [nitpick] The flag name 'trustzone-id' is inconsistent with the naming convention used in other commands (which use 'trust-zone-id'). Consider aligning the flag name for consistency.
f.StringSliceVar(&opts.trustzoneIDs, "trustzone-id", []string{}, "Trust zone IDs to uninstall, or all if none is specified")
12d0b92
to
12ab009
Compare
Squased the pile of 43 commits into one, should be ready for review (sorry for the size, this had a huge domino effect) |
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.
It's looking better now I think. Haven't done a full review so there may be more things.
One thing to try is git grep -C3 nolint:staticcheck
. This catches some cases where we're still using the name-based references (and a few other unrelated things)
5e31938
to
6bf9704
Compare
This makes cofidctl use UUIDs everywhere instead of names. It also includes the needed API changes and CLI changes to make this happen Signed-off-by: Maartje Eyskens <maartje@eyskens.me>
6bf9704
to
8627d9d
Compare
Builds on #208 and changes provisioning in local data source to use the IDs instead of the names.
Fixes #204 and #205