Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Gatekeeper Policies
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IT Common Platform
platform-support
helm-charts
Gatekeeper Policies
Merge requests
!72
[
PLATFORM-2185
] Configure Image Provenance admission control with Gatekeeper
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
[
PLATFORM-2185
] Configure Image Provenance admission control with Gatekeeper
PLATFORM-2207-aatemnke2
into
master
Overview
3
Commits
7
Pipelines
14
Changes
4
Merged
Alain Atemnkeng
requested to merge
PLATFORM-2207-aatemnke2
into
master
11 months ago
Overview
3
Commits
7
Pipelines
14
Changes
2
Expand
[
PLATFORM-2185
] Configure Image Provenance admission control with Gatekeeper
0
0
Merge request reports
Viewing commit
d405de20
Prev
Next
Show latest version
2 files
+
42
−
1
Expand all files
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
Verified
d405de20
[
PLATFORM-2185
] Configure Image Provenance admission control with Gatekeeper
· d405de20
Alain Atemnkeng
authored
11 months ago
templates/constraint_image_admission_controller.yaml
0 → 100644
+
41
−
0
Options
apiVersion
:
templates.gatekeeper.sh/v1beta1
kind
:
ConstraintTemplate
metadata
:
name
:
k8simageprovenance
spec
:
crd
:
spec
:
names
:
kind
:
K8sImageProvenance
validation
:
openAPIV3Schema
:
type
:
object
properties
:
targets
:
-
target
:
admission.k8s.gatekeeper.sh
rego
:
|
package k8simageprovenance
violation[{"msg": msg}] {
input.review.object.kind == "Pod"
container := input.review.object.spec.containers[_]
not startswith(container.image, "docker.io/")
not startswith(container.image, "quay.io/")
not startswith(container.image, "public.ecr.aws/")
not startswith(container.image, "gcr.io/")
not startswith(container.image, "ghcr.io/")
not startswith(container.image, "harbor.")
not startswith(container.image, "gitlab.")
msg := sprintf("Image %v is not from an allowed repository", [container.image])
}
---
apiVersion
:
constraints.gatekeeper.sh/v1beta1
kind
:
K8sImageProvenance
metadata
:
name
:
image-provenance-constraint
spec
:
enforcementAction
:
deny
match
:
kinds
:
-
apiGroups
:
[
"
"
]
kinds
:
[
"
Pod"
]