Skip to main content

apply traits to your YAML template

Project description

traits define demo:

name: demo
rules:
- name: never-restart
  path: .spec.template.spec.restartPolicy
  value: Never
  action: replace
- name: upper-name
  path: .spec.template.spec.containers.0.name
  value: Upper
  action: function
- name: default-tag
  path: .spec.template.spec.containers.0.image
  value: :latest
  action: concat
- name: default-env
  path: .spec.template.spec.containers.0.env
  value: 
    - name: PYTHONUNBUFFERD
      value: 1
  action: extend

template demo:

apiVersion: batch/v1
kind: Job
metadata:
  name: hello
spec:
  template:
    spec:
      containers:
      - name: hello
        image: busybox
        command: ['sh', '-c', 'echo "Hello, Kubernetes!" && sleep 3600']
      restartPolicy: OnFailure

apply trais on template

traits traits.yaml job.yaml | yp -y
apiVersion: batch/v1
kind: Job
metadata:
  name: hello
spec:
  template:
    spec:
      containers:
        - name: HELLO
          image: busybox:latest
          command:
            - sh
            - -c
            - echo "Hello, Kubernetes!" && sleep 3600
          env:
            - name: PYTHONUNBUFFERD
              value: 1
      restartPolicy: Never

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytraits-0.0.2.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file pytraits-0.0.2.tar.gz.

File metadata

  • Download URL: pytraits-0.0.2.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.10

File hashes

Hashes for pytraits-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7b77191633eb71ccdf60a8d94f8c7df257f088f4e8121cc81fc9f5fe844a965c
MD5 40230e70d34032331fa9efd2c2e2a992
BLAKE2b-256 0b37c72ddc0e99d1de56c8c1b8de9cb43e33785444bc416fd12319a72d66391d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page