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 hashes)

Uploaded Source

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