mirror of
https://github.com/kyverno/kyverno.git
synced 2025-01-20 18:52:16 +00:00
restrict cjs by PSS restricted checks (#5904)
Signed-off-by: ShutingZhao <shuting@nirmata.com> Signed-off-by: ShutingZhao <shuting@nirmata.com>
This commit is contained in:
parent
c0875f16e6
commit
c5277ccc44
1 changed files with 14 additions and 0 deletions
|
@ -156,6 +156,9 @@ func (c *controller) buildCronJob(cronJob *batchv1.CronJob, pol kyvernov2alpha1.
|
||||||
}
|
}
|
||||||
var successfulJobsHistoryLimit int32 = 0
|
var successfulJobsHistoryLimit int32 = 0
|
||||||
var failedJobsHistoryLimit int32 = 1
|
var failedJobsHistoryLimit int32 = 1
|
||||||
|
var boolFalse bool = false
|
||||||
|
var boolTrue bool = true
|
||||||
|
var int1000 int64 = 1000
|
||||||
// set spec
|
// set spec
|
||||||
cronJob.Spec = batchv1.CronJobSpec{
|
cronJob.Spec = batchv1.CronJobSpec{
|
||||||
Schedule: pol.GetSpec().Schedule,
|
Schedule: pol.GetSpec().Schedule,
|
||||||
|
@ -178,6 +181,17 @@ func (c *controller) buildCronJob(cronJob *batchv1.CronJob, pol kyvernov2alpha1.
|
||||||
// "/tmp/ca.crt",
|
// "/tmp/ca.crt",
|
||||||
fmt.Sprintf("%s%s?policy=%s", c.cleanupService, CleanupServicePath, policyName),
|
fmt.Sprintf("%s%s?policy=%s", c.cleanupService, CleanupServicePath, policyName),
|
||||||
},
|
},
|
||||||
|
SecurityContext: &corev1.SecurityContext{
|
||||||
|
AllowPrivilegeEscalation: &boolFalse,
|
||||||
|
RunAsNonRoot: &boolTrue,
|
||||||
|
RunAsUser: &int1000,
|
||||||
|
SeccompProfile: &corev1.SeccompProfile{
|
||||||
|
Type: corev1.SeccompProfileTypeRuntimeDefault,
|
||||||
|
},
|
||||||
|
Capabilities: &corev1.Capabilities{
|
||||||
|
Drop: []corev1.Capability{"ALL"},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue