agentleFS
Google CloudKnown publisherGoogleCloudPlatform/cloud-solutions/projects/gke-migration-agent/app-dev/identity-translation/SKILL.md

identity-translation

Skill139 starsChanged 6 months agoApache-2.0View on GitHub

Translates Amazon Elastic Kubernetes Service (EKS) IAM Roles for Service Accounts (IRSA) and Amazon EKS Pod Identity configurations into Google Kubernetes Engine (GKE) Workload Identity configurations. Maps Kubernetes ServiceAccounts (KSAs) to Google Service Accounts (GSAs). Use when remapping EKS service account role annotations or Pod Identity associations to GKE Workload Identity annotations. Don't use for cluster-level IAM pool setup or StorageClass remapping.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 3 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Verify that every EKS Kubernetes ServiceAccount (KSA) requiring cloud resource access has a corresponding Google Service Account (GSA) …

    line 83
  2. Very specific:

    If validate_identity_map.py reports errors, take the following actions:

    line 101
  3. Very specific:

    Add the missing mapping to identity-map.json:

    line 109
  4. Very specific:

    Verify that ${HANDOFF_DIR} contains workload-handoff.json (or workload-handoff-namespace.json) and identity-map.json.

    line 134
  5. Very specific:

    Verify that assets/schemas/identity-map.schema.json exists in the skill directory.

    line 136
  6. Very specific:

    When translating each ServiceAccount manifest:

    line 141
  7. Very specific:

    IRSA (Manifest annotation): If metadata.annotations exists and contains eks.amazonaws.com/role-arn:

    line 146
  8. Distinctive:

    Remove all EKS-specific annotations:

    line 149
  9. Very specific:

    EKS Pod Identity (Handoff cross-reference): If metadata.annotations does not exist or lacks eks.amazonaws.com/role-arn:

    line 152
  10. Distinctive:

    Add the GKE Workload Identity annotation:

    line 161
  11. Distinctive:

    If a source AWS IAM Role ARN resolves via step 2:

    line 162
  12. Very specific:

    Add the annotation: iam.gke.io/gcp-service-account: <GSA_EMAIL>.

    line 165
  13. Very specific:

    If no role ARN resolves, leave the ServiceAccount unannotated.

    line 166

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Identity translation

<!-- Disabling markdownlint MD029 to provide explicit ordering to avoid confusing the LLM. --><!-- markdownlint-disable MD029 --><!-- Disabling markdownlint MD030 to allow the list overflowing to numbers >=10. --><!-- markdownlint-disable MD030 -->

Purpose

Automate the mapping and translation of application-level service account identities from Amazon Elastic Kubernetes Service (EKS) IRSA (IAM Roles for Service Accounts) and Amazon EKS Pod Identity to Google Kubernetes Engine (GKE) Workload Identity.

When to use this skill

Trigger on:

  • "Translate EKS ServiceAccount annotations to GKE Workload Identity annotations"
  • "Map AWS IRSA to GKE Workload Identity"
  • "Translate EKS Pod Identity associations to GKE Workload Identity"
  • "Generate Workload Identity mapping for Kubernetes ServiceAccounts in cluster production"

Prerequisites

  • python3 version 3.10 or later
  • Install dependencies listed in scripts/requirements.txt: pip install --require-hashes -r scripts/requirements.txt
  • Path to handoff directory containing workload-handoff.json (or workload-handoff-namespace.json) and identity-map.json

Assets and references

The following schema files under assets/schemas/ define the JSON contracts used by this skill:

  • identity-map.schema.json: Schema for validating ServiceAccount identity mappings.
  • workload-handoff.schema.json: Schema for cluster-level workload handoff specifications.
  • workload-handoff-namespace.schema.json: Schema for namespace-level workload handoff specifications.

The following reference document under references/ provides identity mapping guidance:

  • references/irsa_to_wif_mapping.md: Guidance for translating AWS IRSA roles to GKE Workload Identity Federation (WIF).

The following dependency files under scripts/ are used by this skill:

  • scripts/requirements.in: Input dependencies for python validation scripts.
  • scripts/requirements.txt: Hashed dependency lockfile for python validation scripts. Install using: pip install --require-hashes -r scripts/requirements.txt

Procedure

Step 1 — Validate identity mapping completeness

Verify that every EKS Kubernetes ServiceAccount (KSA) requiring cloud resource access has a corresponding Google Service Account (GSA) email mapping in identity-map.json:

[!IMPORTANT]

Point ${HANDOFF_DIR} to a clean, specific directory for the current migration run (for example, containing only the relevant workload-handoff.json and identity-map.json). If multiple or archived migration runs exist in subdirectories, validation fails to prevent ambiguous mappings.

python3 scripts/validate_identity_map.py --handoff-dir "${HANDOFF_DIR:-.}"

Failure handling and remediation

If validate_identity_map.py reports errors, take the following actions:

  • Missing mappings (Verification failed!):
    • Locate unmapped ServiceAccounts in the error output (for example, <namespace>/<sa-name> (requires: <irsa-role-arn>)).
    • Request the target Google Service Account email from the platform engineer, or create a dedicated GSA with the necessary Google Cloud IAM roles.
    • Add the missing mapping to identity-map.json:

      {
        "source": "<irsa-role-arn>",
        "target": "<gsa-name>@<project-id>.iam.gserviceaccount.com"
      }
    • Re-run validate_identity_map.py to confirm all mappings resolve.
  • Conflicting IRSA Role ARNs for a ServiceAccount:
    • Multiple workloads in the same namespace share a ServiceAccount name but specify conflicting IRSA Role ARNs.
    • GKE Workload Identity annotations attach per ServiceAccount, not per Pod or workload.
    • Refactor the workloads in the source cluster to use distinct ServiceAccounts, or standardize them to share a single IAM role.
  • Conflicting duplicate source ARNs in identity-map.json:
    • The same AWS IAM Role ARN maps to multiple differing GSA target emails.
    • Edit identity-map.json to resolve the conflict so each source role unambiguously maps to a single target GSA.
  • Missing schema or handoff files (FileNotFoundError):
    • Verify that ${HANDOFF_DIR} contains workload-handoff.json (or workload-handoff-namespace.json) and identity-map.json.
    • Verify that assets/schemas/identity-map.schema.json exists in the skill directory.

Step 2 — Translate workload annotations

When translating each ServiceAccount manifest:

  1. Identify any ServiceAccount resource with its namespace (defaulting to default if unspecified) and name.
  2. Resolve the source AWS IAM Role ARN:
    • IRSA (Manifest annotation): If metadata.annotations exists and contains eks.amazonaws.com/role-arn:
      • Extract the AWS IAM Role ARN from eks.amazonaws.com/role-arn.
      • Remove all EKS-specific annotations:
        • eks.amazonaws.com/role-arn
        • eks.amazonaws.com/sts-regional-endpoints
    • EKS Pod Identity (Handoff cross-reference): If metadata.annotations does not exist or lacks eks.amazonaws.com/role-arn:
      • Cross-reference workload-handoff.json (or workload-handoff-namespace.json) matching (namespace, service_account) against workloads[].dependencies.service_account.
      • Extract dependencies.irsa_role_arn (upstream eks-discovery resolves both IRSA annotations and EKS Pod Identity associations into this field).
  3. Add the GKE Workload Identity annotation:
    • If a source AWS IAM Role ARN resolves via step 2:
      • Retrieve <GSA_EMAIL> from the target mapping of that ARN in identity-map.json.
      • Add the annotation: iam.gke.io/gcp-service-account: <GSA_EMAIL>.
    • If no role ARN resolves, leave the ServiceAccount unannotated.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.