Skip to content

‘_’ seems to be a bit unexpected. #265

Closed
@reckless-huang

Description

@reckless-huang

kcode

apiVersion = "apps/v1"
kind = "Deployment"
metadata = {
    name = _app
    labels.app = _app
}
spec = {
    replicas = 3
    selector.matchLabels = metadata.labels
    template.metadata.labels = metadata.labels
    template.spec.containers = [
        {
            name = metadata.name
            image = "${metadata.name}:1.14.2"
            ports = [{ containerPort = 80 }]
            $protocol = "TCP"
        }
    ]
}
#_app: str = option("app") or "default"
_app = option("app", "str", False, "", "工程名")

output

apiVersion: apps/v1
kind: Deployment
metadata:
  labels: {}
spec:
  replicas: 3
  selector:
    matchLabels: {}
  template:
    metadata:
      labels: {}
    spec:
      containers:
      - image: Undefined:1.14.2
        ports:
        - containerPort: 80
        protocol: TCP

why _app not render as value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions