@kubernetes-models/kyverno
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

@kubernetes-models/kyverno

Kyverno models.

Installation

Install with npm.

npm install @kubernetes-models/kyverno

Usage

import { ClusterPolicy } from "@kubernetes-models/kyverno/kyverno.io/v1/ClusterPolicy";

// Create a new ClusterPolicy
const policy = new ClusterPolicy({
  metadata: {
    name: "require-labels"
  },
  spec: {
    validationFailureAction: "enforce",
    background: false,
    rules: [
      {
        name: "check-team",
        match: {
          any: [
            {
              resources: {
                namespaces: ["default"],
                kinds: ["Pod"]
              }
            }
          ]
        },
        validate: {
          message: "label team must be set",
          pattern: {
            metadata: {
              labels: {
                team: "?*"
              }
            }
          }
        }
      }
    ]
  }
});

// Validate against JSON schema
policy.validate();

License

MIT

/@kubernetes-models/kyverno/

    Package Sidebar

    Install

    npm i @kubernetes-models/kyverno

    Weekly Downloads

    320

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    3.56 MB

    Total Files

    115

    Last publish

    Collaborators

    • tommy351