-
Notifications
You must be signed in to change notification settings - Fork 37
/
src.rego
24 lines (20 loc) · 897 Bytes
/
src.rego
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# METADATA
# title: 'RHCOP-OCP_BESTPRACT-00019: DeploymentConfig triggers not set'
# description: If you are using a DeploymentConfig without 'spec.triggers' set, you
# could probably just use the k8s Deployment.
# custom:
# matchers:
# kinds:
# - apiGroups:
# - apps.openshift.io
# kinds:
# - DeploymentConfig
# skipConstraint: true
package ocp.bestpractices.deploymentconfig_triggers_notset
import data.lib.konstraint.core as konstraint_core
import data.lib.openshift
violation[msg] {
openshift.is_deploymentconfig
konstraint_core.missing_field(konstraint_core.resource.spec, "triggers")
msg := konstraint_core.format_with_id(sprintf("%s/%s: has no triggers set. Could you use a k8s native Deployment? See: https://kubernetes.io/docs/concepts/workloads/controllers/deployment", [konstraint_core.kind, konstraint_core.name]), "RHCOP-OCP_BESTPRACT-00019")
}