mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 23:29:28 -05:00
Cluster names only have to be unique within a Region of an account, but EKS stored clusters under the bare name, so creating `demo` in eu-central-1 failed with ResourceInUseException while a `demo` existed in eu-west-1. Since #7936 the eu-central-1 caller cannot even see that cluster. Clusters, node groups and Fargate profiles are now keyed by `<region>::<name>`, as OpenSearch domains and Kinesis streams are, and so are the node-capacity locks and the OIDC signing keys. On startup, records persisted under the bare name move to the new keys, taking the Region from each record's ARN. A cluster's signing key moves with it, so tokens it signed before the upgrade still verify. Access entries, add-ons and Pod Identity associations were already keyed by the cluster ARN. A cluster outside the default Region, or one that shares its name with a cluster in another Region, puts its Region first in its Docker container and volume names. This is persisted as dockerNameRegion and left out of API responses, so two Regions' clusters never share a k3s container. A default-Region cluster, and any cluster created before this change, keeps its name, so existing containers, volumes and endpoint-mode=network DNS names stay as they are. The Pod Identity webhook path now includes the Region. The old path still works for clusters whose webhook configuration predates the change. The _floci OIDC routes have no Region of their own and are usually called unsigned, so they try the request's Region and then the account's only cluster with that name. Closes #7966 Follow-up to the Regional cluster names change, from review: - k3s was given a signing key minted under the bare cluster name while EksService created, published and migrated the cluster's key under its Regional key, so pod tokens could be signed with a key JWKS did not publish. EksClusterManager now asks for the key by the Regional key, at start and on reinjection. - The token-webhook kubeconfig, audit policy, registries.yaml and Pod Identity manifest Floci writes per cluster now live under <kind>/<account>/<region>/<name>/, the layout of the signing-key files, so same-named clusters in two Regions no longer share them. - The Region-less Pod Identity webhook route resolves the cluster created before Regional names, which registered it, rather than preferring the request's Region, which could pick a newer same-named default-Region cluster. - OIDC discovery and the key route take an optional region query parameter, and the discovery document's jwks_uri names the cluster's Region, since a verifier follows it without the discovery context. - A signing key stored before account-prefixed keys now moves with its cluster too, checked by its issuer. - CreateCluster reserves the Regional key until the cluster is stored, so a concurrent create of the same name in the same Region is refused instead of overwriting the first. - Test imports replace fully qualified names, for Checkstyle. Cluster names are unique only within a Region of an account, and the token route is usually called unsigned, so with the same name in two Regions it could only mint for the request's Region. Accept the same optional ?region= as the discovery and key routes, and document it. Also correct the accountQualifiedName Javadoc, which still said names are unique only within an account.