@soft-stech/kyverno
v0.2.0
Published
Kyverno models
Downloads
3
Readme
@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