Skip to main content

k8s_job resource

Use the k8s_job Chef InSpec audit resource to test the configuration of a specific Job in the specified namespace.

Installation

Syntax

describe k8s_job(name: 'HELLO') do
  it { should exist }
end

Parameter

name
Name of the Job.
namespace
Namespace of the resource (default: default).

Properties

uid
UID of the Job.
name
Name of the Job.
namespace
Namespace of the Job.
resource_version
Resource version of the Job. This is an alias of resourceVersion.
labels
Labels associated with the Job.
annotations
Annotations associated with the Job.
kind
Resource type of the Job.
creation_timestamp
Creation time of the Job. This is an alias of creationTimestamp.
metadata
Metadata for the Job.

Examples

Job for default namespace must exist and test its properties

describe k8s_job(name: 'pi') do
  it { should exist }
  its('uid') { should eq 'a31e4d72-816d-4678-8cda-34973bc7808b' }
  its('resource_version') { should eq '818' }
  its('labels') { should_not be_empty }
  its('annotations') { should_not be_empty }
  its('name') { should eq 'pi' }
  its('namespace') { should eq 'default' }
  its('kind') { should eq 'JOB' }
  its('creation_timestamp') { should eq '2022-08-02T12:05:40Z' }
end

Job for a specified namespace must exist

describe k8s_job(name: 'HELLO-WORLD', namespace: 'Namespace') do
  it { should exist }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.
Edit this page on GitHub

Thank you for your feedback!

×










Search Results