Skip to content

k8s import: an object name with a colon becomes an invalid identifier #5072

Closed

Description

@lex00

Found with chant 0.124.95 while reading a clone of kubernetes/k8s.io at commit 2b3d9153 offline, for #5067.

chant import writes an invalid identifier for a Kubernetes object whose name contains :.

export { roleCertManagerCainjector:leaderelection } from "./other";
Transform failed with 1 error: ... Expected "}" but found ":"

Files: apps/cert-manager/cert-manager.yaml (cert-manager-cainjector:leaderelection) and infra/aws/terraform/prow-build-cluster/resources/kube-system/metrics-server/rbac.yaml (system:metrics-server).

Names with : are normal for RBAC objects (system:*), so any cluster's RBAC export hits this.

Wanted: the identifier generator replaces every character that is not valid in a JavaScript identifier, and keeps the original name in metadata.name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:k8sbugepic:estate-read

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions