yq

command
v0.0.1-beta07 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

README

patch

This function patches resources using a YQ expression that serves as both a selector and a patch.

Usage

apiVersion: kude.kfirs.com/v1alpha2
kind: Pipeline
resources:
  - deployment1.yaml
  - deployment2.yaml
steps:
  - image: ghcr.io/arikkfir/kude/functions/yq
    config:
      expr: |-
        . |= with(
          select(.apiVersion == "apps/v1" and 
                 .kind == "Deployment" and 
                 .metadata.labels.app == "my-app");
          .spec.template.spec.tolerations += { "key": "workload-nodes", "operator": "Exists" }
        )

This will add the given toleration to any Deployment object matching the label selector app=my-app.

You can update multiple properties in matching objects like so:

apiVersion: kude.kfirs.com/v1alpha1
kind: Pipeline
resources:
  - deployment1.yaml
  - deployment2.yaml
pipeline:
  - image: ghcr.io/arikkfir/kude/functions/yq
    config:
      expr: |-
        . |= with(
          select(.apiVersion == "apps/v1" and 
                 .kind == "Deployment" and 
                 .metadata.name == "first-deployment");
          .metadata.labels.app = "first" | 
          .spec.replicas = 3
        )

This will add the label app with the vaue first to the deployment called first-deployment, and will also set the spec/replicas field to 3.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL