Skip to content

Help: Unable to get array filter working #760

@yene

Description

@yene

My goal is to read/write the image in the following k8s YAML

kind: Deployment
apiVersion: apps/v1
metadata:
  namespace: default
  name: whoami
  labels: 
    app: whoami
spec:
  replicas: 1
  selector:
    matchLabels:
      app: whoami
  template:
    metadata:
      labels:
        app: whoami
    spec:
      containers:
      - name: whoami-container
        image: containous/whoami
        ports: 
          - name: web
            containerPort: 80

It worked in v3 with:

yq w -i  deployment.yaml "spec.template.spec.containers(name==whoami-container).image" "containous/whoami:v2"

But I can't get it to work in v4:

yq e '.spec.template.spec.containers | select(.name == "whoami-container")' deployment.yaml 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions