test: add ServiceAccount contract test from infra (WIP)#683
Draft
ecv wants to merge 1 commit into
Draft
Conversation
Add a thin iam.miloapis.com ServiceAccount API-contract test, migrated from the datum-cloud/infra service-account-lifecycle test (infra#3006). Milo owns and serves this contract on project control planes, so the contract portion belongs here and runs pre-merge against the local Milo apiserver. Only the API contract is ported: create a ServiceAccount in a project control plane, assert spec.state defaults to Active, then delete it and assert it is gone. The infra original also drove datumctl key issuance, authentication as the service account, and key revocation. Those need the auth service (Zitadel), which is absent in the local env, so that key-issuance/auth/ revoke roundtrip intentionally remains an infra "construct" test, still skipped until datumctl gains the commands, per infra#3006. Key changes from the infra original: - Drop all datumctl steps and live-auth kubeconfig plumbing; reach the org and project control planes served by the local apiserver directly. - Remove spec.skip. - Set up Organization, User, OrganizationMembership, and a Project so the project control plane that serves ServiceAccount exists.
Contributor
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a thin
iam.miloapis.comServiceAccount API-contract test attest/iam/service-account-contract/, migrated from the infraservice-account-lifecycletest.Flow: create
Organization+User+OrganizationMembership→ createProjectin the org control plane (ServiceAccount is a Project-context resource) → waitReady→ on the project control plane: create aServiceAccount, assertspec.statedefaults toActive, then delete it and assert it is gone.Why
Per
datum-cloud/infra#3006, single-service API-contract tests are being evacuated from infra's live-env suite to their owning repos and run against milo's local apiserver pre-merge. Milo owns and serves theiam.miloapis.comServiceAccount contract on project control planes.Scope deliberately reduced. The infra original also drove
datumctlkey issuance, authenticated as the service account with the issued key, and revoked the key. Those require the auth service (Zitadel), which is absent in the local env. That key-issuance / auth / revoke roundtrip intentionally remains an infra "construct" test (still skipped untildatumctlgains the commands), per infra#3006. This PR ports only the contract milo can serve locally.Refs:
datum-cloud/infra#3006(consolidation / evacuation)datum-cloud/infra#3005GVK confirmed
apiVersion: iam.miloapis.com/v1alpha1,kind: ServiceAccount— confirmed viaconfig/crd/bases/iam/iam.miloapis.com_serviceaccounts.yaml:scope: Cluster(so the manifest sets no namespace)discovery.miloapis.com/parent-contexts: Project→ served on the project control plane, hence the project-CP setupspec.statedefaults toActiveAdaptation from the infra original
datumctlsteps (SA create/keys/auth/revoke/delete) and live-auth kubeconfig plumbing.spec.skip: true; added Organization/User/OrganizationMembership/Project fixtures; added aspec.description; zero inline comments per repo convention.chainsaw lint: passes.Known-uncertain
Ready/status.emailassertion.status.emailand theReadycondition on a ServiceAccount are populated by the auth-provider integration (Zitadel), which is absent locally — no in-tree milo controller sets them. The test therefore asserts only the create/default/delete contract. If the local env is later wired with an auth provider, aReady/status.emailassertion could be added (behind therequires=authorization-providerselector).test.<...>/requires: authorization-providerlabel so the harness skips it when the authz provider is absent.