k8sallowedrepos
Basic Information
Function
The container image must start with a string in a specified string list.
Policy Example
The following policy instance specifies that the container image must start with openpolicyagent/.
apiVersion: constraints.gatekeeper.sh/v1beta1 kind: K8sAllowedRepos metadata: name: repo-is-openpolicyagent spec: match: kinds: - apiGroups: [""] kinds: ["Pod"] namespaces: - "default" parameters: repos: - "openpolicyagent/"
Resource Definition That Complies with the Policy
The container image starts with openpolicyagent/, which complies with the policy instance.
apiVersion: v1 kind: Pod metadata: name: opa-allowed spec: containers: - name: opa image: openpolicyagent/opa:0.9.2
Resource Definition That Does Not Comply with the Policy
The container image starts with nginx, which does not comply with the policy instance.
apiVersion: v1 kind: Pod metadata: name: nginx-disallowed spec: containers: - name: nginx image: nginx
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot